Digital signal on the +5V line? - Page 1
Forum section: electronics / beginners

author: SlowBro
author_rank: Regular Contributor
timestamp: May 24, 2018, 02:59:50 pm
content: I’d like to transmit a low bit rate half duplex digital signal from my PC to an ATMega328P with a motor 100’ (30m) away using only two unshielded untwisted wires. The device would be powered from those two wires. 1-Wire should be able do this but seems overly complicated and doesn’t seem to be able to deliver enough current for my needs. And RS485requires three wires.Could I just add the signal to the 5V line then pull it off at the destination using a zener? And yes I am aware of the noise issues when using a non-differential signal over unshielded untwisted pair.

author: ejeffrey
author_rank: Super Contributor
timestamp: May 24, 2018, 05:25:09 pm
content: Transmitting under these poor conditions over 100' to a motor driver? I think you are gonna have a bad day. Especially since if you consider just using 1-wire "overly complicated" then I think you probably don't want to go through the design effort to do this yourself.One-wire is designed for this, but because it uses open drain signalling, the power available is fairly low since it has to go through the pull-up resistor.Do you need bidirectional half-duplex, or is unidirectional signalling OK? With unidirectional signalling you could just use a totem pole output on the master for higher current, and size an appropriately big capacitor on the receiver to supply power when the signal is low. You can look up how 4-20 mA current signalling in industrial systems work -- that is similar to what you want to do. Also, current mode signalling eliminates a lot of the noise problems with unshielded pairs.If you want to almost completely separate the power delivery from the signalling you can use a standard 5V regulator, but then AC couple your signal in and out via a bias tee (capacitor + inductor) at each end. You need to use signalling that is DC balanced such as manchester encoding. This allows potentially very high bandwidths and is how e.g., powerline networking works.

author: SlowBro
author_rank: Regular Contributor
timestamp: May 24, 2018, 05:35:47 pm
content: By the way, I said Arduino but I meant an ATMega328P. Will edit my OP.Quote from: ejeffrey on May 24, 2018, 05:25:09 pmNot true. I was considering the zener circuit at the same time, and 1-Wire seemed overly complicated compared to that. But also as mentioned, the current problem. I'd be willing to design a system 1-Wire if it really is the best choice.Quote from: ejeffrey on May 24, 2018, 05:25:09 pmYes I do.Quote from: ejeffrey on May 24, 2018, 05:25:09 pmCan 4-20 deliver more than 20mA to charge a capacitor? The motor doesn't need to run very long, about 30 seconds, twice a day, and uses about 300mA when running. Maybe an appropriately-charged capacitor could work? Or maybe it could be 4-500mA? (Motor + ATMega + whatever else.)Quote from: ejeffrey on May 24, 2018, 05:25:09 pmOff to Google bias tees and manchester encoding. Do you have an example circuit? Edit: Okay,here's one.By the way, this application can tolerate low baud rates. 300 bps is not too low. And I could also use CRCs, resend on failure. Hence I am not terribly concerned with noise.

author: SlowBro
author_rank: Regular Contributor
timestamp: May 24, 2018, 07:13:30 pm
content: I'm liking the idea of using a current loop. Maybe not 4-20 but some other current scheme e.g. 20-50mA or something like that, to permit the ATMega to run 24x7.I could put the motor on batteries and use the current loop for powering the ATMega. The MCU needs to be on at all times, but the motor does not. Six AAs should give me enough juice for about six months of operation. But I would prefer the neat+clean of just running a pair of wires.

author: SlowBro
author_rank: Regular Contributor
timestamp: May 24, 2018, 09:03:56 pm
content: Knowing what to Google is valuable. I didn't know the right term, but I do now.For those who may have the same question, search these terms:Digital over two wiresTwo wire power and dataUART over DC powerData over DC powerI really like this solution. Edit: Ah no. It’s only simplex.https://electronics.stackexchange.com/questions/194452/very-simple-signalling-over-12v-dc-power-wire

