A Power Monitor For RC Airplanes

I've been fiddling around with microcontrollers for years and have built a number of useful projects based upon them. So, since I recently returned to radio-controlled modeling, it seemed only natural that I'd eventually dream up a project to bring these two interests together. That project is a data logger to record electric power during flight. Now, commercial data loggers are readily available for this purpose, but what's the fun in just buying one when I can design and build my own?

Recently, I came across a microcontroller system called Arduino. It's a programming platform designed to run on Atmel microcontrollers such as the ATmega328 or ATmega168. Based largely on C++, the Arduino environment allows the developer to work more effectively in a high-level language, while a special-purpose bootloader makes it possible to quickly and easily write, download and execute programs (called "sketches") on the processor without special-purpose programming hardware. In short, it's an ideal prototyping environment.

I wanted a device that would sense and record both current and voltage between the battery pack and the ESC during flights. Current sensing is best done with a special-purpose hall-effect sensor. I employed the ACS715 device from Allegro Microsystems, since this IC is readily available from sources such as DigiKey. This IC converts current to a voltage which can be directly measured by the microcontroller's built-in ADCs. The ACS715 can handle up to 50 amps of forward current, which is more than enough for my purposes.

Voltage sensing is a bit trickier, since I wanted to handle voltages from lithium polymer (LIPO) battery packs with 2, 3 or 4 cells. To do this, I designed three separate voltage dividers and wrote code for the Arduino that would automatically select the appropriate divider, based upon the type of battery present when power is first applied. This scheme could be easily extended to support additional pack sizes.

I decided to integrate a sensor to monitor and record battery temperature, as well. I used a DS1820 digital temperature sensor, since it's very small and can be operated remotely. This enables me to attached the sensor directly to the battery and connect it via a simple 1-wire bus to the logger. Finally, I integrated a 128KB serial EEPROM to store data for later retrieval via PC. Although not necessary during normal operation, the logger provides a simple interface to a serial LCD module that can be plugged in to see data in real-time. This is useful if you want to test your power system on the bench prior to flight.

I prototyped the circuits on a breadboard and developed the software using the Arduino development environment on my PC. A special adapter is used to interface the Arduino with any standard USB port, so the system can be used on any PC. The Arduino software and all the documentation is available at the Arduino website.

Once the circuitry and accompanying software were proven to work on the bench, it was time to design a circuit board for the "production" devices. I've had good success with the services of Express PCB, an online service that makes the design and manufacturing of custom circuit boards easy and relatively affordable. You simply download their design software to your PC, design your board and upload the result to their website. They produce beautiful double-sided boards from the uploaded design and ship them to you in a few days. It's really that easy and I highly recommend them.

Operation

Operation of my data logger is simple. When it's connected between the battery and ESC, it automatically initializes and determines whether a 2S, 3S or 4S battery is present. When you are ready to fly, you press and hold a small tactile pushbutton on the board, until you hear an ascending two-tone chirp. This indicates the logger is now recording data. From that point on, the logger is sensing voltage, current and temperature once per second and recording it to the EEPROM. After the flight, simply press and hold the button again until you hear a descending two-tone chirp to stop recording. Repeating this process starts a new logging session, enabling you to record a number of separate flights over the course of a day of flying. I use an efficient packing algorithm to minimize memory usage on the EEPROM, enabling the logger to record many hours of data between downloads.

Once back at your PC, I simply connect the adapter to a USB port and run a small perl script to download the data to a file. This can be easily read, analyzed and graphed by a spreadsheet program, such as Microsoft Excel. Once the data is uploaded to the PC, you simply press and hold the logger button beyond the recording chirps until you hear three short bursts, and release. The existing EEPROM contents are erased and you're ready to fly again.

Next Steps

The data logger works well and has been a fun project. I've learned a lot about the power systems in my aircraft and intend to monitor long-term trends, such as lost battery capacity as they age. While Excel is adequate for looking at the recorded data, I intend to write a small java application that will import, analyze and graph the data in a more convenient, integrated way.

Since I had to purchase a small number of circuit boards at once, I have extras available. If you're interested in one of these loggers, please contact me. Additional photos can be found in the gallery.