Archive for the ‘Uncategorized’ Category

Burning Arduino Bootloader

January 11, 2013 1 comment

EDIT: I had written this a while back but never published. There must’ve been more things I wanted to write, but it’s been over a year and I simply forgot what I wanted to add. So here you go…


If you bought one of many Arduino clones out there, chances are, the bootloader is not burned into the chip. If that’s the case, you can’t use it out of the box with the Arduino IDE and you won’t be able to upload those sketches. Now, you can only burn the bootloader firmware using the ICSP programmer such as avrispmkII.

It was a bit of a pain to get it working. In the end, I had to drive the avrispmkII from linux machine using the Makefile provided with the latest Arduino v1.0 download. Under the directory hardware/arduino/bootloaders/atmega, I had to make some minor changes to the source code ATmegaBOOT_168.c.

The changes required in this file can be found at this following url: Basically, you modify the #if defined preprocessor directive to use the macros that are defined.

Once the source is modified, just run “make atmega328_isp“, which will compile the bootloader source code, create the hex, and then proceed to upload the .hex file into atmega328 chip using the ICSP programmer. The Makefile issues these avrdude commands to setup the fuse bits and then upload the hex.

# fuse settings
avrdude -c stk500v2 -p atmega328p -P usb -b 115200 -e -u -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xDA:m -U lfuse:w:0xFF:m

# burns the bootloader and then locks it
avrdude -c stk500v2 -p atmega328p -P usb -b 115200 -U flash:w:ATmegaBOOT_168_atmega328.hex -U lock:w:0x0f:m

The second command takes a while to run. And it also complains with errors like:

avrdude: stk500v2_recv_mk2: error in USB receive

You just have to wait and let it finish.

Once that’s done, you’ll have the bootloader burned onto the atmega328p chip, and will be able to use the Arduino IDE to upload the sketches onto it.

Categories: Uncategorized

ANT+ Between MSP430 (also Arduino) and Android

November 27, 2011 33 comments

ANT+ what?

ant+ logoSmartphones are equipped with dizzying array of wireless communication capabilities.   Some of these features just go totally unnoticed. One such wireless communication protocol is called ANT+.

A friend of mine wanted to make a working prototype of an idea he had using ANT+ technology. While there are other mcu’s (read atmega/arduino) already had some libraries and code written for communicating against ANT+, it wasn’t enough for me.

  • Most of the existing code only worked as a slave, where it just tried to receive data sent by Garmin Heart Strap.
  • This slave implementation was only on either arduino or PC (python and C)

What I was more interested in was to leverage the ANT+ radio to not just receive data, but also send data. I wanted the mcu to interact with the world and use ANT+ to transmit data to my cellphone, for example. I couldn’t find any suitable implementations, and figured msp430 needs to have more “hacks” to add to its list.

So here goes. I bought two different Sparkfun products for ANT+. Both TI and Nordic has chips with ANT+ capabilities. The Sparkfun ones use nRF24AP1, and comes in 2 varieties.

I used the lesser chip that comes with the Launchpad to drive the ANT+ breakout as the master node. The usb stick will serve as the slave and used as debugging tool. Once the initialization hand shakes and data transmission is sorted out, I can test on the Android platform.

As of this writing, only Sony Ericsson makes phones with chips that can talk ANT+. I found Xperia X8 to be a good low-end unlocked Android phone just for general purpose hacking, with the full ANT+ capabilities onboard. In order to enable ANT+ wireless, you need to download these apps:

Here’s the video of my test setup running.
And all the relevant source code and documentation is hosted on github:

Read more…

Categories: Uncategorized

Nokia LCD + WiiNunchuck with MSP430

January 3, 2011 12 comments

I bought myself couple of msp430 Launchpad’s when they first came out. At $4.30 with free shipping from TI, it’s one heck of a deal for what comes in the package. I wanted to use the lesser of the two mcu’s that comes in the package to do something cool. I first worried about 2kB flash size being an issue, but I was wrong. The 16bit architecture yields smaller compiled text and it packs enough space to do build some serious applications. The number of peripherals and features these mcu’s support are rather generous and I found these mcu’s quite pleasant/fun to work with.

Having the option to develop in linux was important to me. With msp430-gcc and mspdebug, I had all the toolchain necessary to start coding for these little suckers. So I wanted to see if it was possible to make a simple hand-held gaming device with just one chip. This required a small LCD screen and a user input device like Wii Nunchuck.

The source code that produces that runs the setup above is available here:

The code is just barebones. It contains just enough to communicate with the LCD and Wii Nunchuck. Read through after the break for more details.

Read more…

Categories: Uncategorized

My First Complete AVR Project

November 18, 2010 1 comment

I’ve only dabbled at microcontrollers for about 1.5 yrs. Throughout this time it was mostly light tinkering, nothing serious. But my wife gave me a challenge. Build a digital clock with the parts I already owned – something our son can read.

So I created one, and was fortunate enough to get noticed by  Here is the link

And the original post at



Categories: Uncategorized