The open-source charge controller project will be based upon a microcontroller.

A micro-controller is basically a small computer. It can be programmed with code which will run when the device starts up.

The control program will be programmed onto the microcontroller. Using a re-programmable microcontroller means we can upload different code to perform different functions. We can also share and change the code as required for different applications.

This is a review of the microcontroller available and the reasons behind any choices made.

Available micro-controllers

A micro-controller is basically a small computer. It can be programmed with code which will run when the device starts up. The code can be programmed to do virtually anything. Generally the ICs are 8-bit devices (which means they handle the data in 8-bit chunks), but I am listing lots of different types here, 8, 16 and 32 bit.

Here I’m listing the main manufacturers of micro-controller along with some details about their ranges of products. This is not an exhaustive list – please post comments about your experiences.

Microchip PIC

  • Microchip Technology have been produced billions of PIC microcontrollers. They are used in numerous consumer appliances as the control ‘brains’.
  • Development tools (such a PIC programmers like the PICkit2 and PICkit3) are available at very reasonable cost.
  • An Integrated Development Environment (IDE), called MPLAB is available free of charge. This is a very powerful environment. MPLAB IDE X has been released which is multi-platform and open source.
  • A number of C compilers are available. The C18 compiler is free of charge, open source and not limited by code size, but it has reduced optimisation after a 2 week trial period. there are different versions for the different chip families (PIC18, PIC24, PIC32). Cost for the full version of the PIC18 version is $500.

There are three main families which are suitable here:


  • These are 8-bit devices, but at the top end of the 8-bit device range. They have a 14-bit instruction bus. There are 63 different PIC18 micro-controllers which have >32K program memory, USB connectivity and >512 bytes eeprom.
  • Some have USB, ethernet, SPI, I2C and CAN bus interfaces built in.
  • I am familiar with the 18F4550 device (32K program memory, 2K RAM, 256 EEPROM, USB) , costing around £3-5 each.

PIC24 and dsPIC

  • These are 16-bit microcontrollers. They have a 24-bit instruction bus. They can perform single cycle multiplication (16 x 16 bit). They can support USB on-the-go. 12 Bit ADCs are available built-in.
  • The dsPIC range has been especially design for digital signal processing.
  • In the range of £3-£8 each.


  • These are 32 bit devices. Some have full 10/100 Ethernet connectivity, multiple full speed USB buses, SPI, CAN etc etc. Running up to 80MHz. But they only have 10-bit ADC.
  • In the range of £5-£10 each.

Atmel AVR

  • Atmel has a large range of 8 bit and 32 bit devices. Their products are used in the Arduino development board.
  • They have an IDE called AVR studio (on version 5.0). Again there are three main ‘flavours’ that we might be interested in:


  • 8 bit devices.
  • High performance
  • Around £1-£4 each


  • 8 bit devices. Some of the higher-priced units have USB connectivity.
  • ATmega328 (used in the Arduino Uno) is around £3-5.


  • 8 and 16 bit devices. Have USB connectivity. 12-bit ADCs used.
  • Around £6-8 each (for ATXMEGA128 with 128K memory, 8K RAM, USB).


  • 32 bit devices. Apparently the worlds most efficient. with Ethernet, USB, multiple ports etc.
  • Around £7-12 each (for AT32UC3A0128 – 128K memory, 32K RAM, USB, Ethernet)
  • (Lady Ada has done a good article on Atmel AVR vs Microchip PIC here answering a lot of questions about these two microcontrollers, she prefers the Atmel AVR)

ST micro-controllers

These come in 2 main families:


  • A range of 8-bit micro-controllers. They do not have USB connectivity built-in. They are designed for efficient multiplication.
  • Relatively inexpensive at around £1.50-£4 for 128K program 6K RAM device.


  • These have an ARM Cortex M3 core. They support Ethernet and On-The-Go USB. Has 12-bit ADCs.
  • Cost is around £6-£10 (STM32F101C6T6 is £6 for 32K program memory, 6K RAM, 10 x 12bit ADC channels)

Texas instruments

  • Their programming and development tools include:
  • Code composer
  • Based upon open source. Two versions – one is full featured and paid for, the other is code size limited (16K) and only supports MSP430 range and TMS320C2800. This is Windows only.
  • IAR embedded workbench
  • The free version is code size limited to either 4K or 8K (depending upon the device). This is for windows only.
  • Texas Instruments have a range of micro-controllers. The main ones we might be interested in are:

