Data over Power Line

I have a project where I need multiple devices and they can only connect over an existing 2-wire connection. The environment is not conducive to RF communication (grounded metal boxes) so I have been looking for ways to transmit data over the power liine.

I keep coming back to 2-wire RS485 (but it really needs 3 cables as a common ground is also required). I found a chip that looked very easy to use that provided UART and DC over a 2-wire connection, but there are no authorised retailers and the manufacturer would only entertain an order of 10,000 units.

The requirement in this project for communication is small and only short bursts so half-duplex is sufficient.

After considerable research and many dead-ends I found a page about a positive biased diode clamp circuit and with a little experimenting came up with the schematic in the attached image. The top schematic shows the MASTER (the unit from which the power will originate) and the bottom one SLAVE. The idea is to chain up to 3, maybe 4 slaves from one master. The 2-core wire runs between OUT/IN connectors.

I am left with some questions though, partly because I don’t fully understand exactly what I’ve done here! I have proved the concept, by removing the Arduinos and hooking a function generator to what would have been D4 at one end and my scope on what would be D3 at the far end and I can see the signal. I can do it in reverse too.

  • Is there anything I can do to simplify the circuit further? Could I “transmit” from D4 as well as “listen” on it for example? (Only planning half duplex so can’t send and receive at the same time anyway)
  • Will the connection at D3/D4 rise above 5v and damage the Arduino? Do I need to add a transistor here to protect them? (I used 12v as the carrier to minimise the impact of voltage drop over the cable)
  • Have I missed anything glaringly obvious that would stop this working?

My background is coding, I haven’t really ventured much into analogue electronics before, so please be patient if I’ve either just re-invented the wheel or make a complete mess!

Obviously this needs appropriate code with an appropriate OOK/ASK protocol to actually do anything, the purpose of this thread is simply to confirm the theory of the physical layer.

Look forward to the words of wisdom, thank you!

What led you to believe RS-485 requires a ground?

Paul

A number of things led me to believe that I may need more than 2 cores. Primarily this article https://store.chipkin.com/articles/rs485-rs485-cables-why-you-need-3-wires-for-2-two-wire-rs485 but there were others too. Many example schematics on Google also included a common ground as well as the A and B wires.

Is that not the case when deriving the power for the slave from the data bus?

yknivag: Is that not the case when deriving the power for the slave from the data bus?

Please explain! I have never ever seen such a thing in all my years data communication consulting.

Paul

Yes you can use one pin for both transmit and receive. The pinMode() function can be called at any time (thousands of times per second) and isn't "special" to the setup() function.

I would like to see that the 12V wire is absolutely "clean" of any other interference. A big capacitor and a small one on the input side will block high and low frequencies coming from the power source. Maybe even add an inductor. This will also help from propagating your data signals back to the power supply, which might cause it to react in an undesirable way.

I would start looking into how other industrial protocols work. This is not a unique problem. It has been solved before, in many different ways. A "simple" analog instrument using the 4-20mA current-loop system is powered from the loop. This is usually low-bandwidth data but could be used for digital data equally well at medium to low baud rates.

“Real” data-over-powerline uses a carrier frequency. Baby monitors and other domestic devices do this. The regular power transformers out in the street block that frequency. So maybe something based on a 38kHz infrared transmitter could work?

Paul_KD7HB: What led you to believe RS-485 requires a ground? Paul

For equipment with same the ground and little ground potential difference, 2 wires work.

In situations where this is not true, add a GND wire.

Paul_KD7HB:
Please explain! I have never ever seen such a thing in all my years data communication consulting.

Paul

What would you like me to explain? That you can transmit both data and power on the same line? Or that I posted an article which advises that devices which do not necessarily share a ground potential require 3 wires for 2-wire RS485?

MorganS: Yes you can use one pin for both transmit and receive. The pinMode() function can be called at any time (thousands of times per second) and isn't "special" to the setup() function.

Yes I know I can switch the state of the pin in real time. The question was will the same analogue circuit (the capacitor/diode/resistor) that I have for receive also push the data onto the power?

MorganS: I would like to see that the 12V wire is absolutely "clean" of any other interference. A big capacitor and a small one on the input side will block high and low frequencies coming from the power source. Maybe even add an inductor. This will also help from propagating your data signals back to the power supply, which might cause it to react in an undesirable way.

The system is battery powered so there ought to be no noise on the 12v supply, I've added decoupling before and after each regulator to ensure that the supply to the Arduino is smooth. Obviously I cannot smooth the power/data bus.