author: ejeffrey
author_rank: Super Contributor
timestamp: May 25, 2018, 03:22:09 am
content: Quote from: SlowBro on May 24, 2018, 05:35:47 pmYeah, I wasn't specifically suggesting 4-20 mA, but to use that as an example to work off of. Since you don't need to interoperate with standard industrial equipment, you aren't tied to the exact numbers.300 mA for 30 seconds is 9 C. So you would need multiple farads of ultracapacitors, possibly multiple in series and parallel to get the needed voltage rating and energy storage. You might need to use a small boost converter to keep a constant 5V output as it discharges. A NiMH battery would be another choice, you can just trickle charge that at a very low current all day long and it would have more than enough juice to power your motor. The output voltage would be nearly constant, unlike the ultracapacitor, but the voltage would still have to be <5V, so you might still want the boost converter.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 25, 2018, 03:55:16 am
content: Start with:Quote from: ejeffreyThen:30m is a pretty long cable, and you can easily loose a few volts over it.So to compensate, I would use a 12 to 24V power supply and a remote voltage regulator.In my opinion every uC always needs some inductor for filtering out the worst garbage and make a decent power supply. (Especcially on such a long cable).Those small SMPS circuits from Ebay / Ali / China are very usable.For communication you have indeed a few options.- Voltage modulation.- Current modulation.- LF / HF / AC coupling.Do you need communication in both directions?Easiest way would be to use a current limited power supply with Diode & Buffer cap on the "secondary" side.Especially if you use a higher supply voltage (24V) and a SMPS circuit on the secondary side you can easily afford to short circuit the power supply with a transistor for a few ms to send bits over the line.You can read the voltage of the line back with a simple comparator or opamp.(Some opamp's do not like it if there is a large voltage differential between the inputs).A current limited power supply is very easy to make with a LM317. Just put an exta resistor between the output and the 2 voltage divider resistors. (See APPnote for LM317 as current source).You can look at this modulation scheme in 2 ways. You are modulating the voltage by temporarily shorting it, but you are also modulating the current (To the max current your LM317 will deliver).But because the bulk capacitor on the seondary side will also draw current spikes to recharge it after each communicated bit you are probably better of with reading the voltage between the 2 lines.Therefore read it with a comparator, or maybe even only some voltage dividers directly to your uC pins, but set the threshold to some sensible value.

author: Ian.M
author_rank: Super Contributor
timestamp: May 25, 2018, 04:22:14 am
content: Add a Schottky diode between the line and the remote end's regulator's bulk capacitor so your pull-down transistors only have to handle the line limit current + discharging the line capacitance, with enough bulk capacitance to keep the regulator input up above your line level logic 1 threshold even when the worst case data byte is sent, so the line voltage recovers to above the logic 1 threshold with minimal delay on a 0 to 1 transition.

author: SlowBro
author_rank: Regular Contributor
timestamp: May 25, 2018, 07:15:30 pm
content: Quote from: Doctorandus_P on May 25, 2018, 03:55:16 amYep I do.Quote from: Doctorandus_P on May 25, 2018, 03:55:16 amI think you're thinking like I'm thinking, but I had in mind using higher voltages for the signal instead of cutting out. Then there is no cutting of the power. Am I correct?

author: Ian.M
author_rank: Super Contributor
timestamp: May 25, 2018, 07:41:56 pm
content: A higher voltage for line '0' level offers little benefit if communication is short and sparse. To get rapid transitions, you want enough bulk capacitance to keep the regulator input above the line '1' threshold so the end of a '0' bit has a fast rise time to the '1' threshold. Also the greater swing offers higher noise immunity.However if you were sending/receiving a continuous datastream, you'd want to keep the line '0' level above the regulator's dropout voltage, and use a choke + diode for isolation from the bulk capacitor so it doesn't brownout on a long run of '0' bits.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 26, 2018, 06:12:30 pm
content: I also thought about increasing the voltage.Simplest way to do that would be to put a capacitor parralell to the power supply, and then lift the GND pin of that capacitor.That would need 2 transistors, and the capacitor & transistors would have to be dimensioned to not be drained too fast.It is more complicated, with no real benefits and that is why I did not mention it.Just shorting the power supply to GND is easier.The pulses can be very short (10us?, could even be shorter) so the capacitor to bridge those periods does not have to be too big.Alternatively, you could put a series resistor before the "GND" switch, which only dips the power supply.A calculation example:Assume your circuit needs 30mA to function (Use a shunt regulated power supply to keep this constant).Assume a 24V power supply, and limit it's current to 50mA.Assume your secondary circuit works still good when it has 10V on it's input.Then use a switch (Transistor or MOSfet) with 10/(.05-.03)= 500ohm in series.It would also be reasonably simple to use a switched current source on the secondary side.