16 bit devices

  • Based upon the MSP430 microprocessor design. Very low power.
  • Cost is around £6 for 8K program memory and 512 bytes RAM.

32 bit devices

  • Based upon ARM cortex M3 core. Has multiple serial interfaces. 10bit ADC. Built in temperature monitor.
  • Around £8 for 64K program, 16K RAM (type: LM3S1133-IQC50-A2)

Development tools and boards

There are a large number of development tools to help get started with a project. These include:

  • Arduino
    • The best-known microcontroller development board.
    • Based on the atmel AVR microcontroller
    • Has a huge active group using this technology
    • Designed to be very easy to use and get started
    • Fully open-source
    • Many code samples
    • Very simple
    • Java based easy to use IDE environment
    • Requires a boot loader
    • Uses their own programming language, but simple for C, C++ and Java coders
    • Cost is around £20 for the simplest development board (UNO).
  • chipKIT Max32
    • Based on the PIC32
    • 512K program memory
    • Amazingly powerful (4 x performance of best Arduino)
    • From Diligent Technologies
    • Pin compatible with the Arduino shields
    • Can use code written for the arduino, along with code from MPLAB
    • Cost is £36
  • MikroElectronika
    • Huge range of development tools for PIC and AVR
    • Lots of plug-in modules for additional functionality (eg LCD, touch pads etc)
    • Supply their own C compilers and programming environment
    • Various prices for the numerous products
  • Xino
    • Available for PIC (using PICAXE or Swordfish) and AVR (using Arduino bootloader)
    • Inexpensive
    • Does not have on-board USB connectivity – must have additional cables (FTDI for AVR)
    • Cost is around £10 (kit – PCB and pre-programmed Atmel AVR IC)
    • Basically a PIC with a bootloader
    • Bootloader is not open-source or available, so must buy ICs from PICAXE
    • Programmed though serial port (or with USB-Serial adaptor or FTDI lead)
    • Very simple and cheap lead for serial to device
    • Uses their own programming environment – very easy to use and get started (similar to basic language)
    • Cost is in range of £2-£10 for a programmed IC. Development boards and kits are low-cost.
  • Parallax propeller
    • Interesting concept from Parallax
    • Multiple (8) 32-bit micro-controllers working in parallel to do tasks.
    • Incredibly powerful
    • Around $5-8 per IC
    • They also produce the STAMP basic
  • mBed
    • Uses ‘cloud’ based programming
    • Must be web connected to work on programming
    • Cost around £40
  • LPCXpresso
    • From NXP
    • Uses ARM-based CORTEX microcontrollers
    • Free software is code limited (to 128K)
    • Very cheap and powerful unit
  • STM32 Discovery
    • Free software is code limited
    • 32-bit device used
    • 128K program memory, 8K RAM
    • Uses a STM32F100 value line microcontroller
    • Based upon ARM Cortex M3
  • TI Launchpad
    • Free software is unrestricted for the value-line microcontrollers
    • Includes 2 x MSP430 ICs
    • Cost is just £3 for the development board….

(Hack-a-day have done a list of development boards and their features here.)

Micro-controller choice

There is no single correct micro-controller choice. Each manufacturer has advantages and disadvantages. This project should not be dependant upon any one micro-controller manufacturer.

This is what is wanted from the micro-controller:

  • open-source programming tools
  • inexpensive
  • >4k program memory
  • Open-source programming environment which is not code limited

The Arduino development board and environment (based upon ATMEL micro-controllers) has a huge user-base. It is open-source and free/very inexpensive to start. All code examples are open-source.

For these reasons I have chose the Arduino IDE as the basis for this project.

The initial design will be based upon the ATTiny 25/45/85 range of micro-controllers. These have 2/4/8k of program memory. They are 8 pin devices with analogue inputs. They are relatively simple and in-expensive (around £2 per unit).

The Arduino programming language and an Arduino board can be used to program these devices, as shown in this article. This means that the code and the programmer are within the range of most people.

For future, more complex, designs the Arduino board may be used as the basis of the device, but low power options must be investigated.

UPDATE (5/4/2017): This project has been taken forward using the Arduino Nano microcontroller unit. This is small footprint but fully functional 32K/2K/1K ATMEGA328 based micro-controller unit.

This unit is low cost, easy to obtain and easy to upload new code to the board.

Leave a Reply

Your email address will not be published. Required fields are marked *