How hard can it be to use 74HC4051? - Page 1
Forum section: electronics / beginners

author: miceuz
author_rank: Frequent Contributor
timestamp: December 17, 2013, 08:42:08 pm
content: Hi all,I've spent whole today to make the CD74HC4051 analog multiplexer/demultiplexer to work.I have 8 phototransistors hooked up to it and am feeding it's output straight to AVR adc input. The first several inputs work as expected, but it gets fishy as I go to higher inputs - sometimes they work ok, but higher I go, the funkier it gets, until input 7 does not work at all - I can see oscillations in my readings and it takes long time of shining a light directly into a phototransistor for the value (rather said oscillations) to get lower.I've tried measuring resistance of channels with a multimeter (I'm not sure if it's proper way to do it) for the first one I get ~60 ohms - as per datasheet, the last channel gives me 100 of kilo ohms, fluctating.Untorfunatelly I didn't have a scope to look at the signals, but really, wtf, I didn't expect to have problems like these.I have all the decoupling capacitors in place and I've tried replacing a chip - exactly the same simptoms with a new one...Can somebody explain, what was I doing wrong? All the schematics I've seen on the net are as straight forward as mine.

author: free_electron
author_rank: Super Contributor
timestamp: December 17, 2013, 08:52:57 pm
content: WHERE IS POWER CONNECTED TO THE 4051 ?

author: Psi
author_rank: Super Contributor
timestamp: December 17, 2013, 08:59:51 pm
content: Wild stab in the dark..Are A B C controlled by the MCU? If so, check you have those pins set as output in the data direction registers.If they are still default (input) you're might be turning on/off the input pullups instead, that might sortof work - kinda, but could show up as problems with higher value channels, ABC = 111 being the highest (channel 7)On AVR at least, PORTX controls pullups if DDRX is in input mode

author: c4757p
author_rank: Super Contributor
timestamp: December 17, 2013, 09:02:00 pm
content: Quote from: free_electron on December 17, 2013, 08:52:57 pmThis is the braindead crap that is the built-in KiCad library. Some nitwit thought it would be a good idea to have logic chips implicitly connect to VCC and GND nets.You can connect them as you wish by clicking "show hidden pins" or something to that effect. I refuse to use this library though.

author: miceuz
author_rank: Frequent Contributor
timestamp: December 17, 2013, 09:02:43 pm
content: Quote from: free_electron on December 17, 2013, 08:52:57 pmSorry for the messy schematic. This is just a Kicad trick with hidden power pins which are connected to a named netlist by default.Power is connected like this: GND goes to pins 7 and 8 (Vee, Vss), +5V goes to pin 8 (Vdd)

author: fcb
author_rank: Super Contributor
timestamp: December 17, 2013, 09:05:20 pm
content: Quote from: free_electron on December 17, 2013, 08:52:57 pmOn the basis that no-one is that stupid..Make sure you connect GND on the 4051 to your 0v, and then Vee to your lowest rail (in your case also 0v)

author: miceuz
author_rank: Frequent Contributor
timestamp: December 17, 2013, 09:06:33 pm
content: Quote from: Psi on December 17, 2013, 08:59:51 pmbeen stabbed by this in the past - I'm sure I switch them on, not pullups, verified that with a multimeter.Btw, channel 7 gets heavily loaded by a multimeter - when I try to measure the output, it slams to 0 and then oscillates just above of that.And it's not a problem in particular phototransistor - i've tried swapping them, effect is the same.

author: free_electron
author_rank: Super Contributor
timestamp: December 17, 2013, 09:11:15 pm
content: Quote from: miceuz on December 17, 2013, 09:02:43 pmsure sure, but ARE they connected ?it's not because you think they are that they really are ...some channels work , some don't.... smells llike a chip that doesn't have appropriate power supply...

author: Psi
author_rank: Super Contributor
timestamp: December 17, 2013, 09:14:24 pm
content: Check the colors on all those pullup resistors you have for the phototransistors.You might have a 1.5meg mixed in with the 15k or somethingQuote from: miceuz on December 17, 2013, 09:06:33 pmThat cant really be verified with a meter. The meter will quite happily read active pullup = VCC and no pullup as ~GND. Just like a real output

author: miceuz
author_rank: Frequent Contributor
timestamp: December 17, 2013, 09:16:56 pm
content: Quote from: miceuz on December 17, 2013, 09:02:43 pmwell, I've doublechecked the power supply several times. will try it on a breadboard tomorrow, this was a rather crowded veroboard build.I've thought I've fried the chip while soldering (never did that once in 4 years), so I've soldered another one while heatsinking pins with aligator clip and I was really quick.

author: Psi
author_rank: Super Contributor
timestamp: December 17, 2013, 09:19:20 pm
content: Quote from: miceuz on December 17, 2013, 09:16:56 pm10 points says the problem is a wiring error here.

author: miceuz
author_rank: Frequent Contributor
timestamp: December 17, 2013, 09:21:16 pm
content: Quote from: Psi on December 17, 2013, 09:14:24 pmPullups of atmegas usually show lower than VCC ~4.5V, high outputs - 5V bang on.

author: mrkev
author_rank: Regular Contributor
timestamp: December 17, 2013, 09:22:27 pm
content: Is /Mux_e really at L? I would recomend to make sure that your cable from P7 to uC is OK and to always use pulldown/pullup resistors on board for pins like /reset, /e, etc..