Pages: [1]   Go Down
Author Topic: 12 to 24V input  (Read 829 times)
0 Members and 1 Guest are viewing this topic.
NZ
Offline Offline
Jr. Member
**
Karma: 1
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to be able to apply both 12 and 24VDC to an input pin though a switch.
I'm switching to ground/0V.

Using a couple of resistor as a voltage divider, I have the following questions:

1. do I need a resistor between the Arduino pin and the voltage divider as well ?
2. what is the input pin impedance ?
3. and does pin impedance change if it is a selected as an input or output

Trying to keep the smoke in :-)

K
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to be able to apply both 12 and 24VDC to an input pin though a switch.
I'm switching to ground/0V.

Not sure I understand the 'switching' part statement, can you post a drawing?

Using a couple of resistor as a voltage divider, I have the following questions:

1. do I need a resistor between the Arduino pin and the voltage divider as well ?

No
2. what is the input pin impedance ?

An input pin is very high impedance, many megohms.
 
3. and does pin impedance change if it is a selected as an input or output

Oh yea. Once pin is programmed to be a output pin, it becomes a active current source or sink, rated at up to 40ma absolute maximum. Be sure you never make a pin an output by mistake. The AVR chip cannot prevent damage from brain farts. Upon power up or reset condition all I/O pins are set to input mode. They only switch to output mode as a result of program code.  smiley-wink

Trying to keep the smoke in :-)

And that is always a good rule to follow.  smiley-wink

K

« Last Edit: September 25, 2012, 04:42:55 pm by retrolefty » Logged

NZ
Offline Offline
Jr. Member
**
Karma: 1
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, I haven't posted a pic or file before, but here we go



* 12_to_24V_Input_schem.png (48.89 KB, 1000x781 - viewed 41 times.)
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Note sure that circuit will work or not. Also your voltage divider uses equal size resistors, so it cuts voltage in half, so 24vdc = 12vdc, which is still higher then the maximum allowed input voltage to a input pin, +5.5vdc?

I would change the lower resistor size and then first measure the voltage that the arduino pin will see in each switch state with a digital multimeter before wiring it to arduino pin. Again the arduino pin must 'see' less then 5.5vdc to be safe.


Lefty
« Last Edit: September 25, 2012, 05:32:51 pm by retrolefty » Logged

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10431
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to divide the voltage down to the 0..5V range, thats a factor of 5, not 2
Logged

[ I won't respond to messages, use the forum please ]

NZ
Offline Offline
Jr. Member
**
Karma: 1
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay

here are 2 schematics with one being from a control board we use at work (uses a Freescale chip, not AVR)
I have transfered it over for the Arduino board, but as said it has to be a factor of 5.

So, how come this other one works when there are essentially two 330K resistor in series between VDD and GND, which should give 6 to 12V on the chip pin when the switch is O/C ?

The "IN 0-7" connector goes straight to the chip pin
CN8 connect to the outside world. Input is ON the switched to GND
VDD is 12-24VDC


K


* 12_to_24V_Input_schem.png (52.75 KB, 987x891 - viewed 30 times.)

* Screenshot from 2012-09-26 21:37:22.png (101.49 KB, 1464x758 - viewed 27 times.)
« Last Edit: September 26, 2012, 05:11:27 am by fiddler » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So, how come this other one works when there are essentially two 330K resistor in series between VDD and GND, which should give 6 to 12V on the chip pin when the switch is O/C ?

Possibly the are relying on the fact that very little current can flow through a 330k resistor even though the applied voltage is too high and will cause the pins internal clamping protection diode to turn on?
 There is even an example given by the Atmel (or was it PIC) showing a direct input pin connection to 120vac, but applied through a high enough series resistor to limit the current such that there is no damage to the input pin. Most people would rather just limit the maximum voltage applied to a input pin to the datasheet maximum allowed voltage, but certainly if you wish to experiment with using high enough series resistance (like the values used in your divider) you may find it works fine for you.

Lefty
Logged

Pages: [1]   Go Up
Jump to: