Thursday, December 4, 2008

Arduino on the AVR Butterfly

When I started my Itron meter reader project I had to get the AVR Butterfly up and running under AVR Studio. This was a little tedious but eventually I got it working. While I was doing that I thought that it would be useful to be able to run Arduino code on the Butterfly. I looked around a bit and found that there was a thread on the Arduino.cc forum about doing just this.

I went on with AVR Studio, but just the other day user Nick Lott posted some of the groundwork that sets up the Arduino IDE to work with the butterfly. After a bit of poking around with it to get the clock frequency and USART set up properly, it's working great. The AnalogInput sample even reads the light sensor and writes to the piezo speaker out of the box (the brighter the light, the faster it ticks).

I made the following changes.

Edit boards.txt to update to 8Mhz:
bfly.build.f_cpu=8000000L

This didn't seem to have any effect so I edited the butterfly\makefile to update to 8Mhz:
F_CPU = 8000000

Update 2009-Jan-30

I have written (or adapted code for) several classes to handle the Butterfly's hardware. The LCD, temp sensor, dataflash chip, and RTC clock all have easy-to-use interfaces now. The LCD class could be better, it needs some error checking and doesn't integrate with the Print class as nicely as it could, but it's quite functional.

The project is up on Google Code, feel free to check it out.
Post a Comment