Go Down

Topic: Cheap and good way to feed 12v digital input (Read 11949 times) previous topic - next topic

Joy

I want to feed the digital pin from 12v.
What will be the cheap and best way to drop it to 5V

1. Voltage divider
2. Tiny 7805 regulator

Or is there any other way..??

I do not want to use a RELAY..:(

wildbill

Can't get much cheaper than a voltage divider; just make sure that your 12V input really is 12. In case it can be a little high, you may want to choose resistors to drop it a little lower than 5V - it'll still register as high.

PaulRB

For extra protection you could connect a 5.1V Zener diode between the Arduino input and ground (as well as using the voltage divider). This should help protect the Arduino from any excess voltages or spikes.

Paul

Joy


Can't get much cheaper than a voltage divider; just make sure that your 12V input really is 12. In case it can be a little high, you may want to choose resistors to drop it a little lower than 5V - it'll still register as high.


A good point..
The 12V is not constant all the time.. It sometimes rises to 16V too..

So I guess, there is a problem with the voltage divider..:(

DVDdoug

Quote
The 12V is not constant all the time.. It sometimes rises to 16V too..
Another option is a resistor and a pair of  protection diodes (the 2nd schematic on that page).    I'd use a larger resistor (at least 10K) and you can leave out D2 if you're sure the input will never go negative.

Or, you can also use a voltage divider with one or two "protection diodes".    (That's the same protection circuit with a 2nd resistor in parallel with D2.)

A voltage regulator is designed for power, not data.   It's not fast enough for normal digital data and it could potentially load-down a data line.    It's just the part for this application.

Joy

I finally decided to use the 7805 SOT89 package, as I am working on SMD board and the space is a real issue.

Xpendable

I don't think a voltage regulator is the right application, as DVDdoug already told you.  It's a shame that you didn't listen.  Voltage regulators are designed to POWER something.  They are never used to regulate the voltage on a data line.  Good luck making that work.

tylernt

Any SOT23 MOSFET could also have been used.

CrossRoads

Use the 12-16V to drive an optoisolator, on the output side pull the open collector low on an arduino input with pullup resistor enabled.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

JimboZA


Use the 12-16V to drive an optoisolator, on the output side pull the open collector low on an arduino input with pullup resistor enabled.


.... which will reverse the logic, but you can take care of that in code. If that's an issue, use an external pulldown to keep the logic the same way round.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

cjdelphi

A 4.5v ish zener diode and a zener should do the job...


Take a look at v-usb which uses a zener to knock the data lines down to 3v from 5v, the same can be applied here a couple (guessing 200 to 500) resistors.



Grumpy_Mike


I finally decided to use the 7805 SOT89 package, as I am working on SMD board and the space is a real issue.



Then you have made the wrong decision and made yourself look foolish.

dlloyd

As per CrossRoad's suggestion (several variations):



Voltage swing at Arduino input: 0 to 4.9V (see Fig. 6 here).

Joy


I don't think a voltage regulator is the right application, as DVDdoug already told you.  It's a shame that you didn't listen.  Voltage regulators are designed to POWER something.  They are never used to regulate the voltage on a data line.  Good luck making that work.



Actually I am not using it to trigger any arduino pin.. I am using a 8 PIN PIC with a very tiny PCB.. Space is a real issue. So if I am using a SOT-89 7805 I do not require any other component.

I definitely agree that using an Optoisolator is the best option, but it requires many other components too and will occupy lil larger space than what the SOT-89 7805 will occupy.

Go Up