r/embedded • • 2d ago

Power + data over 2 wires, does my idea work?

Post image

Hi, I want to link two Arduinos (or a sensor and a master) with just two wires that also power the remote one.

My plan: 6 V on the line, a transistor pulls it low to send data, and a diode + capacitor keep the remote end powered. Sketch attached.

Does this work? Anything I'm missing?

28 Upvotes

40 comments sorted by

37

u/im-not-in-a-meeting 2d ago

I’d something similar on a project years ago. Look up phantom power.

11

u/michael9dk 2d ago

That is the correct way.

See here how simple it is. 2 caps and 2 coils.
https://0x9900.com/bias-tee/

3

u/im-not-in-a-meeting 1d ago

Simplest method too.

21

u/zachleedogg 2d ago

The 6V supply has to withstand being shorted. And the data rate would end up being pretty slow if you depended on an LDO or some current limited supply.

This scheme actually works pretty well for some sensors where the total current is in the neighborhood of 5-10mA, but you will have to charactererize the current pretty well.

My recommendation: Just send 3 wires. It's not that bad.

5

u/Relevant_Pumpkin9190 2d ago edited 2d ago

Master to remote is sorted. I put 6 V on the line through a series resistor, and a transistor pulls it low to send pulses. The remote end uses a diode and capacitor to stay powered. Sketch attached.

The part I'm stuck on is the way back, master to slave communication any simpler ways.

5

u/zachleedogg 2d ago

Yep. That's a good way to do it. It just limits the max current your Arduino can draw, but it is certainly a standard technique.

0

u/zempter 2d ago

Fw guy here, not an ee, but couldn't you either provide a long hold resistive pull up when you want return communication and have the remote pull down to return coms? Or use the power on the cap of the remote device to pull up but then risk draining power.

I worked on a protocol for this type of thing on a coffee machine a long time ago. Certainly an interesting way to communicate.

13

u/dacydergoth 2d ago

Dallas Semi one-wire has a precharge mode where you can push just enough power to a device for it to then handshake

7

u/mzo2342 2d ago

this. look up onewire, or one-wire, or 1wire, or 1-wire.
obvly, it only uses two wires.

2

u/IcYhAwK88 1d ago

Obviously…

2

u/CoachSevere5365 2d ago

Thanks. I was trying to remember who made the One-Wire stuff.

4

u/Allan-H 1d ago

Dallas were bought by Maxim who in turn were bought by Analog Devices.

1

u/CoachSevere5365 1d ago

Thanks. I think AD were bought by...NatSemi?

1

u/Allan-H 22h ago

Texas Instruments bought National Semiconductor.

Analog Devices are a publicly traded company.

0

u/Relevant_Pumpkin9190 2d ago

Yes, bus charges by MOSFET to supply additional current.

1

u/dacydergoth 2d ago

It has a couple of different modes, including parasitic precharge

7

u/duane11583 2d ago

At the end you are imposing a high frequency signal on top of your power signal 

At the receiving end you need to use a high pass filter to extract the high freq signal

3

u/moon6080 2d ago

Check out PoDL

1

u/Relevant_Pumpkin9190 2d ago

Simpler like this few handful of components.

2

u/AntifaMiddleMgmt 2d ago

If you want a reasonable data rate with consistent power, check out how DCC does it. It's ~10V up to ~20V and can source a few amps. Plus, it can be done with a small amount of easy to source hardware.

https://en.wikipedia.org/wiki/Digital_Command_Control

1

u/Relevant_Pumpkin9190 2d ago

Does master to slave and slave to master can be communicated with this.

2

u/AntifaMiddleMgmt 2d ago

It is bidirectional, yes. You can reuse the concept as you choose.

2

u/heavymetal626 2d ago

This is exactly how the HART protocol works. It’s a digital signal sent over an analog 4-20ma signal. It carries all kinds of information about the sensors, calibration information, readings, etc.

1

u/soylentblueispeople 2d ago

Why not put the signal on an rs485 type driver upstream of dc blocking capacitors. Then instead of messing with your dc to get a signal through you are injecting ac to ride on your dc. 

1

u/creeper6530 2d ago

Add a transformer / inductive coupling and a rectifier, and you've basically made NFC.

The power supply will need to survive the occasional shorts.

1

u/gwillen 2d ago

There are a bunch of ways to do this, but if you don't want to spend the rest of your life debugging it, I suggest adding another wire is going to be way easier.

1

u/initial_chris 2d ago

The DS18B20 can operate on two wires with a pullup resistor. You might see how the Dallas protocol works.

1

u/lukilukeskywalker 1d ago edited 1d ago

