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

Input Wire Length

Status
Not open for further replies.

EmeraldW

New Member
One of our current projects has a pic that monitors inputs such as magnetic door sensors, motion detectors, and other goodies. As of now, the input pins are set to an input, pulled low, and then pulled high when an alarm is triggered. I can make changes to the designed but as of now we are using +5v as the source to pull the pin high. If we stick with this design, how long of a cable run could we get away with from the board to the sensors? We will be either using small gauge speaker wire or CAT5 for more then one sensor.

Should we use a higher voltage out then step it down to get longer runs? We are hopping for runs in the area of 200 ft or less but some could go longer.
 

ericgibbs

Well-Known Member
Most Helpful Member
hi,
I would not directly connect long cable runs directly to a PIC, they act as long aerials and induce all types of noise problems.

You could use a higher line output voltage, 10V and on the return at the PIC, use a resistive divider, say 2, 4k7's in series.
If the line is very noisy you could add a 4.7V zener across the lower 4k7.
 
Last edited:

EmeraldW

New Member
I didn't think about the noise and I'll take a look at both options. This board may have up to 30 inputs so cost is going to play a part.
 

Diver300

Well-Known Member
Most Helpful Member
I suggest you put series resistors and capacitors on the input terminals. They would certainly reduce the noise, and for the types of input you are talking about, the reduction in the speed of the inputs will not make any difference.

I also suggest that you put some software debounce on all the inputs. You really don't want a microsecond spike on a door sensor triggering an alarm. You want to wait for 100 ms or so before considering it to have operated. I tend to put debounce on both low to high and high to low transitions of inputs coming from switches or from a long way away.

IIRC, the USARTS in PICs have a 2 out of 3 testing system so that really short spikes don't cause errors.
 

Mr RB

Well-Known Member
I'll second Diver300's point about putting RCs on the inputs. You can run really long wiring runs and connect to the microcontroller (as is commonly done in budget alarm systems) provided you have a decent RC filter at the micro input pin, and some software debouncing is usually a good idea too (and adds zero cost).

You can use almost unlimited length wire as the RC filter gives you an average voltage and will remove all the noise and even mains frequency hum etc. CAT5 cable is fine.
 

Gayan Soyza

Active Member
If you go through on security panel cards (industrial type) they all using opto isolators on the input sides.

In my design cards I always keep ground separated from the Input side & PIC side.Because don't forget on lightning issue.At least you can replace the optos after service rather than replacing the whole PIC etc.....due to transient surges & wire shortings during installation etc...

So in my cards I have two separated power supplies one for PIC & other one for inputs.

I also add a small software debounce delay like 100mS.For your applications I'll use opto arrays.
 

EmeraldW

New Member
I'm pretty sure I know this answer but if you use a seperate power supply, do you have to share the ground? The debounce idea is a great idea, I didn't think of that one.

What would be a better idea, starting the pin high and pulling low to trigger or the other way around when it comes to noise and long runs.

This is a bit off topic but for reliability, would it be better to go with RS-232 or USB. The board itself only monitors and sends out strings to software on a PC to handling tasks.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
I'm pretty sure I know this answer but if you use a seperate power supply, do you have to share the ground? The debounce idea is a great idea, I didn't think of that one.

What would be a better idea, starting the pin high and pulling low to trigger or the other way around when it comes to noise and long runs.
It's best to pull low, then you're not running your supply round the building!.

Pretty well all switch inputs use pull-up resistors, with switches down to ground.

This is a bit off topic but for reliability, would it be better to go with RS-232 or USB. The board itself only monitors and sends out strings to software on a PC to handling tasks.
It makes no difference really, but RS232 is vastly simpler to do, and you can always fit an RS232/USB converter to provide USB.
 

EmeraldW

New Member
Would pulling the pins low to trigger also help cut down on the concern of noise?

I want to stay with RS-232 but it seems that everything/everyone seems to want USB these days. If I had it my way and it could do everything I needed, I would run the PC's on DOS or Linux without a GUI but some of the core features of the software we are writting uses too many of Windows' features. :)
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Would pulling the pins low to trigger also help cut down on the concern of noise?
No, i's just the better way to do it.

I want to stay with RS-232 but it seems that everything/everyone seems to want USB these days. If I had it my way and it could do everything I needed, I would run the PC's on DOS or Linux without a GUI but some of the core features of the software we are writting uses too many of Windows' features. :)
Unfortunately modern PC's don't have serial ports, so simply output RS232 from your PIC, and use a cheap and simple RS232/USB converter, inside your project if you want to go that way. It also makes the PC software simpler, as you're running a simulated serial port, FAR simpler than USB.

You can get PIC's with USB built-in, such as various 18F series - but it's making your project many times more complicated than it is.
 

EmeraldW

New Member
I could use some help with the opto isolators. I plan on pulling the pins low to trigger an event and would like to put the opto isolators between the input and the pic but I don't fully understand how to connect them. I would like to use a DIP package if anyone has a schematic on how to connect them. I would like to have 20+ inputs on one board so examples with multiple inputs on one opto IC would be great.
 
Last edited:
Status
Not open for further replies.

EE World Online Articles

Loading
Top