Go Down

Topic: toggle between 2 sensors i want to read from (Read 1 time) previous topic - next topic

yan_g

Feb 10, 2012, 12:51 am Last Edit: Feb 10, 2012, 12:52 am by yan_g Reason: 1
Hello,

Let's say I want to connect a potentiometer and a LDR to 1 analog pin, and choose which of them I want to read with a toggle switch. Is this the way it should be done?

Thanks!

Edit: the pot is supposed to be a 10k of course, not 100k.

MarkT

Yes, that should work - have you run out of analog inputs then?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

yan_g

Thanks. I want to build a MIDI controller and connect lots of inputs and switch between them in a live situation...

MarkT

One option for that is an anlog multiplexer chip - a 16 to 1 analog multiplexor takes 1 analog pin and 4 digital pins to provide access to 16 signals...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

yan_g

Interesting. I might need these digital pins for something else but I'll keep that in mind. :)

robtillaart

Instead of 5V you could connect the LDR and the potmeter to a digital pin. If the pin is set HIGH the appropiate device gets 5V. With an inverter you need only 1 pin.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

yan_g


Instead of 5V you could connect the LDR and the potmeter to a digital pin. If the pin is set HIGH the appropiate device gets 5V. With an inverter you need only 1 pin.

What's the problem with using the 5V?

keeper63



Instead of 5V you could connect the LDR and the potmeter to a digital pin. If the pin is set HIGH the appropiate device gets 5V. With an inverter you need only 1 pin.

What's the problem with using the 5V?


I think what he's trying to say is rather than using a switch to flip between the two sources, you power one or the other using a digital pin (each resistance would have its own digital pin). Alternatively, you could use a single digital pin hooked to one of the sensors, and use an inverter IC to connect to the other from the same pin - so when you brought the pin HIGH, only one of the devices would be selected, bring it LOW, and the other would be selected).
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

yan_g

That's what I understood, but as a noob I can deal with switches more easily than with ICs :)
It's nice to know though, makes me think of new ideas, thanks. For instance, I could use a tact switch to toggle between the two, and power an LED in front of the LDR in the same time.

Go Up