I am trying to read from 22 units of SS49E Hall Effect analog sensors using 3xCD4051 mux and 1 Wemos D1 mini.
Config:
- Connect 22 hall sensors' Vcc legs to D1 mini's 3.3v pin
- Connect 22 hall sensors' Gnd legs to D1 mini's gnd pin
- Connect 22 hall sensors' Output legs to 3 CD4051 mux
- Connect 6 digital signals to 3 mux (3 signals to each mux's enable pin and 3 signals to every mux's s0, s1, s2)
Steps:
- Disable mux 2 and mux 3, enable mux 1, change s0, s1, s2 8 times to get the #1-#8 hall sensors reading
- Disable mux 1 and mux 3, enable mux 2, change s0, s1, s2 8 times to get the #9-#16 hall sensors reading
- Disable mux 1 and mux 2, enable mux 3, change s0, s1, s2 6 times to get the #17-#22 hall sensors reading
Problem:
- At the beginning, it works fine
- After awhile, the mux seems to not read correctly, for example
a. When I approach a magnet to #1 sensor, the reading of #1 from the mux is not changed. But if I approach a magnet to #2 sensor, the reading of #1 and #2 sensor would change together but the readings are not identical. Adding more delay time doesn't fix this issue
- After a whole day test, some hall sensor readings seems broken (reading below 100 while the reading should be around 500. And the value doesn't change if a magnet approach.
Note:
- I have no problem if I only try to use 1 mux and read 6 hall sensors. Same problems would happen with 8 hall sensors
- By replace the new set of wemos d1 mini, 3 mux, it starts to work fine again for awhile (didn't need to replace the hall sensors
Guess:
- the current draw of such amount of sensors exceed the limit the 3.3v pin on the Wemos D1 mini
Questions:
- What is the cause to the problems?
- How can I fix the problem?
- How should I do it differently, what are the options?
Attached are the schematic and the hall sensor datasheets. Thanks.
ss49e_datasheet.pdf (1000 KB)
Not a very useful schematic. Does not show the Wemos or any of the sensors. Not necessary to show all 22 sensors, just one or two on each mux.
Certainly possible that the Wemos' 3.3V regulator is overloaded. Does it get hot? It is rated for max 500mA, but overheating can often be a problem even when the current drawn is much lower than the max. The Wemos will normally draw around 80mA. Your sensors may consume 6~10mA each according to the data sheet, so 22 of them could draw as much as 220mA. The 74hc4051 do not draw much current. So the load on the regulator could be as high as ~300mA. What current do you measure on the 3.3V line?
It's it a genuine Wemos? If you don't know for sure, then it won't be. The clones have been known to give problems.
You can power the sensors and mux chips with 5V, so bypassing the Wemos' regulator. To bring the output voltages back down to below 3.3V for the A0 pin, put a 220K resistor between the mux chips and the A0 pin.
Another thing that concerns me is how you connected the output "Z" pins of the three mux chips together. Reading the data sheet, I agree it should be ok, provided your sketch makes sure that only one of the Enable pins is low at the same time. It's that how you coded it? One of the 3 enable pins low and the other two high? When you change the enable pins, make the low pin high before making another pin low. The other thing about this idea that worries me is that when I looked on Google for example circuits containing multiple 74hc4051 with the "Z" outputs connected, I could not find any. Did you find any examples like that? It may be worth checking the current that flows in or out of each "Z" pin. To do that with a multimeter, you will need to upload a sketch that does not scan the 22 inputs, just selects one of the mux chips and one channel on that mux chip.
I use a genuine board which has a regulator rated 500mA. I am trying to use 5V to power the sensors. How was the 220k ohm resister being derived?
elginian:
I use a genuine board which has a regulator rated 500mA.
But like I said, the regulator could fail at much less than 500mA if it overheats.
elginian:
I am trying to use 5V to power the sensors.
Then the sensor outputs could go above 3.3V, which would be passed through the multiplexers and be measured as 3.3V by the Wemos' A0 pin.
elginian:
How was the 220k ohm resister being derived?
The analog input pin of the esp chip can only measure up to 1.0V. But the Wemos board contains a voltage divider consisting of a 100K and 220K resistor. This allows up to 3.3V to be measured when applied to the A0 pin. Adding a second 220K in series with the A0 pin changes the voltage divider to 100K and 440K. This allows voltages up to 5.4V to be measured.
Understood, thanks for the clarification!