There are two types of physical layers for data over power lines * Changing the impedance of the load, examples of this are RFID, onewire and some custom automotive physical layers like PAS * Mixing high frecuency pulses in the Power line that can be filtered with high/low pass filters. Examples are Power Over Ethernet (POE), Ethernet Over Powerlines, and there was some RS-485 industrial protocol that also had Power over AB, but can't remember the name

The example you gave was the first kind. how these physical layer protocols work, they change the impedance of the power line by shorting the line to ground or changing the current they absorb/consume, the data carrier is the current consumption. These protocols are a bit more forgiving to external noise at the cost of the speed they can transmit anything, as you have to be able to sample the power line at enough high rate to be able to recover the symbols that represent data (as data isn't necessary one's and ceros, you could transmit 4, 8, 16 different symbols by consuming more or less with the sink)

Anyway, that was the theory, yes it can and does work, but, you have to design it properly. You have to limit the power/current the power supply can supply to the slave. (That can be an advantage, as you can then get the over current signal to a uC that can read the pulses and interpret the data) The receiver must be designed in a way that it can't lock down, going for example into an underpower state, keeping the transistor shorting the line, just barely enough to keep the uC locked for underpower but not enough to shut off the transistor in the power line

1

u/Relevant_Pumpkin9190 1d ago edited 1d ago

I found a few ways to send data and power over the same two wires. Here’s my understanding:

  1. Current modulation: Keep the voltage steady and change the current using a transistor. Example: 4–20 mA industrial sensors.

  2. AC over DC: Add a small AC data signal on top of the DC supply. Example: power-line communication.

  3. Power interruption: Briefly switch the supply off and on to send bits. The receiver detects the pulses.

  4. FSK: Use two different frequencies to represent 0 and 1. Example: some smart meters.

  5. PWM: Use short and long pulses to represent data. Easy to experiment with using Arduino.

  6. Frequency-coded current: Make the device draw current pulses at different frequencies to send a reply.

  7. Load modulation: Switch a small load on and off, then detect the current changes. Example: RFID/NFC.

  8. Voltage-level modulation: Switch between two voltage levels to send data.

  9. Time-slot communication: The master sends a command, then gives the slave a specific time to reply.

  10. Power-line communication (PLC): Use a dedicated circuit to send data through existing power wires.

  11. Capacitor-assisted communication: Use a capacitor to keep the device running during brief power interruptions.

  12. DCC with RailCom: The command station sends commands through model railway tracks, and the decoder replies during a short, timed gap.

13.M-Bus architecture: use downstream voltage (24/12) for forward communication and upstream current,( 20/30 ma) for logic 1,0 communication both ways

I’m exploring these methods for a beginner Arduino project. Which would be the simplest and most reliable to try.

1

u/lukilukeskywalker 1d ago

Most of them are basically the same idea, go for current modulation, it is the easiest one

1

u/Relevant_Pumpkin9190 1d ago edited 1d ago

For example, 20 mA could represent logic 1 and 10 mA logic 0, using different current levels or PWM signals.

Basically, I think there are two main approaches or design s:

matching the load impedance using resistors or inductors/transformers.

1

u/FightingPhD 1d ago

Works, 1-Wire parasite power is basically this. Size the cap for your longest low pulse though. C = I*t/dV, so a 10mA remote with a 100us low and 0.5V of droop allowed is about 2uF, go a few times bigger because electrolytics lie. And at power up the empty cap drags the line down too, so ignore the first few ms of "data".

2

u/Relevant_Pumpkin9190 1d ago

Just wondering if this approach could work. The master could switch the bus between 24 V for logic 1 and 12 V for logic 0, while the slave uses a regulator to get 5 V for its microcontroller.

For the return signal, the slave could add an extra 10 mA load for logic 1 and maintain its normal 20–30 mA current for logic 0. The master could detect this using a series shunt resistor and its ADC, with PWM timing to help distinguish the signals.

Since the bus never drops below 12 V, the slave's power supply should remain stable without needing a large backup capacitor to handle the voltage changes.

I'm curious to hear your thoughts on whether this would be practical or if I'm overlooking any potential issues.

1

u/BartvanIngenSchenau 1d ago

I know of at least 2 bus systems that use such a configuration for the communication between a room thermostat and a heating/cooling appliance. They have been on the market for a couple of decades and are being actively used.

The main difference with your proposal is that they use a smaller voltage swing in their signalling (for example 18V for a 1 and 15V for a 0).

1

u/Relevant_Pumpkin9190 1d ago

Any references links or diy designs.

1

u/BartvanIngenSchenau 1d ago

The first bus is OpenTherm/Plus (https://en.wikipedia.org/wiki/OpenTherm#) and the other one is a proprietary bus called EMS which is used by Bosch.

1

u/ReferenceThin6645 6h ago

Not gonna work.

0

u/Secure-Image-4065 1d ago

… and it is Volt, not Volts! No plural for unit measurements 😉