Arduino Forum

Using Arduino => General Electronics => Topic started by: Joy on Oct 16, 2014, 07:41 pm

Title: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 16, 2014, 07:41 pm
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..:(
Title: Re: Cheap and good way to feed 12v digital input
Post by: wildbill on Oct 16, 2014, 07:55 pm
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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: PaulRB on Oct 16, 2014, 08:13 pm
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
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 16, 2014, 08:20 pm

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..:(
Title: Re: Cheap and good way to feed 12v digital input
Post by: DVDdoug on Oct 16, 2014, 08:57 pm
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 (http://electronics.stackexchange.com/questions/35807/how-would-i-design-a-protection-clipper-circuit-for-adc-input) (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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 16, 2014, 09:13 pm
I finally decided to use the 7805 SOT89 package, as I am working on SMD board and the space is a real issue.
Title: Re: Cheap and good way to feed 12v digital input
Post by: Xpendable on Oct 16, 2014, 09:46 pm
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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: tylernt on Oct 17, 2014, 02:22 am
Any SOT23 MOSFET could also have been used.
Title: Re: Cheap and good way to feed 12v digital input
Post by: CrossRoads on Oct 17, 2014, 06:20 am
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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: JimboZA on Oct 17, 2014, 06:40 am

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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: cjdelphi on Oct 17, 2014, 06:56 am
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.

Title: Re: Cheap and good way to feed 12v digital input
Post by: cjdelphi on Oct 17, 2014, 07:06 am
How's this?


Title: Re: Cheap and good way to feed 12v digital input
Post by: Grumpy_Mike on Oct 17, 2014, 07:37 am

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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: dlloyd on Oct 17, 2014, 08:09 am
As per CrossRoad's suggestion (several variations):



Voltage swing at Arduino input: 0 to 4.9V (see Fig. 6 here (https://www.fairchildsemi.com/datasheets/4N/4N25M.pdf)).
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 18, 2014, 09:21 am

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.
Title: Re: Cheap and good way to feed 12v digital input
Post by: Grumpy_Mike on Oct 18, 2014, 09:54 am
Quote
Actually I am not using it to trigger any arduino pin..

So what are you using it for?
Title: Re: Cheap and good way to feed 12v digital input
Post by: dlloyd on Oct 18, 2014, 04:39 pm
Cheap, good and small:
SOT-89 (7805): 1.6mm x 4.6mm, area 7.36mm2,
SOT-416 (DTC114W (http://rohmfs.rohm.com/en/products/databook/datasheet/discrete/transistor/digital/dtc114w.pdf)): 1.7mm x 0.9mm, area 1.53mm2, $0.20 each
I/O Connections: VIN 0-30V, OUT (inverted) connected to PIC input with Pull-up enabled.
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 18, 2014, 04:41 pm

Quote
Actually I am not using it to trigger any arduino pin..

So what are you using it for?


I have mentioned it on my previous post. I am actually using it to trigger a SMD 8 Pin PIC Microcontoller..

The main target is to make the PCB as tiny as possible and making it cheap retaining the quality, as it will be mass produced..
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 18, 2014, 04:46 pm

Cheap, good and small:
SOT-89 (7805): 1.6mm x 4.6mm, area 7.36mm2,
SOT-416 (DTC114W (http://rohmfs.rohm.com/en/products/databook/datasheet/discrete/transistor/digital/dtc114w.pdf)): 1.7mm x 0.9mm, area 1.53mm2, $0.20 each
I/O Connections: VIN 0-30V, OUT (inverted) connected to PIC input with Pull-up enabled.


I am unable to make out how will it work..
I went through the datasheet too, bu cant make out..It would be kind of you, if you can elaborate please..
Title: Re: Cheap and good way to feed 12v digital input
Post by: dlloyd on Oct 18, 2014, 04:54 pm
Hint:
The 7805 has 3 terminals (INPUT, OUTPUT, GND).
The DTC114W has 3 terminals (IN, OUT, GND).
Title: Re: Cheap and good way to feed 12v digital input
Post by: Grumpy_Mike on Oct 18, 2014, 06:08 pm
Quote
I am actually using it to trigger a SMD 8 Pin PIC Microcontoller..

What does that mean?
By trigger do you mean turn on, like applying power controlled by something else?

That sounds like an even worse idea.
Title: Re: Cheap and good way to feed 12v digital input
Post by: rmetzner49 on Oct 19, 2014, 01:51 am
It's actually quite novel.  He connects the GND to ground, obviously, the OUT to the input pin on his Arduino, and the IN of the regulator to his switch or whatever his 12V signal is.  The 7805's output will be 5V with anything from about 7V to 30V on its input.

Not how the manufacturer envisioned its use, but should work just fine.
Title: Re: Cheap and good way to feed 12v digital input
Post by: dlloyd on Oct 19, 2014, 02:12 am
Quote
Not how the manufacturer envisioned its use, but should work just fine.


Hmm...no capacitors.

Here's (http://www.societyofrobots.com/robotforum/index.php?topic=9865.0) what the Society of Robots has to say about that.
Title: Re: Cheap and good way to feed 12v digital input
Post by: JimboZA on Oct 19, 2014, 05:22 am

Here's (http://www.societyofrobots.com/robotforum/index.php?topic=9865.0) what the Society of Robots has to say about that.


Bit misleading: It's no more the Society of Robots saying anything than Messrs Arduino saying anything in this public forum, is it? (However correct the individual member's views may be....)

That said, not one of the many schematics in the 7805 datasheet lacks caps.
Title: Re: Cheap and good way to feed 12v digital input
Post by: cjdelphi on Oct 19, 2014, 05:25 am
The caps would be very bad for serial communication... the 7805 will work up to a certain frequency but then it simply can't switch between 0 and 5v fast enough killing the serial data...

Change the 2 zener resistors for 10k to keep the current down.

Title: Re: Cheap and good way to feed 12v digital input
Post by: CrossRoads on Oct 19, 2014, 07:03 am
So what's the argument against using simple resistor divider with a zener just in case the input exceeds 16V?
Title: Re: Cheap and good way to feed 12v digital input
Post by: dlloyd on Oct 19, 2014, 08:17 am
Quote
I am unable to make out how will it work..
I went through the datasheet too, bu cant make out..It would be kind of you, if you can elaborate please..


Just 2 parts, smaller footprint, low cost 5.5¢ per PCB (qty 1000)
High performance: 0-30V Input, Max 250MHz transistor (http://rohmfs.rohm.com/en/products/databook/datasheet/discrete/transistor/digital/dtc114w.pdf) frequency, Inverted 0-5V output

DTC114W Digi-Key (http://www.digikey.ca/product-detail/en/DTC114WKAT146/DTC114WKAT146DKR-ND/1159190) $0.04844 each (qty 1000)
ERJ-2RKF2201X Digi-Key (http://www.digikey.ca/product-detail/en/ERJ-2RKF2201X/P2.20KLCT-ND/1746652) $0.00699 each (qty 1000)

Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 19, 2014, 08:38 am

Quote
I am actually using it to trigger a SMD 8 Pin PIC Microcontoller..

What does that mean?
By trigger do you mean turn on, like applying power controlled by something else?

That sounds like an even worse idea.


I actually meant that I am giving just and ON / OFF signal to the digital input of a PIC and the controls a condition..
I ON / OFF switching is not at all fast..
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 19, 2014, 08:40 am

So what's the argument against using simple resistor divider with a zener just in case the input exceeds 16V?


There is no argument at all..

The issue is the space in the PCB. I have to fit components in a very tiny place, so lesser components, easier for me..
Title: Re: Cheap and good way to feed 12v digital input
Post by: CrossRoads on Oct 19, 2014, 09:05 am
Two 0402 resistors and an 0603 zener, that's pretty small.
What quantities are you making these in?
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 19, 2014, 09:09 am

Two 0402 resistors and an 0603 zener, that's pretty small.
What quantities are you making these in?


yes I know, that these 3 components are really small.. But 3 different footprints will require lil more space.. And the 7805 SOT-89 package is taking lesser space..

Making them in 1000+ quantities.. on homemade PCBs. So will not be able to make very thin tracks... If I could then would have been able to fit the two 0402 resistor and a 0603 zenner in a very tiny space..
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 19, 2014, 09:13 am

Quote
I am unable to make out how will it work..
I went through the datasheet too, bu cant make out..It would be kind of you, if you can elaborate please..


Just 2 parts, smaller footprint, low cost 5.5¢ per PCB (qty 1000)
High performance: 0-30V Input, Max 250MHz transistor (http://rohmfs.rohm.com/en/products/databook/datasheet/discrete/transistor/digital/dtc114w.pdf) frequency, Inverted 0-5V output

DTC114W Digi-Key (http://www.digikey.ca/product-detail/en/DTC114WKAT146/DTC114WKAT146DKR-ND/1159190) $0.04844 each (qty 1000)
ERJ-2RKF2201X Digi-Key (http://www.digikey.ca/product-detail/en/ERJ-2RKF2201X/P2.20KLCT-ND/1746652) $0.00699 each (qty 1000)




Will this work too..??
http://in.element14.com/on-semiconductor/mmun2215lt1g/transistor-digital-sot-23/dp/9556680?whydiditmatch=rel_3&matchedProduct=dtc114&matchedProduct=dtc114&whydiditmatch=rel_3
Title: Re: Cheap and good way to feed 12v digital input
Post by: CrossRoads on Oct 19, 2014, 09:15 am
1000+ & homemade PCBs? You are a glutton for punishment!
Title: Re: Cheap and good way to feed 12v digital input
Post by: CrossRoads on Oct 19, 2014, 09:18 am
mmun2215 - I don't see why not.
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 19, 2014, 10:37 am

1000+ & homemade PCBs? You are a glutton for punishment!

hahaha..

please don't get me wrong..

The reason I use the homemade PCB is that there is no good estimation that how many will sell off..
Hence the keep making these 50 - 70 at a time..
It just takes half an hour to make the PCB...

And profit margins form the product is very very low..
Title: Re: Cheap and good way to feed 12v digital input
Post by: Joy on Oct 19, 2014, 10:38 am

mmun2215 - I don't see why not.


I did not get this Sir..:O
Title: Re: Cheap and good way to feed 12v digital input
Post by: cjdelphi on Oct 19, 2014, 11:15 am



What's with the second resistor on the npn's base? (pull down? It's not a fet, it's not biasing?)
Title: Re: Cheap and good way to feed 12v digital input
Post by: cjdelphi on Oct 19, 2014, 11:16 am
Ahh my bad... resistor divider!
Title: Re: Cheap and good way to feed 12v digital input
Post by: dlloyd on Oct 19, 2014, 03:36 pm
Quote
Will this work too..??
http://in.element14.com/on-semiconductor/mmun2215lt1g/transistor-digital-sot-23/dp/9556680?whydiditmatch=rel_3&matchedProduct=dtc114&matchedProduct=dtc114&whydiditmatch=rel_3


Yes, this type will also work.

Note that the transistor begins to turn at about VBE = 0.5V.
The MUN2215 (http://www.onsemi.com/pub_link/Collateral/DTC114T-D.PDF) will turn on when the input is at 0.5V.
The DTC114W (http://rohmfs.rohm.com/en/products/databook/datasheet/discrete/transistor/digital/dtc114w.pdf) will turn on when the input is at 1.5V, providing higher noise immunity.