Dick Cappels' project pages http://www.projects.cappels.org
Return to HOME (more projects)
Duplex Data And Power Over One Pair, Done Simply.


Photo 1.When its not worth the expense and hassle of Ethernet, these adapters use a combination of tricks so that a single pair of wires carries full duplex serial data and a small amount of power to a remote device for tasks such as continuous remote data collection and control. The digital signals can be simple on/off signals as well as more complex signals such as RS-232.


 This project is a pair of cable adapters that allow transporting full duplex bidirectional data and power over 100 meters or more of a single pair of wires such as is shown in Photo 1, using only only simple analog circuits. You may wonder: in this day of easily obtainable Bluetooth, WiFi modules and Power Over Ethernet (PoE) turn-key solutions, why would anybody bother with a project using unglamorous analog techniques? In some applications having to use Ethernet is a disadvantage because of the higher costs and interface complexity.  For example, does it make sense use Ethernet when an on-chip UART does the job well?

This system is transparent to low-speed binary signal protocols such as RS-232 and on/off signals and is inexpensive to make.  No power supply or battery is needed at the remote location, just string your two conductors and start plugging things in.

This project grew out of my desire for a system able to get multiple channels of data from an in-ground water tank. My tank is intermittently and unreliably refilled from a municipal water system and letting the pumps run without water to cool them will shorten their lives. When the tank was first installed, I had the foresight to have a single twisted pair or wires run under the concrete walkway to the house with the idea in mind of only needing a "tank almost empty" switch to protect the water pumps and/or give us enough warning to get one last quick shower before the tank ran empty.

Later I realized that if there were more channels available, I could know more about the water than just the level. I could keep tabs on when the municipal water supply was filling the tank, approximate how much was being lost to leaks in the system, and even the temperature of the water in the tank, useful for seasonal adjustment of the power setting of the on-demand water heater. Thus a necessity was born, in my mind, at least.

Besides the mundane application of monitoring a water tank,  system would be excellent as for connecting a computer to a low power weather station, intrusion detection systems other instrumentation and monitoring devices. Bit rates up to 250 kHz make this also applicable to two-way voice communications such as intercoms and a lot of other uni- or bi-directional communications uses.



Figure 1. The Base Adapter includes a 15 volt power converter so that the adapter can be powered from a 5 volt Universal Serial Bus cell phone charger. Optionally, +15 volts can be supplied directly, eliminating the need for the +5 volt to +15 volt converter.

Choice Of Approaches


The most fun part of this project, besides finishing it and see it work, was dreaming up ways to get full duplex data and power over a pair of conductors.

The signals needs to appear to be direct coupled so as to be able to handle RS-232 or any other direct coupled binary control signal reliably without sensitivity to duty cycle or message content. I wanted it to be possible for the adapters to be able to work with nearly any pair of conductors including a twisted pair, coaxial cable, or even lamp cord over a distance of 100 meters with speeds suitable for low speed control and telemetry. A modest amount of power would be delivered to the remote device over the wires.

In the water tank I plan to use an old trusty 4 Megahertz Atmel ATMEGA8515-8PC micro controller (Other controllers can also be used.) running AttoBasic [1] to measure water level, the "tank empty" switch, the "tank filling" switch and maybe even temperature since that affects the power requirements of the on-demand water heaters. The AVR controller does not require much current. Keeping current drain low when long wires are involved because for given length of wire, the lower the current over the wires, the smaller the required diameter.

One of the ideas considered early on was that of using frequency separation to send multiple signals over the wires. It would be a simple matter to control high frequency oscillators at different frequencies for the base adapter and the remote adapter and AC couple those signal to the wire, while DC coupling the power through a choke or other suitable circuit, then use frequency selective detectors at the other end of the wires to convert the RF to digital signals. Its been done for decades and it can work pretty well. The main drawbacks center around susceptibility to interference the use of high frequency oscillators and the tuned detectors, which can take a lot of work to get running well.

