If I have a device (Device A) that is plugged into a 120v wall outlet, and is connected to another device (Device B), that has a small LiPo battery, via a 3.5mm headphone cable (consider this a temporary state), is it possible to communicate (serial) with Device B as well as charge its battery, all from Device A via the cable? Neither the charging or the data communication need be very fast.

Note: I haven't worked with batteries in my Arduino projects yet, I've mostly worked with fairly basic sensors, relays, and some serial/wireless communication, so if somebody could explain if this is possible and which general components I would need to accomplish it, that would be much appreciated.

Update: Let's say I intend to use a 4 conductor wire (example: digikey #CP-43514SJTR-ND)

  • 3
    \$\begingroup\$ Yes, it's well possible to achieve even full duplex high speed (asynchronous) communication. But a 3.5mm jack for power is a BAD idea because when you (un)plug it you short its terminals for a brief moment, and that's bad for power. \$\endgroup\$ – Vladimir Cravero Sep 10 '14 at 12:38
  • \$\begingroup\$ @VladimirCravero Interesting, I hadn't thought of that. I got the idea from one of the old Apple iPod nanos, which had a charging "dock" that was just a 3.5mm jack and it was also how you transfer music to it. There must be a way to prevent the short or at least eliminate the damage it would normally cause? \$\endgroup\$ – andrhamm Sep 10 '14 at 12:49
  • 1
    \$\begingroup\$ Yes, there are tons of ways of course. I'm guessing Apple is more careful with charging docks than cloud storage. The question, since you are not Apple nor you have a finished product, is: why do you need to use a 3.5mm jack? That is not designed as a power connector nor for high speed digital communication, since you are designing something why don't you just start from scratch the connector part? \$\endgroup\$ – Vladimir Cravero Sep 10 '14 at 12:59
  • \$\begingroup\$ You should make it obvious whether you mean a 2 wire cable or 3 (or more). Charging and coms is trivially easy with 3 or more wires and not overly hard with two. With to - charge circuit has a series resistor so the voltage feed can be modulated on the device side of the resistor. A charging controller in the device isolates battery from line (at an abs minimum a diode would do BUT you really want a LiIon charger IC. Half duplex coms easy - sender adds load to send a low on power line. There are more sophisticated ways but that works OK. Min rqmnt probably a psu ~> 6V, A Lion charger IC .... \$\endgroup\$ – Russell McMahon Sep 10 '14 at 14:16
  • \$\begingroup\$ in device, A schottky diode maybe feeding charger and a cap by charger IC. Coms looks at and listens to line and RX adds an res load to send bits. A comparator can look at line an an RC filtered line signal to show mean Vdc. Line will be modulated above and below average value. Maybe offset comparator ref slightly below line mean. | 3 or 4 wires make life easier. | How large a plug can you tolerate physically? \$\endgroup\$ – Russell McMahon Sep 10 '14 at 14:19

With 4 conductors it's very easy [tm].

  1. Ground

  2. V+ - charges battery and can power electronics directly.
    5V from USb or a "USB power supply" enough for short runs with a LiPo. Std LiPo charger ICs available from eg Digikey will accept 5V (or more) and charge battery with minimum hassle.

3./ 4. TX/RX data relative to ground.
Or bidirectional differential pair similar to what USB uses.)

If your uC (microcontroller) in the device has a UART then RX and TX pins MAY be able to connect directly. Runs risk of noise and potential for damage via plug but OK in many cases.

| improve this answer | |
  • \$\begingroup\$ Does it matter which contactors on the plug map to the numbers in your explanation? As one of the other comments suggested, there is the chance of shorting the power when (un)plugging. For example, should the contact on the tip of the plug be Ground, vs the other options. Thanks \$\endgroup\$ – andrhamm Sep 10 '14 at 18:27
  • \$\begingroup\$ @andrhamm Depends on plug and socket used. If power is on plug (so exposed to touch) when plug is out ) then putting V+ on inner end is safest. If power is from socket socket then connecting V+ to plug tip end of socket is safest. |If V+ is current limited (which is easy enough) and designed to stand a brief short all is well enough for own use. For use by others withstanding an indefinite short is wise. Effect of placing plug in mouth and salt water worth knowing :-). \$\endgroup\$ – Russell McMahon Sep 10 '14 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.