RS485 - EIA485 Transciever
I'll detail here a simple implementation of a EIA485 bus with PICAXE
RS485 : 3 wire bus (half duplex), upto 1200m (400ft) @ 200kbps , 50 m @ 10Mbps (max 500m between two stations)
A and B are the signal wires, C is the common Ground (A is named Y and B is named Z when in emitting mode)
The signal is differential, going over twisted pairs.
Upto 32 nodes can be connected on the bus (or more with some more repeaters thingys)
In Full-duplex mode, 5 wires are used. (A,B,Y,Z,C)
Star and ring topology are not recommended.
more info : http://en.wikipedia.org/wiki/EIA-485
1) The transciever : (MAX485 or equivalent) a single Driver + Reciever chip
It allows half-duplex operation.
It works with a 5V power supply, and does not need additional components
RO : Reciever output if A>B by 200mV : High , if A<B by 200mV : Low
RE* : Reciever Output Enable, active Low ; RO is high impedance when RE is high
DE : Driver Output Enable
DI : Driver Input Low on DI forces output Y low and Z high and reversely
(RO,RE*,DE and DI are 5V TTL)
Vcc : between 4.75V and 5.25V
A or Y : Noninverting Reciever Input / Noninverting Driver output
B or Z : Inverting Reciever Input / Inverting Driver output
Gnd : Ground
2) The BUS :
Made of twisted pairs, shielded is a must for long distance
it needs a terminator resistor on each end (to avoid echoing) (120ohm 1/2W)
the shield has to be grounded only at one end of the bus
and biasing pull-UP/DOWN resistors to force the A and B signal lines to a reference voltage when the bus is idle
(this to prevent reading noises as data)
In a master / slaves configuration, it's recommended to have the terminator on slaves, and have the master in the center of the bus (especially when working with long distances)
3) My experimentation with Picaxe
I came to RS485 when looking for a reliable long distance inter-picaxe communication.
This to make my domotic system. (basically the light switches and dimmers)
This is really inexpensive whilst being intensively used in the industry (PROFIBUS... and so on)
I'm using Picaxe 08 to do this.
Pin4 of picaxe is my serial I/O dataline, connected to DI
DI is connected to RO through a 220ohm resistor, so I can use one single pin to recieve and send data
Pin0 of picaxe is my I/O mode option, connected to both DE and RE*
on the other side of the 'bus' (on the same breadboard), is the same configuration.
my current implementation has a Picaxe08 fitted with a QT110 touch sensor, LS7534 dimmer chip, beeper and RS485,
and a second one with a 4 rows LCD, beeper and RS485
Basically, this allows easy SERIN and SEROUT over long distances for cheap ! (the serout has to be preceded by a HIGH 0 and followed by LOW 0)