Power and data thru 2 wires? - Page 1
Forum section: electronics / general

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 04, 2012, 03:50:40 am
content: Hey! There is a chance to transfer power and bidirectional data thru only 2 cables between 2 microcontrollers? I remember the times with analog phones where you had only 2 wires and the phone had a screen and it was certainly bidirectional.In my imagination I can see like 2 atmegas microcontroller, you use 6 to 4V and some kind of converter to logic levels (like mapping it to 3.3-0V range) for the RX, a 3.3V regulator for the power and the same line with a step up-DAC circuit as TX with some kind of protocol (to avoid collisions) but sounds fairy complex to do. Someone knows a simpler approach?I am making several DIY stuff I want to control (2 home made electric courtains, 1 global remote control, 1 coil in the power panel to measure the consumption of the house for now), so instead of using ethernet cable maybe I can use ultra thin and cheap phone cable for everything and a 1 dollar attiny in the endAny hint?

author: IanB
author_rank: Super Contributor
timestamp: August 04, 2012, 04:11:41 am
content: Well, sure. Power and data over two wires is exactly what telephone circuits do.You put a DC voltage on the wires to provide power, and then you superimpose a small AC data signal on top for communications.At the downstream end you can use a filter and regulator to draw clean power for the microcontroller, and separately read and demodulate the data signal for your commands. If you want bidirectional I think you can either use two different carrier frequencies for send and receive or you can use a protocol method where sender and receiver cooperate by using assert/free commands (a bit like speaking over a radio where you say "over" when done).

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 04, 2012, 04:56:34 am
content: A rather easy way to do it that doesn't require any Tiffany Yep DSP tricks is to put a DC voltage (like 12V) on the line through an impedance and switch in a current sink (with a current much larger than the total demand by the nodes) to transmit. Then use comparators to receive and detect collisions (if two current sinks switch on, the voltage would be abnormally low) and use the UARTs built into the microcontroller to interface to the bus.

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 04, 2012, 05:57:04 am
content: Quote from: NiHaoMike on August 04, 2012, 04:56:34 amin terms of components, what should I use to do a "current sink"? I don't quite understand what you wrote

author: SeanB
author_rank: Super Contributor
timestamp: August 04, 2012, 06:20:49 am
content: Simplest is a resistor and a switching transistor to give the increased current pulse. You supply the circuit via a resistor and use the voltage across the supply resistor to feed the comparator.

author: Chasm
author_rank: Regular Contributor
timestamp: August 04, 2012, 11:46:11 am
content: Take a look at the 1-wire protocol.

author: David_AVD
author_rank: Super Contributor
timestamp: August 04, 2012, 12:45:39 pm
content: A quick Google search came up with this link:http://www.eetimes.com/design/automotive-design/4230494/Combine-power-feed-and-data-link-via-cable-for-remote-peripheralsThere's probably more to be found by searching something like "superimpose data dc power" or such.

author: HardBoot
author_rank: Regular Contributor
timestamp: August 04, 2012, 06:30:24 pm
content: I have done AC(square not sine) which flips based on a binary stream, ok for low bit rates, device needs a clock, rectify to get power, and a clock shift to get data.Then there's the more normal phone line way of dc power with ac signal applied to the lie, you can separate the signal with a cap and dc with a filter/diode.

author: David_AVD
author_rank: Super Contributor
timestamp: August 04, 2012, 11:53:37 pm
content: Some more ideas:http://electronicdesign.com/article/power/two-wires-carry-power-and-data21768http://www.maxim-ic.com/app-notes/index.mvp/id/1863

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 05, 2012, 12:46:48 am
content: Thanks for the ideas! it seems onewire is a good alternative but may I need another wire just to be sure, so 3 wires per microcontroller gnd-vcc-data, the other options seems a bit difficult for my electronic knowledge

author: David_AVD
author_rank: Super Contributor
timestamp: August 05, 2012, 12:53:49 am
content: Data over power can be a bit tricky, especially if the remote end needs a reasonable amount of current to operate. A separate data wire will be much easier if you're at the beginner end of the scale.

author: nctnico
author_rank: Super Contributor
timestamp: August 05, 2012, 12:55:10 am
content: A very common way is to modulate current on one side and the voltage on the other. This spec shows such a system:http://www.domoticaforum.eu/uploaded/Ard%20M/Opentherm%20Protocol%20v2-2.pdfOpentherm uses Manchester coding but within limits it is possible to use a UART. Most UARTs have filters against too short or too long pulses so there is some protection against noise on the line. If the electronics are good enough you can also use full-duplex communication.

author: tramjoe
author_rank: Regular Contributor
timestamp: August 12, 2012, 08:15:06 am
content: Depending on your application, if you need high transfer rates (aka not serial port), you can also look at BPL chips and how they work (up to around 400 Mbps), standard for ethernet over mains, probably overkill for your needa..Other existing protocols that might work would be X10 (standard in domotics) and UPB.Those are more targeted at mains transport, but I thought I would post the links anyway because you did not explicitely said you needed low-voltage dedicated DC lines between your devices ;-)

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 14, 2012, 07:13:29 pm
content: Due the suggestions I decided to use 3 wires (4 wires in fact). I found a telephone cable with 4 thin wires. I measured the resistance:cable length: 29,9 mtred, black=14.91 ohm <- only 1 wire insidegreen, white= 17.3 ohm <- multiple thin wires insideI was not able to find what type of cable I have (some phone cable protocols seems similar like 4P4C). So my idea is mainly:1 wire GND1 wire VCC 5V (from an old PC supply)1 wire 12V (pc supply)1 wire for data in one-wire protocol (rx-tx together)Can someone give me a hint on what cable use for what?I want to power 2 small motors (12V with a buck converter -> 7V for each courtain, and about 6 attinys as nodes for sensors with the 5V around the house) Will a remote supply be stable to keep everything working well? or should I use individual regulators per node/ or some middle "repeater"?The motors:http://www.ebay.com/itm/6V-60RPM-Worm-DC-Reducer-Gear-Motor-2KG-CM-Shaft-D-6mm-Plastic-Self-Locking-/221101613890?pt=LH_DefaultDomain_0&hash=item337aaee342Are nice, strong, self locking and very quiet!Thanks!

author: NiHaoMike
author_rank: Super Contributor
timestamp: August 16, 2012, 05:09:49 am
content: I would suggest RS-485 or CAN. They are specifically designed to work over long distances with multiple nodes on the bus.

author: Unknown
author_rank: Unknown
timestamp: August 16, 2012, 06:59:27 am
content: Quote from: Erwin Ried on August 14, 2012, 07:13:29 pmSounds a little like you are reinventing the wheel here. Why not look atPOEat 48V you can send a reasonable quantity of power via tiny cable. The cable is popular and subsequently cheap, particularly CAT5e! The extra cores will halve the resistance of power runs when used in parallel.

author: tramjoe
author_rank: Regular Contributor
timestamp: August 16, 2012, 07:23:25 am
content: Quote from: Uncle Vernon on August 16, 2012, 06:59:27 amAhem, the OP started by saying "instead of using ethernet cable maybe I can use ultra thin and cheap phone cable for everything and a 1 dollar attiny in the end ". So apparently this is not the option he wants....

author: Unknown
author_rank: Unknown
timestamp: August 16, 2012, 07:37:22 am
content: Quote from: tramjoe on August 16, 2012, 07:23:25 amThat's nice for you Sherlock! Perhaps then you can explain how not using Ethernet cable is going to provide any advantage for the application suggested? Sure if you are trying to make use of an existing run you could look into 2 core options, but I'm yet to see any suggestion that only 2 wires would be cheaper, easier, or more effective. The stage is yours.... awaiting your reply.

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 16, 2012, 09:30:24 am
content: Hahah chill out Uncle Vernon (poor harry!)Well I discarded the 2 wire solution and I was just asking some electrical advice about the cables. Having 5V per 1 wire seems very nice to me because if voltage is stable for 5 usd I can have 30 meters of cable + 3 attinys (without regulators or other circuit) sensing things.My main purpose is to energize 2 small motors with an attiny+hall bipolar sensor to control 2 homemade courtains.

author: tramjoe
author_rank: Regular Contributor
timestamp: August 16, 2012, 09:35:05 am
content: Quote from: Uncle Vernon on August 16, 2012, 07:37:22 amOK, so I am just pointing out here what the OP said he wanted to do and avoid. Have you taken your pills recently ? I guess not. Take a cold shower or something man, you seem to need it.

author: Unknown
author_rank: Unknown
timestamp: August 16, 2012, 09:43:28 am
content: Quote from: tramjoe on August 16, 2012, 09:35:05 amSorry but I will politely refuse taking part in any fetish activity that you may have had in mind. Happy pointing!

author: Unknown
author_rank: Unknown
timestamp: August 16, 2012, 09:50:55 am
content: Quote from: Erwin Ried on August 16, 2012, 09:30:24 amHave you done your sums on volt drop. They'd want to be very low current motors or relatively large(=expensive) conductors if you are hoping to still see 5V at the far end of the cable.QuoteYeah I get that. Most things are possible, practical is a tad more restrictive. Let us know your results.

author: tramjoe
author_rank: Regular Contributor
timestamp: August 16, 2012, 11:05:13 am
content: Quote from: Uncle Vernon on August 16, 2012, 09:43:28 amI am impressed, you must have taken one of those online humor writing course, haven't you ?

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 16, 2012, 01:21:09 pm
content: how about usb cable? 4 core and... shieldednovel though, so you will not find it in any thesisor using local power supply at the motor/load location and only remotely send data signal? YMMV. i'm only brainstorming

author: T4P
author_rank: Super Contributor
timestamp: August 16, 2012, 01:43:14 pm
content: 30m ... even AWG22 will give loads of resistance, Cat5e is AWG 22

author: ColinB
author_rank: Contributor
timestamp: August 16, 2012, 01:43:36 pm
content: Quote from: Mechatrommer on August 16, 2012, 01:21:09 pmWhat benefit would USB cable have over CAT5e UTP? For starters, you can be CAT5e in bulk very inexpensively, while USB cable is very rarely sold or used in bulk form, only as finished cables. Perhaps the USB cable would have heavier gauge power conductors, but that's the only advantage I can imagine, and you'd need to determine this for certain ahead of time. CAT5e is 24-26 AWG (I usually see 24 AWG) but CAT6 is supposed to be 22-24 AWG according toWikipedia.Actually I think you could easily get away with using CAT5, especially if you bond a couple of pairs together for power/ground to decrease resistance. I would also dedicate one pair for MCU power+ground, and other pair(s) for motor power+ground, to prevent the digital supply from getting noise and voltage drop due to the motor.CAT5 conductor resistance isspecifiedas less than or equal to 0.188 ohms/m. Therefore if you have a 30 meter run, and your motor takes 0.2 A, that is about a 1.13 V drop. At 5 V, this is not great, but if you bond a couple of pairs together for motor power and return, it will decrease significantly. Also, you could use a 12 V motor and use higher voltages with lower currents to decrease power loss, if you aren't stuck using a 5 V motor.

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 16, 2012, 08:49:00 pm
content: Quote from: T4P on August 16, 2012, 01:43:14 pmI tested the cable I got and:cable length: 29,9 mtred, black=14.91 ohm <- only 1 wire insidegreen, white= 17.3 ohm <- multiple thin wires insideIt is bad? or good? I am very weak in any electronic concept

author: SeanB
author_rank: Super Contributor
timestamp: August 16, 2012, 09:15:49 pm
content: Normal range for a random data cable. To drive a curtain you need a motor and gearbox that will run off a minimum of 12V at 1A, 2A or more at switch on. Either you use a thicker cable, or you send 48V down the cable and use a DC-Dc converter at the other end to make a 12V supply, and use enough input capacitor at the remote end to handle the switching surge.

author: Erwin Ried
author_rank: Regular Contributor
timestamp: August 16, 2012, 09:22:59 pm
content: OK Thanks!, the motors are very small, typical toy motor but with the worm gearbox they are very strong, silent and self locking, I have tested them in my supply bench:no load = 0.03A 7Vfull load = 0.22A 7VSo as I had 4 cables, one carrying 5V to the uC + one carrying 7-9V for the motors seems good solution even for 30 meters, right?? (it is like 2 meters from 1 courtain and 14 meters from the other one + 14 meters for a first floor sensor)

author: David_AVD
author_rank: Super Contributor
timestamp: August 16, 2012, 09:32:02 pm
content: You really need to use a higher voltage down the cable and a DC-DC converter to get your low voltage (and impedance) for motor and logic. The voltage drop (in the cable) is going to be cause havoc with the system otherwise.Even if you accept that you will lose a couple of volts in the motor V+ wire, the common (to logic and motor) V- wire will also have a similar drop on it. This will affect the 5V supply and shift the logic reference to boot!

author: Unknown
author_rank: Unknown
timestamp: August 16, 2012, 09:48:42 pm
content: Quote from: Erwin Ried on August 16, 2012, 08:49:00 pm220mA across 17.3? = 3.8V so your 7V motor will be getting 3.2V under load less at start-up. You could jack the supply voltage up but that will create other issues as your current requirement varies with load.Your options are either to sulk like that tram guy or look at alternative arrangements. With a 24V supply you will still have 20.2V across the cable at the same current. See why they go to all that trouble of using regulators or DC/DC converters?

author: Unknown
author_rank: Unknown
timestamp: August 17, 2012, 12:55:10 am
content: Quote from: tramjoe on August 16, 2012, 11:05:13 amOf course you are! I'm Way impressive!QuoteHell no! Just natural skill, talent, charm and ability.