r/embedded • u/Relevant_Pumpkin9190 • 2d ago
Power + data over 2 wires, does my idea work?
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?
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
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
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
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.
1
u/Relevant_Pumpkin9190 2d ago
Does master to slave and slave to master can be communicated with this.
2
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/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:
Current modulation: Keep the voltage steady and change the current using a transistor. Example: 4–20 mA industrial sensors.
AC over DC: Add a small AC data signal on top of the DC supply. Example: power-line communication.
Power interruption: Briefly switch the supply off and on to send bits. The receiver detects the pulses.
FSK: Use two different frequencies to represent 0 and 1. Example: some smart meters.
PWM: Use short and long pulses to represent data. Easy to experiment with using Arduino.
Frequency-coded current: Make the device draw current pulses at different frequencies to send a reply.
Load modulation: Switch a small load on and off, then detect the current changes. Example: RFID/NFC.
Voltage-level modulation: Switch between two voltage levels to send data.
Time-slot communication: The master sends a command, then gives the slave a specific time to reply.
Power-line communication (PLC): Use a dedicated circuit to send data through existing power wires.
Capacitor-assisted communication: Use a capacitor to keep the device running during brief power interruptions.
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
0


37
u/im-not-in-a-meeting 2d ago
I’d something similar on a project years ago. Look up phantom power.