After my trip to Creatron Inc (local toronto electronics shop) I really wanted to build my very own Arduino from scratch. I had already gotten and AVR pocket programer from Sparkfun’s annual free day so all I needed to buy was a few resisters, some capacitors, a transistor, a few switches and an Atmega chip. For this project, since it was going to be a learning experience I chose to go with the Atmega88 chips. They are exactly the same as the Atmega328p which are featured on the arduino, but they are slightly cheaper and have less storage.
Using Sparkfun’s tutorial #1 and #2 I was able to create my power attaptor and the chip circuit as well as program the chip with a test blink led program. This really amazed me how easy it actually was. There are only 4 pins that are needed to connect the chip and the AVR programer along with the power and ground.
I next wanted to solder the circuit to a prototype board so that I could cary it around with me. After a few hours of soldering and trying to find the best placement for each part I had a fully working Arduino. The only problem was programming the chip. Using C you can compile the code into a hex file and then load it to the chip but writing C is really tricky and finding the right values for each pin would be time consuming. Since I was used to the Arduino IDE I really wanted to use that to program my chip. After looking around the internet for a few minutes I noticed that the arduino team included support for usbtiny devices which is what I owned. The only thing I needed to do is change my boards.txt file from the arduino.app and add a few lines for my atmega88 chip.
=================================== ATMega168USBtinyISP.name=Arduino via USBtinyISP ATMega168USBtinyISP.upload.protocol=stk500 ATMega168USBtinyISP.upload.maximum_size=14336 ATMega168USBtinyISP.upload.speed=19200 ATMega168USBtinyISP.upload.using=usbtinyisp ATMega168USBtinyISP.bootloader.low_fuses=0xff ATMega168USBtinyISP.bootloader.high_fuses=0xdd ATMega168USBtinyISP.bootloader.extended_fuses=0x00 ATMega168USBtinyISP.bootloader.path=atmega168 ATMega168USBtinyISP.bootloader.file=ATmegaBOOT_168_ng.hex ATMega168USBtinyISP.bootloader.unlock_bits=0x3F ATMega168USBtinyISP.bootloader.lock_bits=0x0F ATMega168USBtinyISP.build.mcu=atmega168 ATMega168USBtinyISP.build.f_cpu=16000000L ATMega168USBtinyISP.build.core=arduino ===================================
After that I was able to easily select my atmega88 chip from the board’s selection in the Arduino IDE and then compile and upload my code all in one press. One thing that I did notice is that since the clock in the chip is at 1MHz, in order for the code to run correctly I will need to add a 16MHz crystal to the chip in order to get a working clock. Other then that I was really happy when the end result and I don’t think I will be buying another Arduino in the future. Oh by the way, this only costed me $6 to build