Protocol for low rate data over a single wire - Page 1
Forum section: electronics / beginners

author: cowana
author_rank: Frequent Contributor
timestamp: October 09, 2014, 09:22:23 am
content: I'm developing a driver board to control several channels of high power LEDs. This board will consist of several constant current regulators for the LEDs, and a microcontroller to PWM them. The board will get the required PWM levels from a controller located seperatly (and controlling multiple driver boards).For interests of cost, I want to use regular 3-core mains cable to connect the lights to the central controller. With GND and +24v on two wires, this leaves one wire for the (single direction) comms from the controller to the light. The distance is likely to be up to 20 meters. The data being sent is low (around 6 bytes per update) - but to maximise expandability it would be nice to be able to send packets at around 50Hz (which translates to around 2400 baud).If I had both the controller and driver on a single board, I would use standard TTL serial to communicate between them. Ideally for this distance I would like to use RS485 - however this isn't possible due to being restricted to one wire (plus ground).I would imagine the best solution for my application is standard serial coding, but with something more noise resistant than 3.3v logic level serial. Would +12v/-12v RS232 levels be more suited? 0v/+24v levels? Have a load resistor at the driver to use current signaling (say 0mA/20mA levels)?The environment is not particularly electrically noisy - however the 0v/24v wires in the cable may well have a slightly pulsed current in it due to the switching nature of the driver.Cheers,Andy

author: Unknown
author_rank: Unknown
timestamp: October 09, 2014, 09:58:00 am
content: I can only say what I'd consider doing in the same situation, which may not be the best solution, I've only just started doing this stuff myself. Personally, I'd pull the data line up to your highest voltage available, say 24V via a resistor, then pull that line to ground at the transmission end with a transistor to create a binary data stream. Then a comparator (high voltage one) on the receiving end to shift the 24V/0V to 3.3V/0V using a 12V reference threshold and a large amount of hysteresis to deal with any possible noise induced in to the data line by the power line. Also has the advantage of being bi-directional in case the need ever arises.

author: fcb
author_rank: Super Contributor
timestamp: October 09, 2014, 09:59:42 am
content: I'd write my own protocol personally. Signal the data line at something like 0 & 12V, and use a zener diode & potential divider on the receive pin of the micro (4K7 & 47K - use the zener to prevent over voltage). Run the protocol as slow as possible BUT allow for a >15bit period pause between packets so your receiver can sync easily to the data.Alternatively look at LIN.

author: David_AVD
author_rank: Super Contributor
timestamp: October 09, 2014, 10:21:07 am
content: I'd probably go with the system Boltar is suggesting. The comparator receiver should work well and is cheap.I would use a beefy than required NPN transistor or MOSFET (say 2A rated) to sink the current and add a 100mA polyswitch in series with the outgoing data line. This will give the driver stage protection against a short to the +24V line.

author: mikerj
author_rank: Super Contributor
timestamp: October 09, 2014, 01:10:11 pm
content: Sounds like the open drain bi-directional single wire interface used in e.g. ISO9141 would fit the bill at the physical level. A simple protocol with a fixed frame length makes decoding easy and reliable.

author: cowana
author_rank: Frequent Contributor
timestamp: October 09, 2014, 01:18:34 pm
content: Thanks for the suggestions - as mikerj summed up, that open drain scheme sounds best (and does allow future expansion of bidirectional comms).Does it matter which end of the bus the pullup resistor is on? It seems if it is at the remote device end then any voltage drop/fluctuation along the length of the power wire will be coupled onto the data wire. However, if the pullup is at the master controller end, it's basically a long wire only connected at one end - and could like an aerial and pick up noise from the power wires.Maybe one pullup (each twice the equivalent value) at each end of the wire is a better solution? Or am I over thinking this?Andy

author: tszaboo
author_rank: Super Contributor
timestamp: October 09, 2014, 02:02:42 pm
content: I would use LIN. It has drivers, hardware support, software support, proven working, cheap.

author: mikerj
author_rank: Super Contributor
timestamp: October 09, 2014, 04:41:45 pm
content: Quote from: NANDBlog on October 09, 2014, 02:02:42 pmI agree that LIN drivers are cheap and robust, but the LIN protocol itself may be a little more complex than the OP's design warrants.

