Let's Make Robots!

How to use two analogue devices with only one analoque input?

For now it's theory, it's for a future evolution of a future project (yeah i know that's two "future")
Ok actually i'll need 3 analogue inputs (one SRF05 ultrasonic rangefinder and one 2-axis accelerometer), but the 18x picaxe chip has only two. So basically, i need to find a way to share one of the inputs. As i won't need to read the all inputs at the same time, maybe it's doable.

So two ideas came to my mind, each one with its pros and cons.

First idea : a SPDT relay.

With that, two solutions :

  • Connect it to the V+ of each sensor to switch them on and off (so when the srf05 is on, the accelerometer is off and vice versa).
  • Connect it to the analogue input so i can choose which device use the input.

The first of the two solutions has the advantage to use less power since only one device is on at a given moment.

Pros :

  • Use only one output af the chip to control the relay.

Cons :

  • A relay takes some space (compared to a small component).
  • They're a bit expensive (not that much i know but still)
  • Looks like most relays use 12v. The less i found was 5V (and it was pretty hard to find), but i feed my chip with 4.8V so i don't know if it'd work.

Second idea : transistors switches (as explained here)

Again two solutions :

  • Switch on/off the devices.
  • Decide which one use the input.

Pros :
    Transistors are cheap, i already have plenty of them.
    They're small.

Cons :
    Because they don't act like SPDT switches, i'll need two, so it'll use two outputs of the chip. (Which actually is not really a big deal).

Ok i hope you understood, they're just ideas, i'm not very good at electronic so maybe i'm completely wrong... that's why i submit that to you! Feel free to tell what you think about that, or if you have other ideas, or maybe if you already have solved that problem a long time ago!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
And now i know i'm looking for a "multiplexeur analogique"!
Sounds fancier in French doesn't it?
Actually, sounds as obscure as in english!  ^_^v