Address line selection failing - multiplexer only returning input 1 (HI-506A-5)

hi,

I want to read 3x13 status leds by sticking fotocells on them (long story). My assumtion is analog multiplexer and I got myself 3x a HI3-506A-5 to connect to an Arduino Mega.

Digital out pin 30-33 control the address lines (orange in the diagram) - rather than doing this 3x and use 12 outputs I thought of putting this in parallel. However not being too ambitious I'm trying 1 first.

The output of the multiplexer goes in analog in 7 (white line). The input (blue wire) goes in the different inputs of the chip and comes from the photocells (only 4 shown for readability). I thought one resistor is enough as the chip exposes only one photocell at a time so I put one on the output of the chip no need to put a resistor between each photocell and the chip.

+5v powers the photocells and the chip (+5v and an enable pin) all shown with a red line and black for GND.

I put a LCD/keypad shield on so I can scroll through the inputs I want to read but it looks like I only get values for input 1.

My code looks ok - if I don't have anything attached to the mega and I measure the voltages on the out pins then I have the right combinations to select the right input. When I connect everything together the voltage on the output drops and I get only a reading for input 1 (it thinks all address pins are low). If I add a resistor on the outputs I have 5 volts but the multiplexer still doesn't seem to notice.

When I look at other multiplex projects I see the digital out going straight in the adress pins so I'm puzzled - questions:

  • did I get the right multiplexer chip?
  • what do I need for additional resistors? Is there a difference if I use one or 3 chips
  • can the arduino power all this?

If you've read this far I owe you a thank you!

Jhh

Capture.PNG

datasheet.pdf (857 KB)

If you connect your LDR to +5 you need a pull-down resistor on your input pin. You have a resistor but it is in the wrong place. You have it between the multiplexer output and the input pin. You want the multiplexer output connected DIRECTLY to the input pin AND you want a resistor between the input pin an Ground.

hi,

My mistake - my breadboard is full of wires so I missed that one in the drawing - I have the resistor as you describe so my drawing is wrong. I copied the setup from an analog input tutorial and it works: values change when I cover the LDR or not.

My issue is that my digital out is not switching the inputs. When nothing is connected to the board I get my 0v or 5v on the digital out pins where needed. When I hook up the sensors and multiplexer to the board voltage is dropping and the chip does not switch. No matter what I do it keeps reading input 1 which is all address pins low and the Enable pin on high (but that one is hardwired).

Jhh

Did you remember to set your address line outputs as outputs?

I also wonder if the -Vsupply pin should be grounded. Your diagram shows no connection.

hi,

Couldn't change the subject line to add solved...

Indeed I needed to ground the V- and I tried that but still no luck. Then I decided to rewire the thing step by step on another breadboard using only 3 LDRs and that worked. I verified if the new version was wired similarly to the troubled one and it was. So I suspect a (cheapo chinese) faulty breadboard. Then I added the array of 13 LDRs and it still works on the new one so this one is solved.

Thanks!
Jhh