Pages: [1]   Go Down
Author Topic: Am I doing this right? 12v -> 5v with pulldown?  (Read 1688 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?


* pulldown.jpg (139.08 KB, 700x395 - viewed 77 times.)
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 06, 2011, 03:00:32 pm by madworm » Logged

• 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!

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6146
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Since "nothing" is undefined, this seems like a bad method to achieve what could be done with a simple voltage divider.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ 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...    smiley-eek

NOT recommended...

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



Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 619
Posts: 33974
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 619
Posts: 33974
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
       And use a digitalRead ( optocouplerpin );  to read the info.

That is the simple idea I can think off. 

Logged

Pages: [1]   Go Up
Jump to: