Go Down

### Topic: Am I doing this right? 12v -> 5v with pulldown? (Read 3088 times)previous topic - next topic

#### ArthurJGuy

##### Aug 05, 2011, 11:28 pm
This is a very crude chart, but I am curious if I have the concept and the parts correct.   The install would be a little neater than this.

What I have is a signal that is either 12v or nothing.   I need to reduce it to 5v to read with the arduino and add a pulldown to keep the value from floating.

Is this correct?

#1
##### Aug 05, 2011, 11:49 pmLast Edit: Aug 06, 2011, 10:00 pm by madworm Reason: 1
I've never seen that one before (for the purpose of reducing a voltage going to an input pin). If the output doesn't oscillate it should might work (with internal pull-up resistors turned on). Maybe you'll need a capacitor on the 5V side as well (see datasheet).

Why not just use a potentiometer (or 2 resistors) as a voltage divider? If you need protection against accidentally feeding 12V into the pin as well, add a 5.1V zener diode + series resistor as well.

http://www.w9xt.com/page_microdesign_pt10_input_protection.html
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

#### James C4S

#2
##### Aug 06, 2011, 03:40 am
Since "nothing" is undefined, this seems like a bad method to achieve what could be done with a simple voltage divider.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

#### Techone

#3
##### Aug 06, 2011, 05:28 am
@ Arthur]Guy

My question to you is : Why are you using a 7805 ( a voltage regulator ) into a digital pin ? The moment in the code, you wrote digitalWrite ( from7805, LOW );   Well... the pin goes into "sink" mode and.... a short being created...

NOT recommended...

My other question is : What are you trying to do ?

#### deejayspinz

#4
##### Aug 06, 2011, 06:36 pm
Not sure a 7805 is the right approach.. You could use a voltage divider as others have suggested. Or...  I had a similar need in a project and decided to use an optocoupler (or optoisolator as it is also referred to).  The concept is that you can have one circuit (eg 12v) trigger a response on another (eg Arduino input pin @ 5V) and have both circuits isolated (or not) as there is no electronic link between the two.  For my purpose this was necessary. However, you dont have to isolate the circuits (eg power sources could share the same + and -).  I used  this http://www.dipmicro.com/store/4N35.  The concept is that 5-19V on one side triggers an LED in the optocoupler that in turn triggers a low signal on the Arduino.  On the Arduino side you wire 5V (from the Arduino) into the optocoupler and out to an input pin. Normally it would be HIGH.  When 12V is provided to the other side of the optocoupler, it will bring the Arduino pin LOW.   I have my circuit complete and will blog about in the next week or so.  Check the link above as it's datasheet has an example.  The circuit is very simple with just a few resistors and a diode.  When I first built it, I was confused as it was pulling the Arduino input LOW, but this is how it is designed.  Something that you can handle in the Sketch.

#### ManicDee

#5
##### Aug 07, 2011, 07:22 am
Would a FET with Gate connected to the input signal, Source/Drain being "high" and "input pin X" respectively (with appropriate pull-down resistor) do the same thing? Provides isolation between 12V channel and 5V logic, though the two systems will be linked via GND.

#### Grumpy_Mike

#6
##### Aug 07, 2011, 11:40 pm
Quote
Not sure a 7805 is the right approach

I am sure it is defiantly the wrong approach.

I have seen beginners try this before and it stems from a misunderstanding of what you are doing and what voltage regulators do.
Depending on where the 12V is coming from you could use a potential divider perhaps with a 5.1V zenner diode to clamp the signal in case the voltage was slightly over 12V.

#### ArthurJGuy

#7
##### Aug 09, 2011, 07:50 am
When using a voltage divider what is sent out when I remove the 12v source?  I want to make sure that this does not become a floating input when there is no input.

My understanding of the 7805 was that it regulated 12v down to 5v which was all I needed.   Apparently I was wrong.

#### ArthurJGuy

#8
##### Aug 09, 2011, 07:52 am
For the guys asking what I am trying to do, I have a switch in my car that is fed with a 12v source (feeding it with 5v is not an option) and when pressed it sends 12v out that i want to send into the arduino to trigger various actions.

#### Grumpy_Mike

#9
##### Aug 09, 2011, 10:21 am
Quote
I want to make sure that this does not become a floating input when there is no input.

When no voltage is applied the lower leg of the potential divider acts as a pull down resistor and you get a logic zero. As you are in a car the voltage is often going to be much higher than 12V so use a zenner, also add a capacitor from input to ground to remove interference spikes.

#### Techone

#10
##### Aug 09, 2011, 07:07 pm
@Arthur]Guy

Quote
For the guys asking what I am trying to do, I have a switch in my car that is fed with a 12v source (feeding it with 5v is not an option) and when pressed it sends 12v out that i want to send into the arduino to trigger various actions

Now I understand what you want do do.

1st. NO need for a 7805.
2nd. Use opto-coupler.    So when a 12 V ( let call it HIGH ) and 0 V ( Let call it LOW )  Got me so far ?
Look into the 4N35 datasheet.  http://search.datasheetcatalog.net/key/4N35
Use a 910 ohm limiting resistor for the LED inside the opto-coupler.
12 V  - --- 910 ohm -------   Opto LED ----- GND of the car.  Got me so far ?

3rd. A resistor of 10 K -- +5 --- 10 K --- opto-transistor   --- GND of the Arduino

That is the simple idea I can think off.

Go Up

Please enter a valid email to subscribe