Another approach that was considered is that of  putting a micro controller  at each end of the wires to buffer the duplex data send them over the wires by high speed simplex. The idea is to fool the devices at each end of the wires into seeing the link as full duplex. It would probably work for most cases, though there is the risk of it not being compatible with some protocols that need true full duplex. To get power to the remote adapter, the system would work something like Maxim Integrated's  clever 1-Wire interface [2] in which the signal from the base adapter sends data using a high current buffer while a capacitor in the remote until stores the peak voltage to provide power to the remote device while it is responding to the host.


The Chosen Methods
I chose a combination of two time tested methods that work with a signal line and a return line.
The arrangement is shown in Figure 1.  The methods are those of sending data from the base adapter to the remote adapter by simply switching the voltage levels on the signal line between two definite levels as shown in Figure 2 while at all times, keeping the voltages on the line high enough so that spite of the switching, the voltage on the signal line is always enough for the five volt regulator at the remote adapter to say in regulation. When the data on the input port of the base adapter is at logic low the voltage on the signal line is approximately 9 volts and when the data on the input port is at logic high the voltage on the signal line is approximately 11 volts.

Sending data from the remote adapter to the base adapter by switching the current flowing through the signal line as shown in Figure 3. When the data input port is at logic low, the remote adapter draws a constant 25 milliamps regardless of the input voltage and switches it to 33 milliamps when the data input port is at logic high, also independent of the instantaneous voltage on the signal line. Some may recognize the switching of the current as a variation of current signaling loops that have been used in industrial control and monitoring for decades that is so effective because the current is independent of the resistance of the cables.

The I x R voltage drops on the output of the base adapter and the signal and return lines are what ultimately the limits wire length vs wire size tradeoff. Once the total resistance of the two lines plus the output of the output of the base unit exceeds approximately 30 ohms, the voltage appearing on the inputs to the remote adapter will be too low for voltage regulator to operate.

It is important that the output resistance of the base adapter and the interconnecting cable be low enough so that there will sufficient voltage available for the current source in the remote adapter to work properly and so that the voltage on the signal line does not change enough for the data being sent by the remote adapter in the form of current to mistake the resultant voltage drop as being a signal from the base adapter.

Figure 2. Data from the base adapter are sent by level shifting the RS-232 or CMOS serial data between 9 volts and 12 volts. A voltage comparator at the remote adapter slices the signal to generate a 0 to 5 volt logic signal. The voltage on the signal wire is always sufficient for the 5 volt regulator to remain in regulation.

 

Figure 3. The data flows from the remote adapter (right) to the base adapter (left). Steady current is drawn by the shunt regulator and serial data is added to the regulator current with a switched current source.

Just as it is important for the base unit's output to be a low impedance so it can control the voltage on the signal line, it is important for the remote unit to appear as a high impedance to the cable so that when the base adapter switches the voltage level on the cable, the current does not change significantly, otherwise the base adapter's outgoing data would have the same appearance as data from the remote adapter, resulting in the data being echoed back to the device connected to the base unit. As if to demonstrate this principle, a quick way to test a base adapter is to connect it to a terminal and observe whether data typed on the terminal is echoed back only when a 360 ohm resistor is connected across the base adapter's cable connection.
                           
The combination of constant current source and shunt regulator used to make the five volt supply gives a low dropout regulator. I chose +12 volts as the maximum voltage on the signal line because I wanted to have 5 volts available for the application circuit at the remote adapter but I didn't want the voltages on the signal line to be so high as to have a problem with power dissipation at the remote adapter. As it is, the circuit runs coolly with no heatsinking.


Base Adapter



Photo 2. The base unit including the 5 volt to 15 volt power supply is still very simple for its functionality. The two 8 pin  Dual Inline Package Integrated Circuits are a voltage comparator and the switching regulator.

The circuitry of the base adapter, which is shown in Photo 2, consists of a 5 volt to 15 volt power supply and a Base Adapter Transceiver which sends data from its serial input to the remote adapter by switching the voltage on the connecting wires, and detects signals sent from the remote adapter by detecting changes in the current through the connecting wires.

The hard-wired version using through-hole parts only occupies 16 square centimeters of board area and requires no heatsink.


Optional Power Supply

Figure 4. The 5 volt to 15 volt power supply requires care in routing the grounds. High peak currents flow between the negative end2 of C51 and the C53, and the negative end of C51 and U1 pin 2.

