74HC4051 Analog Multiplexer
This was actually the first time I ever needed to multiplex analog channels so it was a good opportunity to learn how to use them. My task was to measure the temperature of 32 thermistors (NTC) with a microcontroller and later process that data. Obviously you cant find that much analog input channels on your common microcontroller so you need to multiplex the signals. First I looked for large analog multiplexers with 16 input channels but those are way too expensive. As it turns out its cheaper to use more smaller 8ch multiplexers(example Digikey pricing: 2pcs 16:1 mux from TI is $7.84 while 3pcs of 8:1 mux from TI is $1.53). I was able to get the 74HC4051 at a good price so I started creating the design around it.
With just four 74HC4051 I can multiplex 32 input channels to 4 outputs. The 74HC4051 has 3 select lines A,B,C and one enable line E. These 4 lines are used for control and they can be tied together like I did for controlling all 4 chips with the same 4 lines. By a combination of state (high/low) for A,B and C you can control which input gets connected to the output. In the schematic you will also find a table with the address select concerning the 3 pins A,B and C. The enable pin is used to disconnect all internal switches (when high) or allow connection (when low) by selecting the appropriate address. Each 74HC4051 got its own 0.1uF decoupling cap close to its supply pins and if you’re design is very sensitive to noise you can further optimize the layout and place more filtering on the supply lines.
To get a more stable reading at the output of the thermistor(actually at the output of the multiplexer) I also placed a low pass filter which later on after assembling and testing turned out to be unnecessary even creating problems because I was switching the lines faster than it took the filter to settle so I left the filter components out during assembly.
The PCB was manufactured at home hence the big vias and it was designed to allow a second board with the microcontroller to be stacked on top of it. Everything was tested on an Arduino and it works perfectly. The schematics and board file are released under CC-BY-SA and can be downloaded from the link bellow.
Downloads:




September 14th, 2011 at 6:12 pm
Nice work man. Looks cool. But I do think that you should have anti-aliasing filters on each MUX input if you are sampling an analogue signal.
I also tend to leave out the decoupling CAPS on MUXs in my own designs as I never see them mentioned in the datasheets (whereas most other IC datasheets will). Not sure if that is the right approach though.
September 14th, 2011 at 6:26 pm
[...] from Youritronics.com made a new project 74HC4051 analog [...]
September 14th, 2011 at 6:59 pm
I haven’t left out the decoupling caps but rather the low-pass filter on the output which was causing problems. A software filter would be best in this situation but since the output from the thermistors is so stable I don’t need it.
September 14th, 2011 at 7:18 pm
You misunderstood. I was addressing the decoupling caps and the anti-aliasing filter as separate issues. You need to put an anti-aliasing filter on each input before the MUX stage rather than just one after the MUX stage. The cutoff of these should be twice the sampling frequency of the ADC. I guess it works fine like this if the thermistors never vary at high frequency as there will be no signal to be aliased but if they do or if you want to use this board to measure analogue outputs at higher frequencies you may run into problems.
September 14th, 2011 at 7:25 pm
ok I understand now. That was the initial idea to put low pass filters on each input but i couldn’t route that so i can DIY fab the pcb. So I moved them onto the outputs instead of 32 low pass filters now I had only 4, but eventually I got rid of them because they weren’t needed.
September 14th, 2011 at 7:33 pm
It should be possible to route a simple RC filter on each input even for home fab no?
How come you went for 32:4 rather than 32:1? You could use the enable line on each MUX to select it and connect all their outputs together.
September 14th, 2011 at 7:38 pm
Well 4 analog input ports are not a problem and its just the way I imagined it 32:4. It could of been 32:1 as well but routing RC filters for each input channel, considering Eagle limitations of 80×100 mm was impossible without having to place hundreds of via’s which would of took forever to hand assemble.
September 20th, 2011 at 12:19 pm
[...] Analog Multiplexer – [Link] Tags: 74HC4051, analog, Microcontroller, multiplexer, NTC, thermistors Filed in [...]
October 26th, 2011 at 11:53 am
I see some other components on the pictures. The schematic/pcb in the .zip file are not the same.
October 26th, 2011 at 2:08 pm
in the picture you also have an op-amp for measuring GSR (Galvanic Skin Response) That is not multiplexed in any way so I removed it from the schematic.
December 5th, 2011 at 4:47 pm
Have you considered making this into a shield for the NetDuino (Arduino) and selling it? I would buy some!
December 5th, 2011 at 4:52 pm
Actually, even if you were to sell the board as is (not a shield) I would buy one!
December 5th, 2011 at 7:18 pm
I can make you some shields if you’re interested. Of course it would take time, like 4-6 weeks and considering the holidays are approaching it could be up to 8 weeks. What do you think ?
December 6th, 2011 at 2:55 pm
FYI there already is an Arduino MUX shield: http://mayhewlabs.com/products/arduino-mux-shield
December 14th, 2011 at 7:45 pm
I think that is the one he found on sparkfun.
December 26th, 2011 at 11:13 pm
This group seems pretty sharp. I am looking for someone who can help me make a 9 note tone generator (1 octave of music in the key of G). The tones will be triggered by 9 switches and output to a small piezo speaker. It will need to be small (2.5″ x 1.25″ x 0.5″ tall). Does anybody have a source that could get this done cheaply?