RS485

Back to http://scratchpad.wikia.com/wiki/Sasecurity TableOfContents

CAN bus
http://caraca.sourceforge.net/ The core of the NODE is the AVR AT90S4433 micro controller provided by Atmel. The AVR is surrounded by the CANBus driver PCA82C250, the relay driver ULN2003, the Ir receiver TSOP1836 and the temperature sensor/thermostat DS1621. The node is powered by a 12V dc from the bus.

NODE Schematics

http://www.youtube.com/watch?v=xt6_GWLTxN4

http://blackrynius.wordpress.com/category/can-bus/

RS485 notes
* http://en.wikipedia.org/wiki/Ground_%28electricity%29 Signal and earth ground * http://www.bdmicro.com/code/robin/ Round robin protocol for RS-485 - AtmelMicro * RS422 uses two TwistedPair for full-duplex communication. * One RS485 implements bidirectional communication in half-duplex mode on a single TwistedPair. * RS485 specifies same voltage levels as RS422, namely TTL 5v. * It is not a protocol but a hardware signaling standard. Any protocol can be implemented over it. * Inverting connects to inverting and Non to non in all cases - http://www.spheresystems.com.au/RS485.html * Common mode max is +-7v between R+ and R- * http://en.wikipedia.org/wiki/DMX512-A Uses RS485 * http://www.econtrol.org/DMX512%20Links.htm * http://en.wikipedia.org/wiki/EIA-485 * ModBus * DmxProtocol

RS485 and RS232 standard
RS485 allows connecting of computers and terminals via hard conductors. RS-232 was designed to connect terminals to modems. It thus specifies several control signal lines that indicate modem and terminal status. Control lines aren't required with RS-422. Half duplex means that only one device at a time on the network can transmit. Full duplex is when both (all) devices can transmit simultaneously. Depending on what RS-485 interface you are using you can have half duplex or full duplex RS-485. For half duplex you have a single twisted pair that is connected to the transmitter and to the receiver of each device. The transmitters of the devices that are not transmitting must be in high impedance. For full duplex you have two twisted pairs. The first is connected to the transmitter of the master and to the receivers of the slaves. The second is connected to the receiver of the master and to the transmitters of the slaves. But since you can only have one device transmitting at a given time on the same twisted pair, even in full duplex RS-485, the master must initiate the transfer by selecting a slave. Then both the master and the slave can transmit in full duplex (simultaneously). This is purely a problem of protocol, i.e. software. RS-485 full duplex interface chips allow two devices to transmit simultaneously. You must arbitrate when you have more than one slave.

Control pins
The MAX481 or 75176 has two control pins(RE/OE) that enable reception and transmission. When the pins are tied together the chip is in receive mode when the control voltage is TTL low. It is in send mode when TTL high. This allows reversal of signal direction under program control in half-duplex mode, which allows for master slave communication. With the master RE/OE pins high all the slaves RE/OE pins must be low placing the slaves in receive mode. The master sends an unique address packet talking to the slave. The slave waits 100us before sending it's data to the master. Upto 32 slaves can talk to the master in this way.

he 485 spec defines an electrical bus consisting of 2 wires and thats it. It talks about what the loads of each transceiver must be and the amount of ground difference the bus can take without causing an "off" transceiver to turn on unexpectantly. The fun thing was that they never tried to specify connectors or anything handly like that, so the spec was widely excepted and generally different from one machine to the next (though screw terminals, I suppose became the defacto standard).