The base adapter requires a power supply of approximately 15 volts and an unregulated voltage would be fine. After consulting with a friend who is well versed in the topic, I understood that 15 volt "wall wart" power supplies are made but not common. Given that and the ubiquity of 5 volt "wall warts" cell phone charges, deciding to add an optional 5 volt to 15 volt boost circuit was an easy. I used the KA34063 switching regulator IC which I keep around for such needs. The circuit itself is a simple and reliable direct implementation of the datasheet example of a buck regulator. After a couple iterations of calculating component values and checking the part values in the junk box I came up with a 15.5 volt design. It took only a few minutes to add the circuit to the base adapter and it worked right off.

In Figure 4, you can see the current limit resistance made up of R51A and R51B  in parallel. Its not a special trick, its simply because I needed approximately 0.9 ohms and 1.0 ohms is the lowest value I had on hand. One other thing about this circuit that may not be obvious is that the 220 microfarad output smoothing capacitor, C53 is in parallel with 220 microfarad input filter capacitor C3 in the base adapter circuit, making the total filter capacitance 440 microfarads.

If you have 15 volt power supply that can deliver approximately 40 milliamps you don't need the 5 volt to 15 volt boost circuit. You can mereley the 5 volt to 15 volt boost circuit and connect the positive output of your 15 volt power supply to the input of the base adapter labeled "Red +15V" in Figure 5.


Base Adapter Transceiver


Figure 5. Three terminal voltage regulator U3 provides 12 volts while Q3 switches between the states of passing the 12 volts or dropping it down to 9 volts as a function of the state of the signal from the terminal.


The inputs to the Base Adapter Transceiver circuit shown in Figure 5 are "roughly compatible" with RS-232. By "roughly" I mean that it works with most RS-232 ports even though it does does not adhere strictly to the RS-232 standard (Now EIA-232). If an interface that conforms strictly to the standard, integrated circuit serial interfaces are available and can be used instead [3].

The voltage at the line output of the base adapter is kept at approximately 9 volts when the data input to R13 is near ground. The 9 volts results from voltage drop of 2.4 volt  Zener voltage of D4 in series with the 0.6 volt base-emitter junction of Q3 is subtracted from the 12 volt power supply. When the data input approaches 5 volts Q4 conducts sufficiently to saturate Q3 which pulls the voltage on the line to approximately 11 volts. When conducting, Q4 also supplies current to the green light emitting diode, D6, to indicate the data being sent.

To detect whether current through the signal line corresponds to a logic high or a logic low U4, a voltage comparator, is connected  across R19, a low value resistor in series with the signal wire. When the voltage drop across that resistor exceeds the threshold voltage across R17 the output of U1 and the data output of the base adapter is allowed to be pulled up toward +12 volts.  Since the base current of Q3 necessarily through R19, the base current as Q3 is switched on and off causes a small voltage drop across R19, causing errors in the current receiving circuit. A small amount of the voltage that switches Q3 on and off is added to the threshold on the noninverting input of U4 to cancel out the undesirable effects of the Q3 base current.

A hundred meters of wire can pick up a lot of noise, so C5, a 0.1 uf capacitor is placed across R19. the 3 ohm current sense resistor to creating a low pass filter that causes the voltage signal appearing at the input of comparator U4 to roll off starting at at 250 kHz. This leaves enough bandwidth for use at 230400 baud for short cable runs. I was able to use 38400 baud serial data on 95 meters of cable without any problems. If you experience too much noise, you can increase the value of C5 though you might have to reduce the baud rate too.

One end of R19 is connected to +12 volts placing the inputs of U4 near 12 volts, so U4 gets its power from the 15 volt input so that U4 can have a power supply voltage higher than the voltage on its input pins.


Remote Adapter

The remote adapter consists of an optional automatic polarity switch, so I don't have to worry about getting the signal and return lines switched, and the Remote Adapter Transceiver which sends units to the base unit by switching the current drawn by the remote unit and receives the signal sent from the base unit by sensing voltage changes on the signal line.


Automatic Polarity Switch