MorganS: I would start looking into how other industrial protocols work. This is not a unique problem. It has been solved before, in many different ways. A "simple" analog instrument using the 4-20mA current-loop system is powered from the loop. This is usually low-bandwidth data but could be used for digital data equally well at medium to low baud rates.

Protocol isn't a problem, there are many half-duplex protocols I could use. It's the physical circuitry of adding the data to the power that I'm really interested in.

MorganS:
“Real” data-over-powerline uses a carrier frequency. Baby monitors and other domestic devices do this. The regular power transformers out in the street block that frequency. So maybe something based on a 38kHz infrared transmitter could work?

I’ve seen examples of each. I’m keen to keep this as simple as possible with as low a component count and as low a power draw as possible. When coupling data to AC (like baby monitors, network extenders, X10 and the like) obviously you have a carrier frequency but many of those tend to use Frequency Shift Keying (FSK) rather than simple On Off Keying (OOK).

yknivag: When coupling data to AC (like baby monitors, network extenders, X10 and the like) obviously you have a carrier frequency but many of those tend to use Frequency Shift Keying (FSK) rather than simple On Off Keying (OOK).

Maybe the original poster has done it already --- but if not, then needs to be specified details about where the transmitters and the receivers are located - and what is between them ---- eg.... electrical lines only, or with transformers and switchboards etc in between. And what distance - length of wiring etc. The powerline communications used in ethernet are relatively wideband. Also, something to think about maybe is what's the impedance of the network seen by the transmitter at the various frequencies.

It is in the schematic: the power line under discussion is 12V DC

Paul_KD7HB: What led you to believe RS-485 requires a ground?

Paul

The standard, the datasheets for RS485 chips, the wiring connections for RS485 cables...

