Small Footprint Arduino Nano With USB Charging Circuit (Li Ion or LIPO) That Can Turn Itself Off (soft Latch Power)




Introduction: Small Footprint Arduino Nano With USB Charging Circuit (Li Ion or LIPO) That Can Turn Itself Off (soft Latch Power)

When I started my first Arduino project, I realized that I needed to use a small-format Arduino so that I could enclose it in my device. Being new to Arduino, I didn't realize all the challenges that I would have with battery management!

After weeks of trial-and-error, reading a number of 'Ibles and watching how-to videos, I came up with a solution that I think is pretty neat that I wanted to share - both in the hopes it would help someone else, and also hoping that you might have some great ideas for how I can take this to the next level as well.

The basic idea is simple - I need an Arduino, and a rechargeable battery and battery management, in a format that's relatively small and flexible, easy to build and easy to troubleshoot and modify. More than a prototype, less than a final PCB. My solution is not the only one, and the process I went through to come to this solution is a personal one - yours will be different, and my 'ible will likely be one of many you will read before you find the right solution for your project.

Step 1: Materials and Tools



  • Soldering equipment - iron with appropriately sized tips, solder, helping hands,
    • Note that this 'ible doesn't include a soldering primer, there are a lot of good ones out there. If you are new to soldering, go read four or five 'ibles on electronics and PCB soldering, watch a dozen youtube videos, and practice a LOT! It gets easier! I went from zero to what you'll see here with just a dozen (or two) hours of practice.
  • Electronics Multimeter
    • I have an ancient analog Triplett multimeter that was passed down from my dad, but any will work as you will only need to test voltage and resistance (continuity).

Step 2: Preparation

For the purposes of this Instructable, I'm assuming that you are already familiar with:

  1. Basic Electronics - I took Circuits in college as part of my Engineering core curriculum almost 30 years ago. If you are interested in this 'ible, I'm assuming that you have similar basic knowledge of circuits, voltage, current, etc. There are MANY websites out there with electronics how-to info, here is one I found but Google is your friend and there are many others.
  2. Soldering - I was never good at soldering, but I was able to become pretty proficient in the past 3 months worth of my spare time. Watch a number of tutorials, build yourself a soldering station (there are a number of 'ibles about this as well, and I've added an annotated picture of my homemade one here), you don't have to spend a fortune - you just have to practice, a lot!
  3. Arduinos - there are a ton of great how-to-Arduino's out there. I started with Make: Getting Started With Arduino and Googled my way from there.

Step 3: Safety

Assume the normal safety warnings here about electricity and soldering that you will find when you do your research on those topics.

One thing that I will point out in addition is that there is a reason that any Lithium Ion or Lithium Polymer batteries have a warning on the box when they ship. If you mishandle or abuse them enough, they will burst into flame in a violent manner. If you overcharge them (beyond 4.2V), or use them below their minimum recommended voltage (3.0V), they may deform and catch on fire. If you are curious, search youtube for Li Ion Battery Explosion.

The circuit I'm presenting here has a component that manages both charging and discharging of the model of Li Ion battery that I'm using here, and in theory protects against both over- and under-voltage situations, but you should do your own research and gain a comfort level with this technology before you proceed.

Adafruit - Pick the right battery for your project

I always test the high- and low-voltage protection of each device I build before I use it unsupervised.

Step 4: Some Background

I finalized this design after a lot of trial and error, and I wanted to share some of the learning process I went through as well as the finished design.

Powering the Arduino

My first Arduino project used a 9V battery connected directly to the standard-sized Arduino Uno. This worked well during prototyping, but the finished result didn't fit into anything. Plus I soon discovered that the 9V battery didn't last nearly as long as I expected.

Next I tried using more batteries - I bought battery holders that I could pack 8 AAA batteries into, and I figured out how to wire this up to my new Arduino Nano. While I could fit this into my project, I was really surprised to find that it didn't last much longer than the 9V battery.

After scratching my head for a while, I figured out that this is because the Arduino only needs 5V, and anything above 5V is "burned off" by a built-in circuit that "splits" the incoming voltage and releases anything about 5V as heat at whatever wattage the Arduino is drawing from the battery - total waste!

