Author Options:

Best analog multiplexer IC for NodeMCU or other 3.3v microcontroller? Answered

I am looking for an analog multiplexer IC in a DIP package that I can use with a NodeMCU. I would like a minimum of 4 pins, but more would be fine. I will be using it so that I can use multiple capacitive soil moisture sensors with a NodeMCU, which only has 1 analog input. I was looking at maybe the 74HC4051 or MAX4734 or one of the 74LV405x? Or the SN74HC4051N? Which one of these would work or be better or is there another option? Here is a link to the soil moisture sensor I am using-https://www.aliexpress.com/item/33042209039.html?spm=a2g0o.cart.0.0.52713c006kRBs8&mp=1


The forums are retiring in 2021 and are now closed for new topics and comments.
Jack A Lopez
Jack A Lopez

1 year ago

Would it be rude for me to mention there are versions of the same sensor, but with i2c output, so that you can put a bunch of them on the same i2c bus, and just have your microprocessor query each sensor, one at a time, by its address?

Right. But can those, i2c output, soil moisture sensors beat the price (~1 USD per) of the ones you pointed to at AliExpress?

Regarding analog switches, I expect those should work too.

I recall one time I built a sort of, "stair step" function generator, using a voltage divider, a counter, and a CD4051 which is a 8-to-1 analog switch.

The voltage divider had enough resistors to divide the supply into 8 evenly spaced, voltage steps, and those were connected to the 8 input/output pins. Then the counter was used to drive those three address bits, so the one "common pin" would alternately get switched to one of those eight multiplexed pins.

Anyway, I guess where I am going with this story, is that it is easy enough for you to build a voltage divider, with 8 evenly spaced voltage steps, so you have some known analog voltages.

Then you can test your analog switch IC's ability to switch from one input to the next, and read each analog voltage using your microprocessor's single analog input pin, and you know, check that it is actually doing it right.

I am guessing the 4051 is preferable because it will give you the possibility of looking at up to eight analog voltages, with a single IC. I know you said you only have four sensors, but maybe there might be room for more in the future.

Regarding the question of which logic family to use, "74HC," or "74LV," or whatever, I am guessing you want to pick
the family that is compatible with the supply voltage for your other
things, be it 3.3 V, or 5.0 V, or whatever it is.

Also I am guessing the analog output, from the sensor, "Capacitive Soil Moisture Sensor v1.2" will be in the range 0 to 3.0 volts.

Well, if you have a voltmeter, you can check that too.

I mean, if you have a handful of these little gizmos already in your possession, then you are likely in a better position than me, for discovering how they work, and what they do.

Which reminds me: Do we have any documentation for these sensors? Or is it just the text on the product page? That and what we can glean via search engine, by searching for similar things.





Reply 1 year ago

I didnt buy the sensors yet. I had no idea there were i2c ones, maybe I will check them out. Thanks for the info, that helps alot!!


1 year ago

the what? The soil moisture sensor? I am looking for an analog multiplexer, I am not using one right now.