2

I am brand new to the Raspberry Pi (PM now born-again developer, Pi still in the box etc) and this is my very first ever post so please don't slam me if I use the wrong protocol to ask this question.

I would like to take a feed from a car turn signal; assuming the Raspberry Pi is powered from the car and has the same ground, what circuitry do I need to use to take the turn signal (which I imagine will be a very messy 12v on/off) and convert it into something safe and readable as on/off value by the GPIO?

3

A simple voltage divider would do just fine here. Lets assume that the turn signal is exactly 12 volts. (usually my car runs at 13 or 14).

Looking at the resistor divider on wikipedia: http://en.wikipedia.org/wiki/Voltage_divider#Resistive_divider You would want R1 of 4000 and R2 of 1500. Connect the car level voltage to vin, and an raspberry pi GPIO to vout.

I calculated these values using this tool (there are many more): http://www.raltron.com/cust/tools/voltage_divider.asp

I picked a relatively big starting value for R1, picked 3.3 for vout, and then it calculated R2 for me.

If you would additional protection (lets say the car goes to 15 volts). you can put a zener diode in the circuit. The zener will be function as a "voltage regulator" as seen here on wikipedia: http://en.wikipedia.org/wiki/Zener_diode#Voltage_regulator

Connect the zener in parallel with R2 with the arrow pointing away from ground (aka anode is ground and cathode is connected to vout).

See this post: http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=30732 for partnumbers on the zeners.

Finally if you want to write your app in python (I would suggest this) Here is a breadboard example which will get you up and running with regards to reading the voltage: https://learn.sparkfun.com/tutorials/raspberry-gpio

| improve this answer | |
  • Wow - thanks to all of you for taking the time to respond to my post - it is all really useful and has helped me on my way! – Mal Snaize Mar 28 '15 at 20:03
  • Opto-isolator chips also provide protection from messy/spiky inputs. You could insert one after the voltage divider, before the IO pin. – cortices Apr 2 '15 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.