If, during installation, the signal and return lines happen to be switched at the remote adapter, nothing will work and the base unit's current limit capability will be tested -its not good to tempt the fates!  It also might be inconvenient to diagnose and correct the error, particularly given that the two ends of the system may be separated by over 100 meters of wire. A very low forward-drop full wave bridge built into the remote adapter would solve that problem. Schottky diodes can do the job, but they leave very little "headroom voltage" to allow for very much of a voltage drop on the line and return conductors. Using an automatic active switch using low on-resistance Metal Oxide Field Effect Transistors  like the one in Figure 6 can do a really good job directing the signals from the signal and return lines to the correct inputs on the remote adapter power supply and transceiver circuit.

The P-Channel and N-Channel Metal Oxide Field Effect Transistors  inside the FDS8958A Dual Metal Oxide Field Effect Transistor have a total series resistance of less than 80 milliohms. With the maximum current drain of 35 milliamps. the maximum voltage drop across the bridge of only a few millivolts. That's a nice switch and the voltage drop should not have a significant effect on the operating capabilities of the system.

The Metal Oxide Field Effect Transistors  are rated at only 20 volts between the gate and drain, so 15 volt Zener diodes were added to prevent any two external connections from having a voltage difference of more than 30 volts. Besides protecting the MOSFET gates, it also provides some protection against induced transients for the rest of the system.




Figure 6. Four Metal Oxide Field Effect Transistors  are automatically biased by the applied voltage to connect the inputs so as to route the more positive input to the Signal pin and the more negative input signal to the return pin. The 15 volt Zener diodes provide protection against induced transients for the Metal Oxide Field Effect Transistors.


Remote Adapter Transceiver



Photo 3. The remote adapter is very simple and requires very little board space.

The Remote Adapter Transceiver Circuit shown in Photo 3 consists of a 5 volt precision reference, a receiver to shift the voltage on the signal line to a ground referenced voltage to interface to an RS-232 external device, and a circuit to use the voltage on the serial data input to switch the total amount of current drawn by the remote adapter.


Figure 7. U1 acts as a voltage reference to set its own bias current. That creates a chicken-and-egg-like paradox which is resolved with the addition of startup circuit C1 and R2 that kicks the circuit into operation when power is applied.


Five Volt Regulator

The schematic diagram of the remote adapter circuit is shown in Figure 7. A five volt regulator makes over 15 milliamps available to the external powered device connected to the remote adapter and provides a reference voltage for the constant current source made up of Q2 and Q4 which sets the constant 25 milliamp current drawn through the signal line when the data input signal is at logic low. Approximately 4.5 milliamps of this current is used the on-board circuitry and the remainder is available to the external device including the TL431 shunt regulator that sinks current not used by the load to keep the output voltage constant. 

You might have noticed a sort of analog circuit paradox. The current source needs to operating in order for the reference voltage to be present and the reference voltage is need in order for the current source to operate. Sometimes this sort of problem is solved by putting a large value resistor somewhere to introduce current necessary to start up the circuit. In this case, 90 milliamps current comes through 100k resistor R3 and is amplified by current mirror D2-Q4 which has a gain of 70, giving an initial current capability of 6 milliamps, which is enough to get some voltage across U1 thus starting the reference voltage.

The current source is made of disc
reet components because it needs less voltage across it than available monolithic regulators. An additional additional benefit of discreet components is that the input impedance to the current source remains very high at much higher frequencies than would be observed in a monolithic regulator, which helps maintain the independence of current on from voltage on the signal line.


Remote Adapter Circuit

Data are transmitted back up the signal line by switched current source Q1 and Q2. A current source is used so that the current through the signal line will not depend on the voltage on that line. The base of Q2 is connected to the five volt power supply and when the data input to goes higher than a couple of volts, Q1 saturates, placing 4.3 volts across 560 ohm resistor R2, which causes 8 milliamps to be drawn from the emitter of Q2. Since Q2 has a high current gain, the vast majority of that 8 milliamps is further dawn from the Signal line. A happy circumstance is the four volts available between the signal line and the emitter voltage of Q2. and that is enough voltage blink a green LED as data are transmitted, meaning that the LED could be lit with power that would otherwise be completely wasted as heat and no components other than the LED need to be added to get it to light safely.