author: Richard Crowley
author_rank: Super Contributor
timestamp: October 09, 2014, 05:02:44 pm
content: You may be under-estimating the amount of interference you will see from the high-power PWM. You didn't mention what the current levels are that you are designing with. But I question the practicality of using ordinary 3-core power cable and unbalanced data. I really think you need a balanced data transmission path to deal with the hostile environment of high-power PWM.Could you use Cat-5 cable with 6 of the 8 wires dedicated to power distribution, and a remaining balanced pair for the data transmission? Since we don't know what kind of currents you are planning on, we don't have any idea whether this is a practical suggestion.Of course, another method of dealing with unreliable data transmission would be to continuously transmit the data and accept only the messages with proper check-sums.

author: Richard Crowley
author_rank: Super Contributor
timestamp: October 09, 2014, 05:11:04 pm
content: There is also wireless data transmission. For < US$20 you can get a postage-stamp size board with a full microcontroller (for the message deciding and the pwm control) PLUS wireless data transceiver. (i.e. Moteino et.al.) Then you could use any old 2-core power cable.

author: daqq
author_rank: Super Contributor
timestamp: October 09, 2014, 05:36:31 pm
content: Take a look at SDI-12. Slow as they get, simple hardware, low power.

author: Neilm
author_rank: Super Contributor
timestamp: October 09, 2014, 07:11:32 pm
content: Quote from: cowana on October 09, 2014, 09:22:23 amIs this a commercial product? If so you had better check what ever regulations you need to comply with. I know several that state if there is yellow/green in a wire, it can ONLY be used for connections to safety earth, even if the unit is battery powered and doesn't connect to mains.

author: David_AVD
author_rank: Super Contributor
timestamp: October 09, 2014, 08:54:29 pm
content: Quote from: Neilm on October 09, 2014, 07:11:32 pmIs this really the case when the connectors are not mains types?

author: tszaboo
author_rank: Super Contributor
timestamp: October 10, 2014, 08:01:14 am
content: Quote from: mikerj on October 09, 2014, 04:41:45 pmI dont think LIN is much harder than UART. You need to configure like 2 extra registers in your MCU, and since the communication is uni-directional, there is no timing requirements.

author: tylernt
author_rank: Newbie
timestamp: October 10, 2014, 07:45:16 pm
content: cowana, you might look at the Dallas 1-wire protocol for inspiration in designing your own.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 10, 2014, 08:19:36 pm
content: Quote from: Boltar on October 09, 2014, 09:58:00 amI also like this.Another possibility is to use two wires, period: you can, for example, couple modulated RF onto the power lines. In a closed system, you don't have to worry too much about signal levels or frequency ranges (no need for radio stuff like AGC and tuning), and the RF can be differentially coupled so it stays in the wires (which can be twisted pair).Tim

author: mikerj
author_rank: Super Contributor
timestamp: October 11, 2014, 01:23:43 pm
content: Quote from: NANDBlog on October 10, 2014, 08:01:14 amI'm talking about the actual network protocol, not the hardware layer. For LIN there are 6 different frame type, variable payload size, multicast reception etc. which would have to be dealt with if you followed the specification to the letter.

author: Neilm
author_rank: Super Contributor
timestamp: October 11, 2014, 06:11:42 pm
content: Quote from: David_AVD on October 09, 2014, 08:54:29 pmYes - IEC61010-1 has a clause that goes "green or green / yellow wires not used for any purpose other than safety earth". I had to reject a design for breaking that very clause a few years ago.

author: zapta
author_rank: Super Contributor
timestamp: October 11, 2014, 06:19:25 pm
content: Quote from: mikerj on October 11, 2014, 01:23:43 pmSince the OP controls both the master and slaves, he can implements a subset of the protocol or a variation of it.IIRC the LIN transceivers expect 12V so if he change from 24V to 12V it will be even better fit.

author: David_AVD
author_rank: Super Contributor
timestamp: October 11, 2014, 10:23:35 pm
content: Quote from: Neilm on October 11, 2014, 06:11:42 pmI understand that, but what I'm asking is does that standard even apply in the case of a non mains powered device?

