Arduino with built in lipo charger?

Hi everyone,

I am trying to create an Arduboy clone that will use a lipo battery and charger circuit.
I have been trying to find an ATmega32u4 board with built in charger circuit (I want to minimise the number of external components and have one port for charging and uploading sketches.) |
I found these boards, but they state they run at 8MHz.

My questions are:

  • Are these boards compatible with the arduboy sketches, Mr.Blinky software etc?
  • I understand that the 8MHz will affect performance, will this make most games unplayable? Only effect certain larger games? Any other issues it may cause?
  • Lastly, is there a board that runs at 16MHz with lipo charge built in or another solution I am missing?

Thanks :))

Those boards should be compatible. I don’t know that you can’t use the 8mhz version, though if anything it will be slower (probably still very playable for lots of games though). As for solutions, might I suggest the Itsy Bitsy 32u4 or the Teensy 2.0 ((small tangent: Teensy boards are incredible and bring out so many pins on all versions. I’ve got a Teensy 4.0 I’ve been playing with and it’s ridiculously overpowered even for more complex projects, ALL the pins are interrupts)) as they’re well-priced and run 5v at 16mhz, and both have lots of the pins brought out, and have a neater form factor than the more popular pro micros. Neither have built-in lipo charging, however adafruit carries some pretty neat little lipo charger breakout boards to add to any project, like this one, the Adafruit Micro Lipo Charger. It’s teeny-tiny and has all the pins you need for proper connection to your 32u4 board. Feel free to ask if you need a bit of help with the wiring, though it should be pretty easy :slight_smile:

Yes and no. You’ll need to install the board package for the relevant board so sketches are compiled properly for 8MHz (sketches compiled for Leonardo or the Homemade package are compiled for 16MHz only)

With MCU running at 8MHz it has half the processing power and many sketches will run slower and sounds will have lower pitch and may playback at a slower rate.

2 Likes

Maybe won’t work at all.

I don’t know if the sketch’s initialisation code sets the clock. I assume it’s the bootloader and all the sketches just leave it as-is but if a sketch sets the clock source to external crystal and it’s not connected it would likely just freeze but I haven’t tried.

1 Like

I think my best bet will be to produce a custom board by combining these two design files:

My goal is to only have one USB port for both charging and programming, any ideas if that will be possible?

Thanks very much :slight_smile:

2 Likes

It’s the fuse bits that set the system clock source/prescale value. These are burned when the bootloader is flashed in reference to a configuration file specific to the microcontroller model. The sketch cant change this configuration and really has no idea at what speed it’s actually really running at, unless the speed is defined by the programmer and checked to be correct. If the fuses are set to use an external crystal you are correct that the mcu wont run without one physically connected.

You can do a little bit of this (and a overcurrent protector somewhere around the blocking diode, unless your battery have built in protection)

The diode prevent USB voltage (red) from flowing into the battery (blue) uncontrollably. No matter the diode there will always be a minuscule amount of leaking current (a few mA) so leaving it like that is not recommended.

The switch (dual pole dual throw) decide what the pins are connected to (battery, charger).
You might be able to automate this using transistors, but I don’t trust myself in having the necessary skills to know what I am doing.

The Arduboy schmatic have the 5V from the USB disconnected from the mcu by itself (i think so) and is routed to the charger
the mcu takes power from the battery through a simple switch and therefore runs on 4.2-3.7V. You can verify this by rawADC the power pin.

It’s very difficult to do that without a custom board, since very few of them have the USB pins broke out

I modified my ESPboy to have one USB connection for both charging and programming by wiring USB D+ and D- on the charger connector to D+ and D- on the processor board. I now use only the USB connector on the charger board. The ESPboy has to be switched on and powered from the battery and charger when programming it.

However, this modification was a bit tricky because, as you said, the charger board didn’t have the D+ and D- pins brought out from the connector.

2 Likes

After carefeul observation (of Arduino Leonardo) I find two via (plated through holes) that are associated with D±.

Yellow arrows are D- and red are D+.

I also question the ability for you to solder to those pins, because under normal circumstances the via should be covered/tented whereas in this case at least the central “ring” is not. Although in this case you still have the option to solder to the 220 resistor or the TQFP directly (both are larger targets than a micro USB connector)

random babbles

One of my solutions calls for building a custom PCB.
USB connector isn’t an issue. I can use the invincible USB-B connectors (with through-hole leads) and wire them up to the charging controller. This will also give me the D±.

However there is no USB leads on the Arduino (not on the official kit anyway)

This “nakeduino” thing however looks very interesting to me, but it also seems like they are having a chip shortage.

For you it might be quite easy to solder a 44 pin TQFP but for me it’s basically impossible (I don’t have high precision tooling)
I have solder paste back at home (wut) but I don’t have a heat gun or equipment to reflow the board.

You know what. Since I had already done 0603 resistor arrays, let’s just give the TQFP a try. what could be worse?

Wow. The TQFP 44 for 32U4 is 0.8mm. I should’ve done this earlier.