To decode the received data, the voltage on the signal line is divided by the relatively high resistance divider made of R9 and R10 such that the midpoint between the 9 volts that corresponds to a logic low and the 11 volts that corresponds to a logic high comes out at 2.5 volts. Comparator U2 is connect to look at the 2.5 volts on the feedback pin of U1 and the output of the voltage divider such that the output of U2 is held low whenever the voltage out of the voltage divider is above 2.5 volts and the output is allowed to be pulled up toward 5 volts whenever the output of the divider is above 2.5 volts. The 5 volts through 2.2k works well with many serial devices.


Tune-Up And Use

There is only one adjustment and that is of the receive threshold in the base adapter. Since the signal from the remote adapter is in the form of a current, it is more susceptible to noise pickup than the voltage signal sent by the base adapter. To maximize noise tolerance threshold set pot R15 is adjusted while a stream of data is sent via the remote adapter. I got this to happen by just running a little FOR NEXT loop for the AttoBasic controller and having it continuously send data to the adapter. This pulse stream can also be made by driving the R input on the remote adapter with a 5 volt square wave.

While the data are being sent, adjust R15 midway between the points that the received data becomes corrupt or stops. You are done with calibration.

To use the system, connect either a 15 volt or 5 volt power supply to the base adapter depending upon whether you already have a separate 15 volt power supply available. Plug your computer of other base device into the serial input connector.  Connect the Signal and Return terminals on the base adapter to one end of a length of a two or more conductor cable, connecting the other end of the cable to the Signal and Return connectors on the remote end. Plug your connect power and the serial port to the external device, and you are done. The LEDs on each adapter indicates when their respective adapters are sending a logic high.


Why I'm Happy

Using what I have on hand, have tested this with 120 meters of a combination of #23 telephone wire, 0.5 mm square lamp cord and 50 ohm coax. With the 0.1 microfarad low pass filter shown for C5 reliable full duplex communications were observed at 38,400 baud. My application of communicating with a single chip computer via terminal requires 9600 baud so it should be good for a much longer run for my use if ever needed.

Overall, I am pretty happy with the system's performance.


References

[1] AttoBasic Home, http://cappels.org/dproj/AttoBasic_Home/AttoBasic_Home.html

[2] Maxim Integrated, 1-Wire Tutorial, http://www.maximintegrated.com/products/1-wire/flash/overview/index.cfm

[3] As an example, the Maxim MAX231  http://www.maximintegrated.com/datasheet/index.mvp/id/1798


Find updates at www.projects.cappels.org


HOME (More Projects)
 
Contents ©2016 Richard Cappels All Rights Reserved. Find updates at www.projects.cappels.org

First posted in April 2016. This is based on an original article that was published in Circuit Cellar magazine issue
#280.

You can send  email to me at projects(at)cappels.org. Replace "(at)" with "@" before mailing.


Use of information presented on this page is for personal, nonprofit educational and noncommercial use only. This material (including object files) is copyrighted by Richard Cappels and may not be republished or used directly for commercial purposes. For commercial license, click here.


  Liability Disclaimer and intellectual property notice
(Summary: No warranties, use these pages at your own risk. You may use the information provided here for personal and educational purposes but you may not republish or use this information for any commercial purpose without explicit permission.) I neither express nor imply any warranty for the quality, fitness for any particular purpose or  user, or freedom from patents or other restrictions on the rights of use of any software, firmware, hardware, design, service,information, or advice provided, mentioned,or made reference to in these pages. By utilizing or relying on software, firmware, hardware, design, service,information, or advice provided, mentioned, or made reference to in these pages, the user takes responsibility to assume all risk and associated with said activity and hold Richard Cappels harmless in the event of any loss or expense associated with said activity. The contents of this web site, unless otherwise noted, is copyrighted by Richard Cappels. Use of information presented on this site for personal, nonprofit educational and noncommercial use is encouraged, but unless explicitly stated with respect to particular material, the material itself may not be republished or used directly for commercial purposes. For the purposes of this notice, copying binary data resulting from program files, including assembly source code and object (hex) files into semiconductor memories for personal, nonprofit educational or other noncommercial use is not considered republishing. Entities desiring to use any material published in this pages for commercial purposes should contact the respective copyright holder(s).