P O W E  O V E  R S - 4 8 5
Here are a few ways to provide power to remote sensors and similar small digital devices via the same pair of wires used to carry data to/from them. The idea is of course not new but the lack of widespread common standard in this area and the need to incorporate such interfaces into a large system (about which there will be more words soon) prompted us to design the hardware on our own. The goal was to make it as sturdy and reliable as possible but also to use easily available inexpensive components, which is the cause we didn't opt for current loop technology. The good news is that you are reading this article, so we obviously managed to get the job done. Even better news is that, once we got our hands dirty, we designed and tested not one but four variants of these interfaces :)
Basic circuit
For those with cheaper tickets: RS-485 or EIA-485 is an ANSI standard defining hardware used for establishing series communication among digital devices such as PCs and microcontrollers. It specifies impedances and voltage levels which ought to be used for driving a balanced twisted pair of wires in order to establish digital communication at minimum 100 kbps at distances up to 1200m, and much faster data rates at shorter distances. Our goal was to provide reliable data link over 200m distance and at fairly low data rate suitable for periodic reading of several sensors, so specifications were significantly laxed. Since signal reflection was not a particular problem below 40 kbps, we didn't have to worry about complying to prescribed line impedances too much. Also, since line series resistance was not especially high, we opted for supplying the remote parties with +5V voltage instead of +12V the ANSI standard advises. This simplified the overall design greatly but did not compromise the reliability of communication.
Circuit given in the diagram below can be used to supply a remote sensor with up to 15mA of current at 3Vcc, which might not seem much but it is more than enough for powering tiny microcontrollers and a bunch of surrounding signal conditioning operational amplifiers etc. Several remote devices can be connected to the same BUS in multi-drop configuration if the overall current consumption is under 15mA.
Circuit diagram of directly coupled 'power over RS-485' driver
The purpose of the left part of the circuit i.e. the line driver at the central location (near PC or central console) it to provide electrical power supply to the right part of the circuit i.e. the remote party (sensor or small actuator). In "inactive" logic state, the central driver sets "A" line to +5V so that remote devices can take up to 15 mA for whatever their own purposes are - taking periodic measurements etc. "Active" logic state is indicated as 0V on "A" line. Obviously, in order not to starve remote devices, one needs to be careful to send data in short bursts and to provide enough recovery time meanwhile for the 220F electrolitic cappacitors to fill up again. In practice, sending up to 20 bytes of data at rates as low as 1,2 kbps proved not to be a problem in terms of powering remote devices. This is much more than ocasional chat with a distant sensor usually requires.
Remote parties send data to the central location by pulling current from the "A" line via Q21 and Q22. The central driver senses "A" line current as a voltage drop over 15 Ohm resistor in Q13 emitter circuit - if current is over 40 mA, voltage drop is higher than 0,6V so that Q14 is activated. It in turn pulls Q15 to conduct which leads to producing low voltage at Rx1 output, which the central controller or PC is expected to interpret as logic "active". Transistor Q16 prompts Q15 to behave as a comparator with hysteresis so that Rx1 logic output is very clean.
Zener diodes at both central and remote location serve only to protect semiconductors from overvoltages that might be induced in the line due to nearby lightning strikes etc. Resistors 2 x 15Ω / 1/4W inserted into the "A" line limit the current in case of shortcircuiting the line to approximately 100 mA, which the driver easily survives.
If the remote device (or several of them in total) consumes less than 10 mA, then the central driver circuit can be simplified a bit. This circuit is given at the next diagram and it is the actual implementation that we used in the original project. The drawback is that it provides 0,6V less DC voltage to "A" line, but remote devices which are not particularly power hungry find it quite satisfying.
Circuit diagram of simplified directly coupled 'power over RS-485' driver
The next two pages describe optically isolated drivers which can be useful in systems which cover large distances, either because there is no common electrical ground established between the two locations, or because there is greater risk of destructive overvoltages and power surges to occur.
designed by LP 2011