[Solved] Phantom reads into a 4051

I've got 16 buttons into 2 4051s with separate analog inputs (A0, A1). I'm getting phantom presses, and I can't figure out why.

What should I be checking?

Thanks in advance.

Can you draw a schematic by hand and post a photo ?

I'm willing to bet you don't have any pulling resistors (pull up or pull down) in which case the pin is considered floating. But as Raschemmel suggested, you should post a schematic or photo.

as Raschemmel suggested, you should post a schematic or photo.

but then he always says that anyway… XD

as Raschemmel suggested, you should post a schematic or photo.

but then he always says that anyway.... smiley-lol

Don't we all. Tom..... :)

A bit off topic, but I'm curious why you'd use analogue inputs and MUX's to read buttons.

Wouldn't 2 x 8 bit shift registers do the job, i.e and read the data in via SPI. Seems far simpler and probably cheaper, than doing all the MUX stuff and using analogue inputs for effectively digital controls.

Thank you for the responses. I actually disassembled, and reassembled it, and discovered that I had shorted the input which was repeating itself.

@rogerClark - This was my first project, and I’ve built my kids a digital piano. I don’t know what the configuration you’re suggesting is, but I will look it up for the next time. Thanks for the path :slight_smile:

Wouldn't 2 x 8 bit shift registers do the job, i.e and read the data in via SPI. Seems far simpler and probably cheaper, than doing all the MUX stuff and using analogue inputs for effectively digital controls.

I believe this comment was a reference to the TI 74HC595 shift register which can be used with SPI to shift bits serially to the 8 outputs. The idea being if you know what bits you want high and low of the eight you can write the binary equvilent as a hex byte via SPI and shift it through by clocking it eight times and the desired pattern winds up on the output. Apparently this chip can also be used for input button switches but I have been unsuccessful finding a schematic for this online. I found video but it didn't have a schematic.There's a tutorial for the led output here: http://www.arduino.cc/en/Reference/ShiftOut

See

To prevent strange behavior with a 4051 chip, I had to ensure the three chip control pins were not floating. I put a high value resistor from the control pins to ground and then the chip was stable.