The 4-wire 485 is two 485 buses where one is turned into a unidirectional transmitter bus from master to slaves. The master is generally always transmitting and the slave always receives. The other is receiver bus and is multidrop in the 485 sense (except the master usually doesn't talk in this scenario). This is a scenario I actually saw in the RS-422 spec however true RS-422 didn't have the same electrical spec as 485 (couldn't handle as many drops and had a different differential gound reference I believe, it has been a while since I looked at the spec). The benefit here is that the master should always be able to talk to the slaves, which can be handy if the return bus has a unit that won't be quiet.

Though the "RTS" has become the signal line of choice for controling this, I think your instructor is doing you a disservice by specifying it as some kind of 485 signal. It is never mentioned in the spec, just something that was handy when they started to marry these things to Serial controller chips. A lot of 485 is connected to embedded processors, that generally don't have RTS lines, it is just another digital io pin.

Determine the logic condition
The logic condition is determined by the difference in the voltage levels on the conductor pair. Pin.6 (A) is the non-inverting and (B)pin.7 the inverting input. Any noise will appear on both lines at A&B and will be cancelled out. At the transmitter one pair conductor is at +5v, the other at ground. Reverse the logic by reversing the voltage levels on a pair. So for a logic 1 place +5v on (A)-IC2 and 0 on (B). For a logic 0 place +5v on (B) and 0v on (A)-IC2.

Transmitting from Master to Slave
Connnect the Tx of the AtmelMicro to the DI input of the master MAX481(IC2). On DI receiving +5v results in (A) high and (B) low. The slave on the other end of the line receives (A)master on its (A)-IC3 input and its (B)-IC3 slave connects to (B)master. When RTS is asserted positive, R1in - IC1(MAX2320 is high and R1Out is low, placing the RS485 MAX481 in receive mode. With RTS low the MAX481 is in transmit mode.

Biasing resistors
Use two 760ohm biasing resistors (R2 AND R3) on the line to Vcc and Gnd each. This is to keep a small 200mv differential over the terminating resistor. When the RS-485 network is in an idle state, no active drivers are driving the line. The transmission line reaches a meta-stable state and the logic level is not known at this point. It becomes important to have biasing resistors to passively pull the line to a known state. Bias resistors are nothing more than a pull-up (typically to 5 volts) and a pull-down resistor (to ground) on the data A line.(p.29 http://real.uwaterloo.ca/~robot/)

Common ground conductor
Don't use a common ground conductor it will only pick up noise. Use only a single TwistedPair wire for RS485. (This depends though if you use transient suppressors you must have common ground). http://groups.google.com/group/comp.arch.embedded/browse_frm/thread/4892b10730c90d8f/bc5e0e1ee9511f0a?lnk=st&q=RS485&rnum=3#bc5e0e1ee9511f0a Which is bad, because the common mode voltage on RS485 may not exceed 7V. Always use a ground connection too.

> What I was thinking of is to run Cat5 as close to each machine as > possible and connect it to a plain old surface mount modular RJ11 > telephone box (you know, like what your phone cord plugs into). Then I > could use a standard RJ11 telephone cable (like what connects your > modem to the phone line) to hook the machine up to the network. (The > machine would also have a modular RJ11 telephone box which would be > connected to the RS485 transceiver of the electronics that I'll > design).

Not a problem if it's short. And definitely not at 9600 baud. If it's a noisy environment you might miss the shield though.... Always use slew rate limited parts when possible! We use slew rate limited, failsafe, with short '''circuit protection drivers''' and everything has been goin along great.

http://groups.google.com/group/comp.arch.embedded/browse_frm/thread/22511591b16678dd/4184893c4c3f9888?lnk=st&q=RS485&rnum=1#4184893c4c3f9888 post 119 says that the correct term is common-mode reference

comp.home.automation
http://groups.google.com/group/comp.home.automation/browse_frm/thread/a6e20921d16ddf1e/461c701b98c39709?lnk=st&q=RS485&rnum=8#461c701b98c39709

* http://rs485.de-franek.de/ * http://cmp.felk.cvut.cz/~pisa/ulan/ul_drv.html * http://www.andrive.de/andreas/bitbus * Rs485IsBidrectional * Rs485Post104 * LastCharacter485 * CharlesFalconeSerialRoutines * MatchCableImpedance * EarthLoopProblem485

One shot triggers RS485
* OneShotTriggersDtr485

Terminating resistors
There must only be two terminating resistors(R1 and R4). One at each end of the line. Not one for each RS485 device. Upto 32 RS485 devices connects in parallel on a single TwistedPair. The transmitter has a low source impedence. The line should be terminated with a low 120ohms resistor. Noise induced in the line affects both conductors so that little or no change in difference appears at the receiver.

Jan Axelson
* file microsys_art_RS485.pdf * http://www.embeddedsys.com/subpages/resources/images/documents/microsys_art_RS485.pdf  Jan Axelson

www.rs485.com
Rs485comCircuit

RS422
RS422 using two TwistedPair allows for full-duplex communication.

two or three wire
* http://www.chipkin.com/articles/rs485-cables-why-you-need-3-wires-for-2-two-wire-rs485 RS485 is a 2 wire network if done right. Profibus is a typical example of a true 2 wire RS485 system. The secret to trouble free RS485 is to use isolated power supplies to run the RS485 transeiver. Low cost, low current, high speed non optical isolators are now available from Analog Devices (the ADUM1300 series) and simple to implement power supply isolators are also available from Maxim (MAX253 & MAX845). Combining these parts with any standard RS485 transeiver builds you a fully isolated interface that truely needs only 2 wires. You must provide biasing resistors with this setup to center the RS485 signals within the isolated interface common mode range. A sample of an isolated interface can be found in the booklet “The rapid way to Profibus” or I can send you as sample circuit if you are interested.

Links
* ConfiguringAlarmSystem * CompHomeAutomation * http://www.circuitcellar.com/library/ccofeature/perrin0799/index.asp * http://www.bdmicro.com/code/robin/ Round robin protocol for RS-485 - AtmelMicro * http://www.lammertbies.nl/comm/info/RS-485.html * RS232 code for 8051 http://hcs.sourceforge.net/software.html * http://www.hw-server.com/rs232_signals.html * http://www.spheresystems.com.au/RS485.html * http://www.linuxjournal.com/article/8513 Python RS232 serial code * http://aquaticus.info/control_unit AVR schematic of RS485 connected to Rx/Tx pins * http://aquaticus.info/rs485_communication_test RS485 software * http://www.gasenzer.dk/ RS232 to RS485. RS485 to Ethernet converter. * http://cc-concepts.com/products/hcs/ * http://www.circuitcellar.com/library/ccofeature/perrin0799/index.asp * EDN desing feature 1996 * http://jap.hu/electronic/pbus.html * http://www.rs485.com * http://www.rs485.com/downloadfiles/IRS422HVrevB.pdf * http://www.easysync.co.uk/ * http://www.svconline.com/news/avinstall_implementing_electronicsystem...> * http://www.aes.org/standards/b_comments/comments-draft-aes48-xxxx.cfm> * http://www.graybar.com/Industrial/Industrial_Networking/whitepapers/B... * http://www.utsystem.edu/fpc/docs/electrical_mechanical/electrical/16120 * http://www.tequipment.net/WilcomTeleTransT124.asp * http://www.nrao.edu/evla/geninfo/memoseries/evlamemo41.pdf * http://www.fac.ilstu.edu/Facilities_Services/Fac_Plan_Home/DesignGuid... * http://tinyurl.com/b9gu2 * http://www.usda.gov/rus/telecom/publications/word_files/1751f810.doc * CircuitCellar

More links
http://www.embeddedrelated.com/usenet/embedded/show/69583-1.php

http://ieeexplore.ieee.org/Xplore/login.jsp?url=/iel5/61/30625/01413412.pdf?arnumber=1413412&gt

http://www.thomasnet.com/products/suppressors-transient-voltage-surge-81400103-1.html

http://www.flomerics.com/events/event_details.jsp?event_id=2682

http://www.slopeindicator.com/pdf/papers/new-victoria-dam-case-study.pdf

http://www.arema.org/eseries/scriptcontent/custom/e_arema/library/2000_Conference_Proceedings/00055.pdf

Telcos solve surge problem
http://www.embeddedrelated.com/usenet/embedded/show/69583-1.php

http://www.erico.com/public/library/fep/technotes/tncr002.pdf

http://groups.google.com/group/comp.sys.ibm.pc.hardware.storage/browse_frm/thread/5a03c959a504d984/1d74ed31f0e6b95c?lnk=st&q=&rnum=1#1d74ed31f0e6b95c

http://makeashorterlink.com/?X61C23DCA

Image
attachment:rs485tut.png

See ["RS-422"]