birds like wires

Pop search terms in here.

Showing 'microcontroller' tagged articles.

Feed the Birds

Revisiting Arduino Bootloaders

A couple of years ago, I put together an Arduino / ATmega-based project that really needed to skimp on power. There wasn’t a huge amount of documentation around at the time, but after some digging I managed to get the ATmega running at 8MHz using it’s own internal oscillator. Taking it one step further, I then dropped that rate down to 1MHz by recompiling the bootloader. Tada! That project ran constantly for many months at a time on a couple of D-cell batteries.

When it came to my latest endeavour I dug out the old bootloaders. No beans. Times have moved on a little in the Arduino world and the Arduino 1.0.5 IDE wasn’t playing with my bootloaders any more. I thought I’d narrowed it to a simple tweak of the boards.txt file, but apparently not. I’d never been completely happy that I’d not gone the distance and used Optiboot anyway, so before I knew it the source code was downloading.

Building Optiboot

The Optiboot bootloader is actually included in the Arduino IDE these days, but compiled just at 16MHz for the veteran ATmega168 / 328 chips and not actually available for use without some tinkering. So, I decided to replicate my earlier setup and create 1, 8 and 16MHz versions.

Continue Reading →
, ,

Saving Power with your ATmega

Image by 小宗宗 on Flickr

As many projects using an MCU end up running from batteries, it’s nice to have those batteries last as long as possible. There are a numerous different ways of doing this, depending upon your circuit, but there are two that I’ve been reading up on recently: reducing the clock speed of the ATmega, and sending it to sleep. These techniques might even be essential if you’re planning a solar-powered project.

On an Ardunio board, chip timing comes from a 16MHz oscillator; it probably looks like a little rounded rectangular can just north of the ATmega. This makes sure you get good execution and serial programming speeds, but if your project is simple or doesn’t require that speed, it makes sense to reduce the rate at which the chip is running. Fewer cycles per second should mean fewer milliamps required in use.

In my earlier article I wrote about running an ATmega168 at 8MHz using its internal oscillator to reduce parts. But what about dropping down to 1MHz?

Reducing Clock Speeds

Microcontrollers like the ATmega have a set of ‘fuses’ which control various operational parameters of the chip. These persistent values are usually set when you flash a bootloader and they determine the behaviour of your MCU, including whether to use the internal 8MHz oscillator and whether to divide that value by 8 for timing. Set a fuse bit appropriately and your ATmega will be running at 1MHz.

Continue Reading →
, , ,

Arduino Bootloader on ATmega168

Arduino / ATMega168 by Adam Greig

I’ve recently had cause to build a very simple microcontroller-based project. I like the Arduino platform, so I wanted to burn the Arduino bootloader onto an ATmega168. To keep the circuit as simple as possible, I also wanted to have the ATmega168 use it’s own internal 8MHz oscillator, instead of having to provide a 16MHz one externally. One chip, some power, flashy LEDs; dead simple. Except, how to get that bootloader onto the chip?

The easiest way with the equipment I had around was to pop the Arduino ISP sketch onto a working Arduino and connect everything up as shown in the documentation. The image bottom-left shows the setup I was after. I then moved on to the Arduino to Breadboard documentation, which is lovely and clear, but does seem to have an important little thing missing.

The illustrations all clearly show an ATmega168 on the breadboard, but the archive that it links to only provides the settings for burning to an ATmega328. This doesn’t work with the ’168. It is possible to use the LilyPad Arduino w/ ATmega168 board configuration to burn the bootloader, but I found that this introduced a delay of about 10 seconds before anything happened when the chip was powered up or reset.

Continue Reading →
, ,