MetOne Windvane: Testing the MLX90316 angle sensor – Part Deux

During testing the wind vane pot replacement, I was getting some weird results.  I was getting errors like NO SPI DEVICE FOUND, weak magnetic field, and generally not being reliable.  Part of the problem was a solder bridge between pins 2 and 3 on the MLX90316 PCB (J1) header and it so happens that pin 2 goes to ground when the anemometer reed switch closes it messes up (technical term 🙂 ) the SS (slave select) signal from the MCU.  No wonder I was getting NO SPI DEVICE FOUND!  Removing the solder bridge should fix a lot of the errors I was getting.  Also, after making the height of the magnet adjustable above the sensor, no more complaints about weak magnetic field.  I still need to see if the MLX90316 works reliably using an 8-12′ cable between it and the Wemos D1Mini. 

I found this out by using a LOT shorter wires to the test jig since it DID work fine with the sensor on the breadboard.  The only other difference was using 100nF bypass capacitors (specified on the Melexis PDF) instead of 10nF I had mistakenly used earlier. 

This, then is the output from my WindSubsystemTest code using the PlatformIO VSCode extension:

Starting MetOne 034B Wind Subsystem Test.

pulseCount: 0 revCount: 0 rps: 0 rpm: 0 miles/hour: 0

No SPI signal or MLX angle sensor not found…


pulseCount: 1      revCount: 0 rps: 0    rpm: 0     MPH: 0
Heading: 65 Card: NNE
pulseCount: 4     revCount: 2 rps: 0    rpm: 0      MPH: 0
Heading: 49 Card: NNE
pulseCount: 75   revCount: 37 rps: 7   rpm: 420   MPH: 26
Heading: 39 Card: NNE
pulseCount: 22  revCount: 11 rps: 2   rpm: 120   MPH: 8
Heading: 49 Card: NNE
pulseCount: 64  revCount: 32 rps: 6   rpm: 360   MPH: 22
Heading: 57 Card: NNE
pulseCount: 52  revCount: 26 rps: 5   rpm: 300   MPH: 18
Heading: 57 Card: NNE
pulseCount: 26  revCount: 13 rps: 2   rpm: 120   MPH: 8
Heading: 68 Card: NNE

I connected the 034B sensor board to the test breadboard with the D1Mini via the 12′ ethernet cable and it does work a LOT better; I’m getting spurious “magnetic field too weak” and SPI issues, and that might be the cable.  I don’t really need 12′ distance to the D1Mini anyway.  (I don’t think.)   Next to do: fix the cardinal direction, since it always shows “NNE” and make sure the wind speed is accurate and I’m not getting a bunch of reed switch contact bounces.

Starting MetOne 034B Wind Subsystem Test.
pulseCount: 0 revCount: 0 rps: 0 rpm: 0 MPH: 0

No SPI signal or MLX angle sensor not found…  (This one is pretty normal on startup)
pulseCount: 1 revCount: 0 rps: 0 rpm: 0 MPH: 0
Heading: 331 Card: NNE
pulseCount: 18 revCount: 9 rps: 1 rpm: 60 MPH: 4
Heading: 311 Card: NNE
pulseCount: 25 revCount: 12 rps: 2 rpm: 120 MPH: 8
Heading: 311 Card: NNE
pulseCount: 18 revCount: 9 rps: 1 rpm: 60 MPH: 4
Magnetic field too weak
pulseCount: 18 revCount: 9 rps: 1 rpm: 60 MPH: 4
Magnetic field too weak
pulseCount: 18 revCount: 9 rps: 1 rpm: 60 MPH: 4
Heading: 218 Card: NNE

No SPI signal or MLX angle sensor not found…  (not normal)

pulseCount: 0 revCount: 0 rps: 0 rpm: 0 MPH: 0

No SPI signal or MLX angle sensor not found…
pulseCount: 0 revCount: 0 rps: 0 rpm: 0 MPH: 0

No SPI signal or MLX angle sensor not found…
pulseCount: 0 revCount: 0 rps: 0 rpm: 0 MPH: 0

No SPI signal or MLX angle sensor not found…

Leave a Reply

Your email address will not be published. Required fields are marked *