Reading back value from Hall Effect Sensor at higher voltage than Arduino

So I have a hall effect sensor that is used to calculate the RPM of a spinning object along with an Arduino. Right now it is wired to be powered by the 5v regulated power from the Arduino (not really -- it's a separate v-reg, but lets pretend) and sends it's result to a digital pin.

This all works great but what I would really like to do is have the sensor run off of the 12v power supply of the motor that spins the object. Bottom line I want to: * reduce the number of exposed wires since it's a bit of distance to the Arduino * save sleep mode power because power to the motor (and sensor) would be cut-off via a mosfet/transistor. i.e. when the motor is off, so is the sensor.

So I'm wondering if anyone could recommend a way to limit the power supply going back to the Arduino so I don't fry the pin (which is expecting max 5v not 12v). My initial thought is to set up some kind of voltage divider but in all honesty I'm not sure exactly how I would rig the resistors to do this. One before and after the sensor? One before the pin and one after the 12v ve+?

Thanks for any advice!

A voltage divider is the solution

HALL (12V) —[ 15 K ] ----*----[10K] — GND

will give you 0…4.8 V on * which is connected to Arduino analog in. If you expect higher spikes better use

HALL (12V) —[ 30 K ] ----*----[10K] — GND

which will give 0…3V (so the HALL can peak up to 20V ==> 5V for the Arduino)

hint: - http://www.raltron.com/cust/tools/voltage_divider.asp -

Thanks Rob. I've actually used that calculator before for the same thing but what I'm curious is where I hook up the resistors.

For instance, the resistor before the pin makes sense, but where is the one that comes before ground and after the pin? Would I have to place the resistor before the ground lead on the sensor (it has leads for positive, negative and output connected with a required pullup resistor).

OK, was having a 'duh, stupid' moment. I successfully set up the voltage divider by doing:

+ve----->+ve lead

-ve------>-ve lead

out lead------->resistor a------->divided voltage------->resistor b-------->-ve | | |---------------Arduino Pin