Author Topic: How hard can it be to use 74HC4051?  (Read 6242 times)

0 Members and 1 Guest are viewing this topic.

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
How hard can it be to use 74HC4051?
« on: December 18, 2013, 07:42:08 am »
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.

  |O |O |O

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.  :-//

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7191
  • Country: us
    • SiliconValleyGarage
Re: How hard can it be to use 74HC4051?
« Reply #1 on: December 18, 2013, 07:52:57 am »
WHERE IS POWER CONNECTED TO THE 4051 ?
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7118
  • Country: nz
Re: How hard can it be to use 74HC4051?
« Reply #2 on: December 18, 2013, 07:59:51 am »
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
« Last Edit: December 18, 2013, 08:05:12 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7805
  • Country: us
  • adieu
Re: How hard can it be to use 74HC4051?
« Reply #3 on: December 18, 2013, 08:02:00 am »
WHERE IS POWER CONNECTED TO THE 4051 ?

This 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.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: How hard can it be to use 74HC4051?
« Reply #4 on: December 18, 2013, 08:02:43 am »
WHERE IS POWER CONNECTED TO THE 4051 ?

Sorry 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)


Offline fcb

  • Super Contributor
  • ***
  • Posts: 1267
  • Country: gb
Re: How hard can it be to use 74HC4051?
« Reply #5 on: December 18, 2013, 08:05:20 am »
WHERE IS POWER CONNECTED TO THE 4051 ?
On 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)
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: How hard can it be to use 74HC4051?
« Reply #6 on: December 18, 2013, 08:06:33 am »
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 set to input you might be turning on/off the input pullups, that might sortof work - kinda, but could show up as problems with higher value channels,   ABC = 111 being the highest (channel 7)

been 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. :-//

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7191
  • Country: us
    • SiliconValleyGarage
Re: How hard can it be to use 74HC4051?
« Reply #7 on: December 18, 2013, 08:11:15 am »
WHERE IS POWER CONNECTED TO THE 4051 ?

Sorry 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)

sure 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...
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7118
  • Country: nz
Re: How hard can it be to use 74HC4051?
« Reply #8 on: December 18, 2013, 08:14:24 am »
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 something

I'm sure I switch them on, not pullups, verified that with a multimeter.

That 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
« Last Edit: December 18, 2013, 08:18:00 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: How hard can it be to use 74HC4051?
« Reply #9 on: December 18, 2013, 08:16:56 am »
sure 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...

well, 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.

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7118
  • Country: nz
Re: How hard can it be to use 74HC4051?
« Reply #10 on: December 18, 2013, 08:19:20 am »
this was a rather crowded veroboard build.

10 points says the problem is a wiring error here.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 373
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: How hard can it be to use 74HC4051?
« Reply #11 on: December 18, 2013, 08:21:16 am »
That cant really be verified with a meter. The meter will quite happily read active pullup = VCC and no pullup as ~GND

Pullups of atmegas usually show lower than VCC ~4.5V, high outputs - 5V bang on.

Offline mrkev

  • Regular Contributor
  • *
  • Posts: 214
  • Country: cz
Re: How hard can it be to use 74HC4051?
« Reply #12 on: December 18, 2013, 08:22:27 am »
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..
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf