Author Topic: Power and data thru 2 wires?  (Read 25362 times)

0 Members and 1 Guest are viewing this topic.

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Power and data thru 2 wires?
« on: August 04, 2012, 03:50:40 am »
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 end :D

Any hint?
My website: http://ried.cl
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 12367
  • Country: us
Re: Power and data thru 2 wires?
« Reply #1 on: August 04, 2012, 04:11:41 am »
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).
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9207
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Power and data thru 2 wires?
« Reply #2 on: August 04, 2012, 04:56:34 am »
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.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Re: Power and data thru 2 wires?
« Reply #3 on: August 04, 2012, 05:57:04 am »
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.

in terms of components, what should  I use to do  a "current sink"? I don't quite understand what you wrote  :(
My website: http://ried.cl
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16362
  • Country: za
Re: Power and data thru 2 wires?
« Reply #4 on: August 04, 2012, 06:20:49 am »
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.
 

Offline Chasm

  • Regular Contributor
  • *
  • Posts: 211
Re: Power and data thru 2 wires?
« Reply #5 on: August 04, 2012, 11:46:11 am »
Take a look at the 1-wire protocol.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2862
  • Country: au
Re: Power and data thru 2 wires?
« Reply #6 on: August 04, 2012, 12:45:39 pm »
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-peripherals

There's probably more to be found by searching something like "superimpose data dc power" or such.
 

Offline HardBoot

  • Regular Contributor
  • *
  • Posts: 160
  • Country: ca
Re: Power and data thru 2 wires?
« Reply #7 on: August 04, 2012, 06:30:24 pm »
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.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2862
  • Country: au
 

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Re: Power and data thru 2 wires?
« Reply #9 on: August 05, 2012, 12:46:48 am »
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 :)
My website: http://ried.cl
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2862
  • Country: au
Re: Power and data thru 2 wires?
« Reply #10 on: August 05, 2012, 12:53:49 am »
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.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27903
  • Country: nl
    • NCT Developments
Re: Power and data thru 2 wires?
« Reply #11 on: August 05, 2012, 12:55:10 am »
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.pdf

Opentherm 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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline tramjoe

  • Regular Contributor
  • *
  • Posts: 50
Re: Power and data thru 2 wires?
« Reply #12 on: August 12, 2012, 08:15:06 am »
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 ;-)
« Last Edit: August 12, 2012, 08:16:48 am by tramjoe »
 

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Re: Power and data thru 2 wires?
« Reply #13 on: August 14, 2012, 07:13:29 pm »
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 mt
red, black=14.91 ohm <- only 1 wire inside
green, white= 17.3 ohm <- multiple thin wires inside

I 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 GND
1 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=item337aaee342 Are nice, strong, self locking and very quiet!

Thanks!

My website: http://ried.cl
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9207
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Power and data thru 2 wires?
« Reply #14 on: August 16, 2012, 05:09:49 am »
I would suggest RS-485 or CAN. They are specifically designed to work over long distances with multiple nodes on the bus.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Uncle Vernon

  • Guest
Re: Power and data thru 2 wires?
« Reply #15 on: August 16, 2012, 06:59:27 am »
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?

Sounds a little like you are reinventing the wheel here. Why not look at POE at 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.

 

Offline tramjoe

  • Regular Contributor
  • *
  • Posts: 50
Re: Power and data thru 2 wires?
« Reply #16 on: August 16, 2012, 07:23:25 am »
Sounds a little like you are reinventing the wheel here. Why not look at POE at 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.

Ahem, 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....
 

Uncle Vernon

  • Guest
Re: Power and data thru 2 wires?
« Reply #17 on: August 16, 2012, 07:37:22 am »
Ahem, 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....
That'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.
 

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Re: Power and data thru 2 wires?
« Reply #18 on: August 16, 2012, 09:30:24 am »
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.
My website: http://ried.cl
 

Offline tramjoe

  • Regular Contributor
  • *
  • Posts: 50
Re: Power and data thru 2 wires?
« Reply #19 on: August 16, 2012, 09:35:05 am »
Ahem, 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....
That'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.

