4

I was hoping to design my own Arduino board for a recent project of mine, a portable project that was powered by a 3.7 LiPo battery. Most ideally, I wanted to replace the USB B port with a single USB Micro port that implements the following features:

  1. Provides power to the Arduino while it is plugged in (just like a regular Arduino does).
  2. Connect the D+ and D- pins of the USB to the Arduino somehow to allow for on-board programming (however the Arduino accomplishes this already, I'll refer to this as the "onboard usb/serial converter"). I want it to keep it programmable on-the-go.
  3. Charges an on-board 3.7V LiPo Battery. I was hoping to use Adafruit's PowerBoost 500 Shield as a reference for my schematic.

However, I haven't been able to find a schematic or example that implements all 3 features above at the same time from the same USB port. I don't have much experience with charging circuits, so the following questions might sound dumb. Below are some solutions I was thinking of that probably won't work, but I wanted to make sure:

  1. Connect the Output Voltage of the LiPo Battery to the V+/GND supply of the USB cable (probably not safe to connect all V+ sources together).
  2. Just connect the D+/- data cables to the "onboard usb/serial converter" without connecting the Vbat/Vusb somehow, have the USB V+/GND connect to the LiPo charging circuit, and the Battery Voltage power the Arduino.

I know some devices have this charging/data-transfer functionality (e.g. my phone can transfer photos to my computer while being powered on and charging at the same time), but I'm wondering how it's possible to have similar functionality for an Arduino board. Any advice?

Absolute worst case, I'll just have 2 USB ports, one for charging the LiPo and one for Serial Communication/Programming

EDIT: The idea of using an ATMega32U4 seems appealing (despite the 3.3V vs 5V operating voltage), mainly because it has a pin for VBUS for USB and Vcc for main power. But I was wondering how to do this on say an ATMega328P that doesn't have a pin for VBUS.

migrated from electronics.stackexchange.com Mar 1 '17 at 22:24

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Arduino Lilypad USB does power, charging, data through the same USB connector. I've created a derivative work based on Lilypad USB recently. It worked well. – Nick Alexeev Mar 1 '17 at 20:45
  • just wire the micro usb to an "ftdi", the ftdi to the MCU, and the ftdi's power pass though pin (5v) to a lithium charging board (about 50 cents); and bob's your uncle; all three for under $2... – dandavis Mar 1 '17 at 23:14
2

I'd recommend using the Arduino Leonardo as a reference for your circuit. Its pretty much the same as an Arduino UNO but has a built in USB interface so you don't need the USB-Serial converter.

I'd also recommend running the chip at 3.3V. That way you can use a linear regulator to regulate the 3.7V battery voltage down. Otherwise you'd need a boost converter to bump the voltage up to 5V which needs more parts.

If you follow those recommendations then all you will need is a LiPo charging IC to handle the charging. You'll need to add an ISCP header to flash the initial Leonardo bootloader, but after that you can use USB and the Arduino IDE to program it.

I did exactly this for a school project a while back. You can find the schematics here: https://github.com/seanwatson/ece4416-project/blob/master/hardware/rev2/sw-4416-project-v2-sch.pdf

  • Hmm, I was hoping to avoid using an ATMega32U4 because I don't have much SMD Soldering experience. But it seems like it has a pin for USB power AND a separate Vcc power? That looks awfully convenient! I will give this a try – George Troulis Mar 2 '17 at 7:09
  • The presence of those two pins does not mean that they are dual inputs and the chip will run off of whichever is powered; they have specific purposes. – Chris Stratton Jun 1 '17 at 1:04
  • Personally I'd avoid using a linear regulator on a battery powered system... Losing 25% of the energy stored just to heat the regulator is not very efficient. In any case I second the 3.3V suggestion: with a simple buck regulator (even already pre-soldered in modules like the ones sold on ebay at around 1$) you get more efficiency than with a boost regulator and a 3.3V uC consumes less power – frarugi87 Nov 30 '17 at 8:18
  • Oh, sorry for the necroposting. I didn't notice that this was a very old post that was bumped because @GeorgeTroulis didn't accept an answer... – frarugi87 Nov 30 '17 at 8:19
  • @frarugi87 it's ok, the reason I haven't accepted an answer yet is because I never actually tried any of these solutions yet :| Should I still accept one of these solutions? Because they are all so good! Thank you for your feedback :) – George Troulis Dec 1 '17 at 22:23
2

Use a TP4056 1A LiPo charger board (it has overdischarge protection) and a boost converter, like the XL6009. It will run you at most 5$ if you are prudent. Overdischarge protection is important.

If you want a port for programming, add a micro-USB breakout board, and if necessary a pushbutton for bringing RST down to GND. I prefer just having GND, TX, RX pins on a 3 pin header, and plugging my cable into that.

1

Following on from Sean Watson's answer, I would probably use the Bare Conductive Touch Board as your reference. It's a Leonardo derivative with all the features you're asking for. Full disclosure - I work at Bare Conductive and worked on the design of the board.

Eagle schematic and board file are here. Also, since this board successfully passed CE and FCC radiated emissions and immunity testing, you know that the reference design is sound for this if you want to create a product to sell.

The design uses a boost converter to allow for 5V operation - if you run the Atmega32u4 (or Atmega328) at 3.3V, you don't get guaranteed correct operation with a 16 MHz clock (check the data sheet). Since the Arduino bootloader for the Leonardo is written for a 16 MHz clocked MCU, this saves you the task of modifying the bootloader - and gives you the full 16 MIPS maximum performance.

  • How do you mean "at 3. V, you don't get guaranteed correct operation with a 16 MHz clock"? Looking at section 29.3 of the Atmel datasheet, it's hard to distinguish that 3.3V @ 16 MHz is in the safe operating area, but since the Arduino Leonardo already works at 16 MHz, doesn't that mean it's "guaranteed"? I'm guessing you mean that if I buy my own 32U4, I'll have to modify the bootloader to get guaranteed 16 MIPS performance (with an external 16 MHz Oscillator of course)? – George Troulis Mar 2 '17 at 21:08
  • The Leonardo works with a 5V VCC (take a look at the schematics) - so you can't be sure that 3.3V operation is guaranteed from that. Looking at this datasheet I can see that 3.3V is clearly NOT in the Safe Operating Area - it's section 29.6 here. Also there is a typo above - the curve is clearly linear between 2.7V < VCC < 4.5V, not 2.7V < VCC < 5.5V as written. – stefandz Mar 2 '17 at 23:59
  • 1
    Oh my bad, I was looking at the datasheet for the ATMega328P, which does not include the 32U4. Also how silly of me, I was under the impression that the Leonardo operated at 3.3 V (what is wrong with me?). Perhaps using a boost converter for 5V operation then is my best option if I want 16 MHz guaranteed. I might be willing to go 8 MHz though, just to avoid the boost converter. I don't think my project will be affected, and it seems to be what the lilypad does – George Troulis Mar 3 '17 at 5:08

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.