voltage divider question

Hi,

I have these old motion sensors that i've hooked up to analog pins on a duemilanova. They have three wires, GND, V, and output. The only info I have on the sensors is that they take 10-30V and output max 200mA. I'm giving them a regulated 12V. On the out wire, when I put it on a multimeter and activate the sensor, I get around 14V that's going into the analog pin and it gives me a reading of 1023 in the serial monitor. So, I assume this is way too much and I'd like to lower and regulate the voltage.
I can think of two ways to do this...I could use a 7805 or I could get a couple resistors and make a voltage divider (a little cheaper and easier). I tried making a voltage divider but I was only getting a .5v reading...which is weird. I used a 1kOhm resistor with a 500ohm resistor. I connected the out wire on the sensor to the 1k resistor, another wire going from 1k resistor to arduino and also going to a 500ohm resistor that's going to ground. Is this not the correct way to do this? I was just following what I could find on the internet like the wikipedia page: Voltage divider - Wikipedia According to the voltage divider formula I should get getting around 4.6V...so I know I'm doing something wrong. Would a 7805 just be better and more reliable anyway?

Any advice/guidance? Thanks!

A voltage divider is the correct method, a voltage regulator is not. You may have already damaged the analog input pin by apply a voltage higher the +5vdc to it with your first direct wiring method.

Lefty

A 7805 would always regulate the input to 5V, so you wouldn't see any variation in the signal -- which I assume is what you want, when reading it with an analog pin?
Or, if it's a digital connection, the 7805 is still not right, because it responds too slowly to power on/off. Instead, you want a "level converter" chip. Or, as you say, just a resistor divider. Using one 1 kOhm and one 500 Ohm, and tieing the Arduino input around the 500 Ohm, is the right approach. Just make sure to test with more than one pin if you already blew the first pin :slight_smile:

The resistor divider is a bit on the low-impedance side - values of 10k and 22k would be more frugal in terms of current drain. They shouldn't be too high though (10k is about right).

14V @200mA will have definitely toasted the chip, if those figures are correct - I wouldn't rely on it now as part of it probably melted/vaporised and splattered metallization about.

Are you certain it says the output is 200ma and not 20.0ma

It may actually be a 4-20ma transducer. However these are normally 2-wire devices rather than 3-wire as you have.

If it is a 4-20 transducer its circuitry will endeavour to "force" an output current to match the input variable. That being the case then all you need is a burden resistor connected between output and ground to develop 5 volts when passing 20ma ie 250 ohms This will then produce 1-5 volts for a 4-20ma output

Whatever it is, before you connect it to your arduino, you need to perform a series of tests to determine how it performs under various input conditions and output load burdens. I know you've already connected it, but before you potentially do more damage, you need good data to work from.

as a newbie, I have to ask if it would not make more sense to use an optocoupler for this application ?

From what I understand, the requirement is to detect if the motion sensor is either on or off - the voltage is not a requirement. An optocoupler would protect the Arduino from any voltage / spike / etc.

I made a board with 20 optocouplers for all inputs to my Arduino and 20 transistors for all the outputs. My thinking was to protect the Arduino as much as possible.

Attached is a drawing of the optocoupler circuit I used.

Again, I am a newbie, so I may very well be totally off track here.

DRAWING10.jpg

Last I used optocouplers, they were not linear, analog devices, but rather just digital, on/off things. If you can find a linear one, it should work. Else if you want a buffer, try an opamp.

The OP mentioned "old motion sensors". To the best of my knowledge, these do not output an analog signal, but have an internal NO or NC relay ( or both ). Therefore I don't see the point to anything linear w.r.t. this problem.

Personally, I would connect the relay from the sensor to the optocoupler, and have the optocoupler connected to the input pin, thereby being able to control the exact feedback to the input pin. Preferably a digital pin, but if that's not available, surely an analog pin could be used, with the on / off states of the optocoupler producing enough of a difference on the analog pin to be able to reliably code for the events.