Hi everyone. I have recently come across lots of 4051 chips for cheap and started playing around with one on my breadboard, but for some reason the exemplary circuit on the Arduino tutorial site won't seem to work. i have everything wired per the pinout of the chip and am trying to demux with 8 leds on the eight outputs of the 4051. However, i cannot seem to make the leds light up through the TI chip!
So here are my questions.
Is there a way of testing whether the chip its self is defective?
and how does one go about troubleshooting a 4051? i read the datasheet for the chip but i could not figure out how to debug my circuit.
Could you provide a pointer to the Arduino tutorial that you followed? It is possible that the tutorial is at fault.
To test the chip:
Connect pins 6, 7, 8, 9, 10, and 11 (E, Vee, Gnd, S2, S1, S0) to ground.
Connect pin 16 (Vcc) to +5v.
Pin 13 (y0) should now be connected to pin 3 (z). If you connect +5 to (z) you should be able to light an LED+resistor on (y0). If you connect +5 to (y0) you should be able to light an LED+resistor on (z).
What i am going off of is the tutorial on arduinos site:
http://www.arduino.cc/playground/Learning/4051
i just rewired it and it works. i will post what i have learned, thank you johnwasser! your method for testing worked, i had the polarity wrong on my breadboard busbars for my setup, hooked up two negatives. after piddling around with your test method i figured out how it works:
For driving LEDS you want to drive your positive voltage through the z pin. it is a direct connection to the assigned y pin! just connect 5v to it, then wire up your leds with the positive side attached to the y pins and resistor out and ground them. this will work with multiple 4051s to make grid displays!
you don't need a communication line connected to z unless you want to read inputs! this was my mistake. i hope people keep this thread active as an accurate information source for 4051 use!
sensor noise?
for some reason my sensors ran through the 4051 are very noisy.
i have 5k potentiometers going into the inputs and being read by a single analog pin.
when i remove the switching leads from the board and lock the chip in at input pin 0, that sensor has no noise at all and is very stable. however, when i read them quickly with the arduino, their values fluctuate slightly.
my program i wrote is only supposed to send values over serial if they change from the previous reading. due to these fluctuations though, it is constantly sending data. how do i fix this problem so that when the sensor isnt moved, it will actually show it?
The A/D Converter in the ATmega chip assumes that the input changes fairly slowly. It takes some time for the sense capacitor to settle down after the input changes. If you use the INTERNAL 6-way multiplexer the processor adds a delay when you change channels. If you use an external multiplexer the processor doesn't know you just switched inputs.
After you set the multiplexer address, add a small delay before reading the analog input pin. The internal delay is something close to 250 microseconds (1/4 millisecond) so that would be a good starting point. You can then adjust that delay up if the inputs are still unstable or down if they are stable.