Build Your Own CheapNet RS-485 Control System

t.pdf. It's a snapshot of the page taken as our search engine crawled the Web.
The web site itself may have changed. You can check the current page or check for previous versions at the Internet Archive. Yahoo! is not affiliated with the authors of this page or responsible for its content.
Build Your Own CheapNet RS-485 Control System Build Your Own
CheapNet
RS-485 Control System
This article begins a new series of projects that we believe will revolutionize your
understanding about how wiring should be connected between two or more devices that
are separated by more than a short distance. The device we are about to discuss is easy to
use and is so versatile, that we are sure that you will easily put this project to use in many
different ways. Lets get started with some basic background info, build on it, and cover
some easy to understand examples that you can put to use in the real world.
WHAT IS A NETWORK ?
A network is two or more devices which are tied together over a common set of
conductors. Serial communication is the format which is used for that communication. The
information can be sent Simplex ( travels in one direction only) Half Duplex ( travels in
both directions alternately) and Full Duplex (travels in both directions simultaneously).
Normally, Simplex and Half Duplex only requires a single twisted pair of wires while Full
Duplex requires 2 twisted pairs of wires. The wires are required to be twisted because this
allows cancellation of some of the common mode noise factor. More about that at a later
time.

Some of the earliest serial communication standards in existence are still with us
today. RS-232 is what most people have on their computers which lets them communicate
with their mice, trackballs, and other peripherals including some printers. This standard
was designed to let you communicate up to about 50 feet and you can actually go farther
if the baud rate is low enough. As a matter of fact, theres companies which sell
networked RS-232 systems. But, because of the standard, theyre vunerable to a lot of
problems.
First of all, the voltage level is -3 to -15 VDC for Logic 1 and +3 to +15 VDC for
Logic 0. Anything between -3 and +3 VDC is considered noise. Now, since wire that co-
exists in a cable are capacitative in nature, it takes a little bit of time to charge up the wire
to that potential and discharge that potential on the Logic 0 level. This takes electrons to
charge and discharge the cable before the reading is valid on the other devices. And thats
where the problems start.
Http://home.att.net/~dennis.shepard/ A LITTLE BIT OF HISTORY
20 years ago, I worked as an Electrical/Electronic Specialist at Dow Chemical-
Research and Development. Some of the research labs were experimenting with electronic
control systems which could be programmed to change their function without changing
the physical wiring itself. The device was Texas Instruments 5 TI series of Programmable
Logic Controllers. The door was opened and I began to learn about the emerging field of
automation and Distributed Control Systems. The following year, I began installing and
programming Allen-Bradley PLCs for the U.S. Government and private industry
applications.
These PLCs began to be remotely linked over high speed data networks. Allen-
Bradley named their networking system as Data Highway. Another PLC manufacturer,
Modicon, developed their protocol MODBUS and MODBUS +. I have worked for many
engineering firms over the years before starting my own engineering business and I have
personally installed hundreds of systems, so I know what Im talking about when I speak
of networks. By the way, the hardware specification of these networks is called RS-485.
THE RS-485 STANDARD
The RS-485 standard is THE way networking is done PERIOD ! Who uses
networked PLCs, you might ask? All the car manufacturers, Disneyland and all other
amusement parks, and just about every manufacturing plant in the world. RS-485 is a
balanced transmission line which transmits at 10 Mbits/ second or 4,000 feetbut not
BOTH at the same time. It normally terminates with 120 Ohm resistors at each end of the
network line. The smart idea is to run at a speed that is fast enough to be practical, but
slow enough to go the distance and not have problems with noise and interference !
RS-485 uses a differential balanced line with two points labeled A and B. The
logic convention is that if A > B by .2-6 VDC then the output is logic 1. If B > A by .2 to
6 VDC then the output is logic 0. In other words, by changing the POLARITY between A
& B the logic level will be high or low. The receiver is able to detect these levels as low as
.2 VDC and will tolerate a differential voltage of 6 VDC. The transmitter must be capable
of generating -1.5 VDC to + 1.5 VDC. Thats pretty much covers the standard.
The system we have designed is a Half Duplex network which uses a 8 data bit,
no parity, 1 stop bit format which runs at 2400 baud. A DIP switch sets one unit as Master
and the other unit as Slave. Once the units are energized on each end, the Master will
serially transmit the status of the eight inputs to the Slave which will display those bits as
outputs. Then the Slave unit will serially transmit its eight inputs back to the Master
which will, in turn, display those bits as outputs. And at 2400 baud, thats happening
about 240 times a second !
Http://home.att.net/~dennis.shepard/ LIFE IN THE REAL WORLD
Farmer John (not his real name) lives in the country with his chickens, cows, and
pigs. Hes got a REALLY big farm and he works 7 days/week. He kinda likes to keep an
eye on things from the house such as whether the door is open on the chicken coop (ya
gotta watch them weasels) or whether the hen house is warm enough. Cold chickens dont
lay too many eggs, ya know. And since hes got all them animals, he lives far enough away
from them that he doesnt have to hear them or SMELL them !
The point is, even a low tech situation can benefit from a CheapNet. Its so
inexpensive that it opens up new avenues of opportunity. You can even run the Slave on
batteries and charge them from a solar cell from Radio Shack if you dont have any
electricity out there. Discrete inputs (On or Off) are commonly known as switches.
Magnetic switches for doors and adjustible temperature switches for the hen house.
INTERFACE DEVICES
Speaking of inputs, if you look at the other projects such as the universal alarm
system, youll see that we believe in using 78L05 voltage regulators as input conditioning
circuits. It helps with noise and voltage drop problems. Input 9-24 VDC to the input of
the regulator and tie the output to one of the inputs on the CheapNet module. On the
output side, we suggest using the IRLZ14 HEXFET transistors. You can also use the
Radio Shack reed relays (dont forget the clamping diode) like we used in the auto dialer.
Or use a piezo buzzer, a LED with a series resistor, etc.
Price wise, these components are fairly inexpensive. 78L05s are 30 cents ea. in
lots of 25 and the IRLZ14 HEXFETs are ~ 61 cents ea. in lots of 10: prices are from
Digikey Corp. (http://www.digikey.com). Youre probably not going to need all the inputs
and outputs at each end. In that case, ground any unused inputs and ignore the unused
outputs. If the corresponding inputs on the other end are grounded, these outputs wont
be energized irregardless.
Please keep in mind the current limitations of the 78L05 which supplies power to
the unit is only rated for 100 ma. You need to make sure that whatever you hook up
directly to the outputs doesnt exceed this rating. Otherwise, run your load through the
HEXFET transistor to a source separate from the CheapNet voltage regulator. Now lets
talk a litle bit about how to configure your inputs and outputs to get the desired results.
Speaking of current, Microchip Technology recommends limiting the amount of
current sourced (output returned thru gnd) to 20 ma. per pin and 40 ma. per port. They
also recommend limiting the current sink (output returned thru supply) to 25 ma. per pin
and 50 ma. per port. Take advantage by using the current sink option and you can control
more loads per application.
Http://home.att.net/~dennis.shepard/ Inputs can be wired as failsafe by wiring them as normally closed contacts between
the power source and the input. This makes the input normally high so anything that
disrupts the circuit, will cause the input to go low. On the corresponding output side, a
reed relay or LED can be wired between the output and EITHER supply power or GND.
If the other side of the load is tied to supply power, the load is ENERGIZED
when the output is LOW and if the other side of the load is tied to GND, the load is
ENERGIZED when the output is HIGH. For example, if you wanted a failsafe
Input/Output configuration using Input 1, you would wire a Normally Closed set of
contacts between the supply power and the 78L05 regulator feeding Input 1. An LED and
current limiting resistor are wired in series between Output 1 and supply power. Now,
when the contacts open, the LED lights.
You can have the same failsafe input and have reverse action on the output by
wiring Output 1 to GND instead o