Since I was into RC Cars as a hobby, I was familiar with Lithium Polymer (Lipo) batteries, and rebuilt my project using a 1-cell (1S) Lipo that delivered from 3.3 - 4.2V. After doing some research (mostly Googling), I found a the 5V power regulator that takes the 3.7V (average) output from the battery and turns it into the 5V that the Arduino needs.

Safety First

In order to use the Lipo battery, I knew that I had to have a low-voltage protection circuit. I researched this for a while, and found the Tenergy Li Ion battery protection circuit. I used this on my next version of my project, and while it worked great, I was unhappy with having to solder connectors onto the pads, and soon found out that it was no longer available.

This is when I started researching other protection circuits and learned that most people were using the charging circuit that also protects against low voltage for Li Ion batteries. I ordered those from eBay and converted my project, but I was concerned about using them with my 1S Lipo batteries.

I did some more research on the common uses for the charger module, learned about the 18650 batteries, decided to give those a shot since they were a friendlier form factor, could easily be swapped in/out of the project, allowed me to use my own connectors, and the charging module was specifically designed to work with that battery - which gave me some comfort that my project wouldn't catch on fire!

Total Turn-off

Somewhere in that same timeframe, I also realized that the Arduino was drawing power all the time, and my target project at the time ran for a fixed time after someone pushed a button, and stopped when it timed out. It would be really great, I thought, if the Arduino could completely turn itself off!

I went back to Google, where knowing the right words to search for makes all the difference! It took a while, but I learned that what I needed was a soft-latch power circuit. This kind of circuit uses a momentary pushbutton to "latch" the power on. With the right integration to the Arduino, it allows the Arduino program to use one of the digital pins to "signal" the power circuit to turn off completely - zero draw on the battery.

The only problem is that these circuits are relatively complex - especially for someone like me who has never designed a circuit. I did figure out how to build one from video tutorials, but in the process I also discovered that Pololu makes one that works better than anything I could've built.

With these concepts in mind, I present to you my (current) final design!

Step 5: The Design

See the attached design image, numbered to match the list below:

  1. This is the 18650 HE2 2500mAh Li Ion battery providing a typical 3.7V to the project circuit
  2. The 18650 charging/protection unit, uses USB power to charge the battery and automatically shuts the power off if the voltage drops below 3v.
  3. Pololu soft-latch power circuit. Power from the output of the 18650 charging/protection component flows in, and on a button press, the power latches on.
  4. The 3.7v output from the battery is lifted to 5v through the Pololu voltage regulator
  5. The Arduino is powered and runs its application. The application must makes sure that pin D2 is configured for output and set low on start-up.
  6. When the application sets pin D2 high, the Pololu soft-latch switch will power off the circuit, and battery draw returns to zero.

Step 6: Building the PCB

Again, after a lot of trial and error, I found a build process that works for me.

By soldering female header pins to the prototype PCB board, all of the components simply "plug in", and all of my circuitry is soldered onto the bottom of the board using coil magnet wire.

You'll notice in the pics of the prototype here that there are a few extra headers on the board not used by the primary components, these are used to hold diodes and resistors in my final project design that I won't go into here. I like using the headers for all the components as it makes it really simple to swap components, or reclaim them when I'm done with the project.

The attached diagram shows the layout of the header pins, and the wiring diagram that goes along with the circuit in the previous step. Notice that the diagram is drawn from the bottom of the board's perspective, which is the perspective that I'm usually working in when soldering the headers and wires into place.

Cut the coil magnet wire to length with enough leftover that you can route them around each other and out of the way of soldering other wires. Use a razor or fine-grit sandpaper to strip the coating from 1/8" of each end of the wire, use clay to hold it in place, and use your tweezers to position the stripped portion of the wire on top of the solder joint with some pressure from the spring tension in the wire. This way, all you need to do is lightly touch the solder joint to melt the existing solder, and it will pull the wire in and attach it to the solder joint.