yknivag: - Is there anything I can do to simplify the circuit further? Could I "transmit" from D4 as well as "listen" on it for example? (Only planning half duplex so can't send and receive at the same time anyway)

There are various issues with the method that need addressing first. Primarily we don't know the characteristic impedance of the cabling, and the circuit doesn't understand transmission lines.

Secondly you normally cannot run voltage regulators stably without an input capacitor, which would short out your ac path completely.

  • Will the connection at D3/D4 rise above 5v and damage the Arduino? Do I need to add a transistor here to protect them? (I used 12v as the carrier to minimise the impact of voltage drop over the cable)

The voltage could easily rise above 5V due to signal reflections as there is no termination resistor.

  • Have I missed anything glaringly obvious that would stop this working?

An understanding of transmission line behaviour...

However it may be that your cabling runs are very short and you don't need to worry about transmission line behaviour.

You basic approach is to make the +ve supply rail see a high impedance at DC, by treating the voltage regulators as constant-current sinks.

This assumes the loads don't vary - this is unlikely to be the case I suggest, so the regulators (even without an input stability cap) will act as complex loads of varying impedance.

The way to fix this is to isolate the rail from the regulators at AC frequencies with a suitable RFC. Then you can have the input capacitors on the regulators and they will be happy, and the signalling will not see the impedance of the regulators (so long as the frequencies are high enough).

At AC you ideally want to drive the rail as a transmission line, so a 100 ohm load(*) or so at each end of the run at AC (ie 100 ohms in series with a DC-blocking cap).

Then you AC couple to this at 50 ohms impedance to transmit (because at any point along the line you see 100 ohms in each direction, thus in parallel from the transmitter's point of view) When not transmitting the 50 ohm drive needs to be disconnected from the cable to avoid loading it down.

For short cable runs you might not need to impedance match, so long as the wavelength of your communication pulses is very much larger than the length of the cables. You should protect Arduino input pins with schottky diodes to 0V and 5V to handle any over-voltage reflected pulses.

You also need some current limiting on the output pins so they don't see a complete short at AC and burn out. Perhaps 100 to 150 ohms in series with output pins.

(*) most twisted pair cables have a characteristic impedance in the 90 to 120 ohms range.

Firstly, thank you for your very comprehensive reply. Please forgive my ignorance but I’m not sure I fully understand most of it! I have relatively little experience of analogue electronics (which is essentially what this is).

MarkT:
There are various issues with the method that need addressing first. Primarily we don’t know the characteristic
impedance of the cabling, and the circuit doesn’t understand transmission lines.

The cabling will vary between nodes (the intention is to attach these to unspecified cabling that already exists) but the runs will be relatively short (typically <10m)

MarkT:
Secondly you normally cannot run voltage regulators stably without an input capacitor, which would short out your ac path completely.The voltage could easily rise above 5V due to signal reflections as there is no termination resistor.

I have input caps on the regulators in the schematic and on my breadboard mock up and they seem to be working well. As I understand it the diode between the transmission line and the Vin of the regulator is there to prevent the input cap from smoothing the data signal. I have those caps in place and they are not stopping the data.

MarkT:
An understanding of transmission line behaviour…

However it may be that your cabling runs are very short and you don’t need to worry about transmission
line behaviour.

Typically less than 10m. The redundant cabling that these will be attached to two parallel 1mm2 insulated copper conductors.

MarkT:
You basic approach is to make the +ve supply rail see a high impedance at DC, by treating the voltage regulators as constant-current sinks.

This assumes the loads don’t vary - this is unlikely to be the case I suggest, so the regulators (even
without an input stability cap) will act as complex loads of varying impedance.

The way to fix this is to isolate the rail from the regulators at AC frequencies with a suitable RFC. Then you
can have the input capacitors on the regulators and they will be happy, and the signalling will not see the
impedance of the regulators (so long as the frequencies are high enough).

RFC? (Radio Frequency Choke?) I’m presuming the current diode and capacitor in series with the regulator attached at the junction between the two is insufficient filtering then? I’ve seen many people attempt this using common mode chokes as a filter but they have invariably run into problems with noise being coupled back through the choke to the data line. Where would I put the RFC?

MarkT:
At AC you ideally want to drive the rail as a transmission line, so a 100 ohm load(*) or so at each end of the run at AC (ie 100 ohms in series with a DC-blocking cap).

Then you AC couple to this at 50 ohms impedance to transmit (because at any point along the line you see 100 ohms in each direction, thus in parallel from the transmitter’s point of view) When not transmitting the 50 ohm drive needs to be disconnected from the cable to avoid loading it down.

Would this be in addition to the 1MOhm resistor across the transmission lines at each node?

MarkT:
For short cable runs you might not need to impedance match, so long as the wavelength of your communication pulses is very much larger than the length of the cables. You should protect Arduino input pins with schottky diodes to 0V and 5V to handle any over-voltage reflected pulses.

How short is short though? I’m not trying to run this over 1km (like RS485) I’m looking at 10, maybe 15m. Though it won’t be using twisted pair cabling!

MarkT:
You also need some current limiting on the output pins so they don’t see a complete short at AC and burn out. Perhaps 100 to 150 ohms in series with output pins.

That makes a lot of sense. I guess that wouldn’t hurt on the “input” pin either?

Once again, thank you so much for your reply, and I’m sorry for the dumb questions! I think I have a lot more to learn during this project…

"Short" was quite clearly linked to the wavelength. If you are using this at 115200 baud or slower then the wavelength is beyond hundreds of km.

I didn't understand "RFC" either.

MorganS: "Short" was quite clearly linked to the wavelength. If you are using this at 115200 baud or slower then the wavelength is beyond hundreds of km.

I'm only wanting to send about 8 bytes of data probably no more often than hourly so I don't think anything over 9600bps is a requirement for me.

MorganS: I didn't understand "RFC" either.

A Google search for RFC revealed lots of pictures of simple chokes, so I'm guessing a simple an inductor (I've seen other circuits for this kind of application with inductors for filtering, but am unsure where it needs to go in my circuit.

Originally I'd wanted to use the BSC6823 (http://www.bestrong-ele.com/article.html) but sadly it isn't available anywhere (at least not in small quantities).

yknivag:
I have input caps on the regulators in the schematic and on my breadboard mock up and they seem to be working well. As I understand it the diode between the transmission line and the Vin of the regulator is there to prevent the input cap from smoothing the data signal. I have those caps in place and they are not stopping the data.

OK, so further testing shows that if I increase the size of the input cap on the regulator on the slave (C5) then the strength of the data signal drops from 5v peak to peak to only 1v peak to peak, However changing the input cap on the regulator for the master (C1) then there is no effect (presumably because of D1?

So the question is how do I isolate the regulation of the derived supply in the slave from the P/D carrier? It needs to be something around where D3 is in the schematic, Mark T suggested an “RFC” (which I think I understand to be an inductor) but exactly how would it connect?

However testing has shown that I can use a single pin/circuit for transmit and receive so I have simplified that part of the circuit a little.

I am testing with a 1kHz square wave and see a relatively clean square coming out (although I am using a very short test cable).

I’ve attached a revised schematic (ultimately the slaves will be ATTiny85 rather than Nano, that’s just shown for the test)…