Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Interfacing 24V

Status
Not open for further replies.

Dan East

New Member
I have a circuit running at 24VDC (alarm system & magnalock door lock). What is the simplest proper method to interface 24V lines with a PIC? Now I'm not talking about powering the PIC, but simply using 24V signals as inputs to detect switches and power to various devices. Will just a resistor suffice? I really don't want to use relays, and a dozen diodes in series per signal isn't exactly elegant.

Dan East
 
hi,
A resistor on it's own will not work, you need two resistors to divide the voltage.
Try something like 22K from 24V to PIC input and 4K7 from PIC input to GND.
 
I should have known Nigel's site would have the solution.

Thanks for the suggestions - I'll go with the NPN transistor.

Dan East
 
hi Dan,

When you say you will go with the transistor cct from Nigels extras, I dont understand. [Ive had a quick look]

As Sye says, you only need two resistors connected as a potential divider.

EricG
 
You don't even need two resistors, just one is all you need, the protection diodes will clip the voltage as required, so only one resistor is needed to limit the current. Obviously make sure that the input pin has such diodes, most do!.
 
A zener is a good idea as it will protect from any possible voltage spikes as well. I'd trust a real zener as opposed to relying on the PIC's protection diodes, they're not rated for much current at all (1ma I think)
 
Sceadwian said:
A zener is a good idea as it will protect from any possible voltage spikes as well. I'd trust a real zener as opposed to relying on the PIC's protection diodes, they're not rated for much current at all (1ma I think)

I'm not sure of their rating without checking the datasheet, but the whole point of the series resistor is to limit the current to within it's capabilities. Certainly they pass enough current to get the whole chip too hot to touch if you put the PIC in backwards! :D without any damage to them.
 
It's an EMF spike that makes using a series resistor not a good full on sollution. Things like static discharge can still provide enough voltage to force enough current to fry an I/O lines driver or protection diode. At the voltage created from a static discharge even the instantanious current is enough to fry those tiny little diodes. The OP said this was for an alarm system connected through at least a door lock, an extra zener tacked on is going to give you a significant MCU saftey buffer.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top