OK, 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.
 

Uncle Vernon

  • Guest
Re: Power and data thru 2 wires?
« Reply #20 on: August 16, 2012, 09:43:28 am »
OK, 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.
Sorry but I will politely refuse taking part in any fetish activity that you may have had in mind. Happy pointing!  ;)
 

Uncle Vernon

  • Guest
Re: Power and data thru 2 wires?
« Reply #21 on: August 16, 2012, 09:50:55 am »
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.
Have 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.

Quote
My main purpose is to energize 2 small motors with an attiny+hall bipolar sensor to control 2 homemade courtains.
Yeah I get that. Most things are possible, practical is a tad more restrictive. Let us know your results.
 

Offline tramjoe

  • Regular Contributor
  • *
  • Posts: 50
Re: Power and data thru 2 wires?
« Reply #22 on: August 16, 2012, 11:05:13 am »

Sorry but I will politely refuse taking part in any fetish activity that you may have had in mind. Happy pointing!  ;)

I am impressed, you must have taken one of those online humor writing course, haven't you ?  ;D
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11713
  • Country: my
  • reassessing directives...
Re: Power and data thru 2 wires?
« Reply #23 on: August 16, 2012, 01:21:09 pm »
how about usb cable? 4 core and... shielded 8) novel though, so you will not find it in any thesis :P or using local power supply at the motor/load location and only remotely send data signal? YMMV. i'm only brainstorming ;)
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline T4P

  • Super Contributor
  • ***
  • Posts: 3697
  • Country: sg
    • T4P
Re: Power and data thru 2 wires?
« Reply #24 on: August 16, 2012, 01:43:14 pm »
30m ... even AWG22 will give loads of resistance, Cat5e is AWG 22
 

Offline ColinB

  • Contributor
  • Posts: 26
Re: Power and data thru 2 wires?
« Reply #25 on: August 16, 2012, 01:43:36 pm »
how about usb cable? 4 core and... shielded 8) novel though, so you will not find it in any thesis :P or using local power supply at the motor/load location and only remotely send data signal? YMMV. i'm only brainstorming ;)
What 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 to Wikipedia.

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 is specified as 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.
 

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Re: Power and data thru 2 wires?
« Reply #26 on: August 16, 2012, 08:49:00 pm »
30m ... even AWG22 will give loads of resistance, Cat5e is AWG 22

I tested the cable I got and:

cable length: 29,9 mt
red, black=14.91 ohm <- only 1 wire inside
green, white= 17.3 ohm <- multiple thin wires inside

It is bad? or good? I am very weak in any electronic concept
My website: http://ried.cl
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16362
  • Country: za
Re: Power and data thru 2 wires?
« Reply #27 on: August 16, 2012, 09:15:49 pm »
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.
 

Offline Erwin RiedTopic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: no
Re: Power and data thru 2 wires?
« Reply #28 on: August 16, 2012, 09:22:59 pm »
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 7V
full load = 0.22A 7V

So 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)
My website: http://ried.cl
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2862
  • Country: au
Re: Power and data thru 2 wires?
« Reply #29 on: August 16, 2012, 09:32:02 pm »
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!
 

Uncle Vernon

  • Guest
Re: Power and data thru 2 wires?
« Reply #30 on: August 16, 2012, 09:48:42 pm »
30m ... even AWG22 will give loads of resistance, Cat5e is AWG 22

I tested the cable I got and:

cable length: 29,9 mt
red, black=14.91 ohm <- only 1 wire inside
green, white= 17.3 ohm <- multiple thin wires inside

It is bad? or good? I am very weak in any electronic concept

220mA 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?
 

Uncle Vernon

  • Guest
Re: Power and data thru 2 wires?
« Reply #31 on: August 17, 2012, 12:55:10 am »
I am impressed
Of course you are! I'm Way impressive!

Quote
you must have taken one of those online humor writing course, haven't you ?  ;D
Hell no! Just natural skill, talent, charm and ability.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf