Recently I made a Yabbas arduino system ; this is a low cost arduino (7€) you can DIY. I’ve made it with a group of people from my city (look here) and my daughter. During this session we have finished the prototype but not had the time to flash the AtMega328P.
Now this is done using my Arduino Leonardo as an ISP programmer. I’ll detail the way I’ve done it here
Ardino can be used as a AtMega programmer by using a ArduinoISP sketch. This one is provided through the Examples.
- To start, I used the Arduino IDE version 1.5.5(beta). Then you have to load the sketch by opening menu file >> Examples >> ArduinoISP
- This one need to be modified for Leonardo shield as the ISP pin are different than on other shield
You need to modify the code to add the following lines :
#define RESET SS // Addition #define SCK 15 #define MISO 14 #define MOSI 16 #define RESET 10 #define LED_HB 9
This redefines the pinout.
- Next you have to burn this sketch. Firstly you have to select the target (Leonardo), going Tool >> Board >> Arduino Leonardo then select the right serial port. One done you can upload the sketch to the board.
- Now you can unplug the Leonardo and connect the Yabbas card
- Now, to burn the bootloader, plug the Leonardo, go to Tool >> Board select “Arduino Pro or Pro Mini” which correspond to Yabbas and in Tool >> Proc select AtMega328 (5v). Select in Tool >> Programmer >> Arduino As ISP. To finalize, click on Tool >> Burn Bootloader
- During burn, you should see Yabbas green led blinking fast.
- Once burn is accomplished, the green led is blink 1Hz
- It’s Done !
The next step was to put it on a board : it looks like this
There is also another way to burn the bootloader manually by using avrdude directly on command line.
On Mac Os X you have to open a terminal, then go to the right directory : /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin and launch the right command :
./avrdude -C ../etc/avrdude.conf -c arduino -p atmega328p -P /dev/cu.usbmodemXXXX -U flash:w:../../../arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex