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!

Rather than turning your
Rather than turning your sensors on and off, it’s worth considering simply multiplexing the sensor outputs. Have a look at some analog switches and see what you think, they’re pretty handy for managing analog signals.

I’m not sure what

I’m not sure what multiplexing the sensor outputs means, but it seems pretty close to the relay solution (but directly on the analogue input, not on the V+). Am i right? But maybe relays can’t manage analogue signal, and the analogue switches can.

Thanks for the info, i’m gonna have a look at those swhitches… and try to understand what they are!




([Edit] Ok thanks to Wikipedia, i know a bit more now, and i’m glad to see i wasn’t wong : “The analogue switch is an electronic component that behaves in a similar way to a relay, but has no moving parts.” And it looks like they use transistors, so they’re kind of a mix between my two ideas!)

Hehe, sorry I was so vague,

Hehe, sorry I was so vague, I was a bit distracted. As you put it, analog switches are something of a mix between a relay and a transistor. Since they’re designed to perform the exact task you’ve described, their performance will be better than a plain relay or transistor option.

Multiplexing is just a fancy way of saying “multiple signals that take turns”. Kinda like traffic lights, they allow several channels to use the same connection.

No it’s not your fault,

No it’s not your fault, sometimes (especially with technic stuff) my english is not that good!

Ok things are clearer now, analogue switches indeed seems to be exactly what i’m looking for… just a last question, in the link you gave me it looks like there only are SPST, do SPDT exist?if not that means i’ll need two right?


([EditAgain] Ok sorry, there are actually something like 4000 different references so i managed to find SPDT… now i just have to find how they called in french so i can find them here… Thanks again!!!)–semiconductors+and+actives–logic%2C+standard/search?c=4273 is the section for switches on Octopart, but I’m sure there are others out there. Probably worth looking around to see what you can find from your favourite suppliers.

Edit: maybe you could do a search for one of the ICs on a French part site, then you could look at how the item was described =D

"Edit: maybe you could do a

"Edit: maybe you could do a search for one of the ICs on a French part site, then you could look at how the item was described =D"

Well, that’s clever! :smiley:

And now i know i’m looking for a “multiplexeur analogique”!

Sounds fancier in French
Sounds fancier in French doesn’t it?

Analog Switching

So Analog? the SRF05 is a digital device and not Analog, its signal is a digital pulse whose width is proportional to the distance to the echo, and most 2-axis accelerometer, (well the ones I have) have a serial output; which one are you using.

Switching the SRF05 would just require something like 2 AND Gates feeding an OR (74LS153).

But you are going to burn a pin to control the Mux.

If you really need analog SPDT switches Maxim makes a series for both analog and video signal for 4571 for example another is the Analog Devices ADG409BN (4 to 1).

Actually, sounds as obscure
Actually, sounds as obscure as in english! ^_^v

"So Analog? the SRF05 is a

"So Analog? the SRF05 is a digital device and not Analog, its signal is a digital pulse whose width is proportional to the distance to the echo"

Well… that changes everything! I don’t know why, i was sure that it was analogue… maybe because the result is not 0/1… but it’s true that we don’t use a readadc but a pulsin… At least i know more now, thanks for the clarification!

So Digital

Hello TotoroYamada,

Forgot to mention, probably obvious anyway, If you mux the PIN’s you will need a little code for the Accelerometers, after the switch you need to wait for the start of frame

The SRF05 can be controlled with one or two pins, it is covered in the datasheet.

why not just use a
why not just use a multichannel adc? adc0834?