leejohnson
Posts: 43
Joined: Sun Sep 28, 2014 7:01 pm

gpio input

Sun Nov 09, 2014 8:16 pm

hello i have a 12v dc in a car to trigger a gpio whenever your open the door for example

i would of thought i would of had to drop the 12v to alot smaller

would 3.3v be low enough for example this

http://www.ebay.co.uk/itm/12V-To-3-3V-3 ... 3f3f14aebf

or could you suggest something for the UK that would do the trick.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13092
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: gpio input

Sun Nov 09, 2014 8:23 pm

what do you mean? you want to power the PI, from a 12V car battery? easy, jut buy a "cigar plug USB power adapter" for about $2,-

Or you want to create an interface so you can sense the presence/absence of a 12V signal?
simply use a resistor divider to divide the 12V DC signal to something between 2.5 and 3.3V.

use this to calculate the values:
http://www.calculatoredge.com/electroni ... divide.htm

use something sensible for the input resistance, like 10K

leejohnson
Posts: 43
Joined: Sun Sep 28, 2014 7:01 pm

Re: gpio input

Sun Nov 09, 2014 8:27 pm

no its not to power the pi.

the 12v will go through a convertor down to 5v or 3.3v or less in order to be used as a trigger

will this work?

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: gpio input

Sun Nov 09, 2014 8:28 pm

leejohnson wrote:no its not to power the pi.

the 12v will go through a convertor down to 5v or 3.3v or less in order to be used as a trigger

will this work?
Provided you use a voltage divider (pair of resistors) as suggested, Yes.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13092
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: gpio input

Sun Nov 09, 2014 8:30 pm

yes, it will, but its an insane waste, as a 25 cent simple resistor divider will suffice, no need to use such a 3V3 power supply.

User avatar
davidcoton
Posts: 5026
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: gpio input

Sun Nov 09, 2014 8:34 pm

The unit you link to is a switching power supply -- not what you need to drop the input voltage on a GPIO pin. In theory you could use two resistors wired as a voltage divider. Remembering that car voltages (nominally 12V) will be 13.6V when the car is running, possibly 14.4V at times, it is safer to use a series resistor (say 10K) and a 3.3V zener diode as a voltage limiter between input and ground. If you don't get this explanation, please ask again. Your RPi is at risk if you get it wrong.

Make sure you also have a suitable supply to power the RPI, and that the supply negative is referenced to ground if you are using inputs from the car wiring. Check before wiring anything to the GPIO that the voltage you get is correct in a variety of conditions (engine off, engine on, door open/closed, etc.). Again, your RPi is at risk if you get it wrong.
Signature retired

Return to “General discussion”