Switch inputs

Apr 09, 2007 9 Replies

Hi,



Since most picaxe´s have a very limited amount of analoge inputs, I was wondering if its possible to make a switch using some of the digital outputs.



For exsample. using 4 outputs to control which sensor is being read.



I tried a simple expiriment with a transistor and a LM35 sensor, but when I apply power my meter reads 3.6V from a 9V source on the LM35 output pin (which should be 0.26V).



I have made a rough schmatic here

formatting link
VDC+ is top, ignore the small + signs eagle has placed.



As stated readout is 3.6V and should be less than 1V (10mV per degree C)



/Jan


The transistor is being driven like an emitter follower and your LM35 readout is dropping whatever voltage is left after the resistor and the base-to-emitter junction take their share of the 9V. If you want to switch sensors like that you\'ll need to use a proper analog switch, or reed relays.

John Fields skrev:

Thanks,

Do you have some model numbers to search for. Maybe another controller for 3 more outputs is better/cheaper, its only about 4$/pcs.

/Jan

yep - this entirely possible.

You need an analogue multiplexor (google this). Basically this is a multi-way switch - I have on my desk a tube of twenty-five 74HC4051 eight-way multiplexors as it happens.

These have eight inputs and a single output (not strictly as they are analogue and an input can be an output etc, but lets' think of it like this for now) you select which input is connected to the output with a

3 bit binary address - this could be provided using 3 outputs from your pic, so now with just four pins on the PIC, you have 8 analogue in/out pins, and this is just to wet your appetite.

there are loads of other chips that will do this and you could even build your own out of analogue switches like 4016 or 4066.

remember that these three chips I have mentioned are fairly "rough 'n' ready" (but then so is the PIC analogue input) so they probably won't be any good for *really* precision audio/video or signal processing but such chips do exist - with an appropriate price-tag :o)

First things first... What are you using as a readout and what kind of accuracy are you looking for?

John Fields skrev:

The sensors are primary LM35 and LM34. I am using picaxe 18X to read them (has 3 adc inputs, would like 6 or 8)

0.5C would be nice but 1C will work too.

/Jan

feebo skrev:

Thanks, I have ordered a few of these to play with.

/jan

Beware letting the input go below Vss...you'll let the magic smoke out.

If the chip runs on a bipolar supply such as Vss=-5V and Vdd=+5V, you'll be fine. If Vss=0V and Vdd=+5, beware of the input swinging negative by more than about .6V (one diode drop).

yup, there's chips for this eg 4051 (3 pins to select from 8 inputs)

Bye. Jasen

Lord Garth skrev:

The control pins (ABC) will be handled by the picaxe digital out, so a logic 5V og 0V.

The in/output goes to picaxe adc in.

The 8outputs goes to the output pin of LM35 (0.02V - 1.50V)

The power source is battery, 4.5V, maybe I can find a 5.0V pack instead.

/Jan

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required