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)
Best Answer
With 4 conductors it's very easy [tm].
Ground
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.