I've had 100% success using this method. Use your multitool to test the continuity of the circuit between the two ends of the wire, zero resistance means you have a good connection! It's really much easier than I expected it to be when I started down this road. Patience during your setup and alignment of the wires equals ease of soldering and improved chances for success!

The pictures show the progression from aligning components and using clay putty to hold them in place, soldering the components, using clay to hold wires in place as they are soldered, and the final result.

Step 7: The Finishing Touches

USB Charging Cable

I wanted to be able to charge the battery without disassembling my project, so I used the micro USB male-to-female connector, cut a small hole to fit, and routed the cable and glued it in place with Gorilla glue.

One issue remained - the 18650 charging control board has two LEDs on it that are critical, that show "charging in process" and "charging complete". These are small, surface mount LEDs, and when the component board is installed in my project, I can't see them!

Fiber Optics

After doing some more googling, I learned that there was really cheap plastic fiber optic strands - the kind used for arts and crafts displays - and that these are relatively easy to work with. Each strand is about a meter long, I cut it into 6 pieces of equal length, taped them together at intervals, coated 1/4-inch segments with epoxy, and let it dry. Then I cut in the middle of each epoxied section to create three or four segments of the 6 fibers, glued together at both ends.

I applied a small drop of the epoxy to each of the LED lights, and used the "helping hands" (shown in pics) to hold the fiber bundles in place over each LED until the epoxy set. Then I drilled a small hole in my project, routed the fiber, and glued the other end in place so that I could see the light from the LED on the outside of my project.


The final touch was attackhing connectors to the pads for the power to be supplied to the project, using the JST crimp connectors to attach the connectors to the wires - making sure that you always use female connectors on the battery, and male connectors on your project. Crimp the ends on the wires - you'll note from the pics that I use small pieces of heat-shrink on the wires to secure them to the connectors, just an extra precaution to make sure there's no accidental shorting of a pulled out power wire that could cause a Li Ion fire.

Step 8: Final Thoughts

Soon I will post another 'ible showing how I used this concept for a custom Minecraft torch I created for my kids. However, I plan on using this approach for many of my future Arduino projects. The batteries are easy to work with, the form factor allows for a lot of flexibility, and the functionality provided by the soft latch switch solves a basic Arduino shortcoming.

I hope that what I've shared about the path I took to learning these skills will help someone else, the way that I was helped by others who posted their lessons learned on here and other sites.

I'm also very aware that I have a lot to learn, and I hope that some of you reading this will post comments with additional ideas, components, tips and tricks that will help me take my skills to the next level, too. Please let me know what you think!

Happy making!

First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

Be the First to Share


    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020

    8 Discussions


    2 years ago

    Can anyone share the source code ;-)


    4 years ago

    I made something similar, but for the Raspberry Pi. I would love to add an auto shutdown function - any tips?


    Reply 4 years ago

    It's a great question, I'm not an expert on the Pi but the key issue there seems to be that you have a running Linux system that has to shutdown before the power can turn off.

    The two choices I see are:

    - find a way to signal on a GPIO pin somehow when the system gets to runlevel 0 so that the Pi can signal the Pololu soft-latch switch to turn off. This may not be possible depending on what subsystems need to be running to signal on GPIO, I have Linux experience but no Pi experience.

    - leverage an Arduino (or similar microcontroller) running off the same power supply to somehow monitor the Pi (perhaps set one of the GPIO pins high, and monitor it from the Arduino) to see when it's shut down, and then signal the Pololu soft-latch to shut off the power.

    Wish I knew more about the Pi to help you, but those are the two options I'd look into first.


    4 years ago

    you can use 3.3v Arduino and attach power to raw pin. So it may be powered with 3.7v directly. so you don't need Step-Up


    Reply 4 years ago

    True - thanks for pointing that out. I haven't played with any of the 3.3v variants, something on my list to do in the future.


    4 years ago

    or you know, you could use discrete elements instead of modules...


    Reply 4 years ago

    I agree, that could be a really great next step for this - I'd love to turn the idea into a single board that had all the components on it. That's currently above my skill level as a circuit designer!


    4 years ago

    Nicely done! Thanks for sharing!