author: Richard Crowley
author_rank: Super Contributor
timestamp: October 11, 2014, 10:33:57 pm
content: Quote from: David_AVD on October 11, 2014, 10:23:35 pmAs long as you don't use conventional mains-type connectors at any point in the circuit, and the cables are already terminated in non-mains connectors so there is no confusion about what the common colors mean.I continue to believe that attempting to send baseband data over a path which depends on such a noisy ground/return path is doomed to failure. Perhaps FSK modulating the digital data onto some higher-frequency carrier can make it easier to filter out the noise from the PWM switching of the high-current loads. I don't recall seeing any clarification or revelation of the kinds of currents we are talking about here, so we are all shooting in the dark here.

author: cowana
author_rank: Frequent Contributor
timestamp: October 13, 2014, 01:18:47 pm
content: Quote from: tylernt on October 10, 2014, 07:45:16 pmI do like the idea of the master controlling the communication (particulally if there are multiple slaves on the bus). I may well end up using some of the OW system's aspects in my scheme.Quote from: zapta on October 11, 2014, 06:19:25 pmIt looks like you can get LIN tranceivers that run happily on 24v. I would imagine the simple open collector scheme would provide enough signal integrity (I will use checksums and can repeat corrupted data) - however I'll have to do some testing and experimentation to see if this is the case or if something more robust is required.Quote from: Richard Crowley on October 11, 2014, 10:33:57 pmAt 24v, the current involved will likely to be <1A (average). The LED drivers run at around 450kHz, and state a peak current draw of around 1.5 times the average (although I'd imagine this could be closer to 2 times worst case). There will be a couple of hundred uF of low-ESR decoupling capacitors located in the slave device, so hopefully the peak current's in the cable shouldn't be too high.I am hoping to make this PCB as flexible as possible, so in addition to the open collector scheme (or LIN if required), I will also include (unpopulated) footprints on the PCB for RS485 (via twisted pair) and 2.4GHz wireless modules, to allow for future expansion.This system is being designed for one-off manufacture for personal use, so certification requirements shouldn't be an issue.Andy

author: Unknown
author_rank: Unknown
timestamp: October 13, 2014, 11:20:23 pm
content: I'll be very interested in how you implement this especially if you eventually make it wireless. It's been a little dream of mine for a while to install strip lighting around the main room here. There is a rail 3/4 of the way up the wall all the way around the room, so I could place the strips there and have them "uplighting" so to speak. But what I actually want to do I've never seen available. That is to have a wireless box stuck on the wall with three pots for red, green and blue. That would allow a huge range of intensity and hues and be very simple. I'm not bothered about cycling or strobing or any of that stuff. The only kind of "complete" solutions I've seen come with those crappy dome button, button cell remotes that work for a week or so then die forever, and the remotes do not give you nearly enough control over brightness and hue.Would you mind keeping this updated with any progress you make? Assuming you're willing to share of course

author: Richard Crowley
author_rank: Super Contributor
timestamp: October 13, 2014, 11:36:24 pm
content: I would use ordinary "LAN" Cat-5 cables with RJ-45 connectors. Dirt cheap. Easily available in different lengths. Easy to DIY custom lengths.Cat-5 cable is rated "Maximum current per conductor = 0.577 A"So 3 conductors would total capacity > 1.5A3 for supply, and 3 for return, and one pair for balanced data.There are many pieces of gear that use exactly this wiring scheme.The industrial remote-control pan-tilt heads for my cameras use exactly this scheme.

author: mikerj
author_rank: Super Contributor
timestamp: October 15, 2014, 11:44:10 am
content: Quote from: zapta on October 11, 2014, 06:19:25 pmYes, we've come full circle as this is what I implied in the original post.

author: dfmischler
author_rank: Frequent Contributor
timestamp: October 15, 2014, 12:23:55 pm
content: Quote from: Neilm on October 11, 2014, 06:11:42 pmHow do you reconcile this with, say, ISO/IEC 11801:1995 referring to the EIA/TIA 568 color schemes (in which green is half of a data pair)?