Suppose u have an Arduino board, and u want to run a code independently on another blank Atmega IC that u have (coz u dont wanna deploy ur UNO to some place where it doesnt need to b programmed again.. n a programmed IC cud fit d job well.. ).. then how do you go about the coding ?
Well according to the tutorials on the arduino site, as of now, u shudn have ny issues if ur board is not UNO ( => if ur board is older than that) .. But now, Uno is becoming the more common arduino platform .. and I have a Uno too, so I tried to get my AtMega8 (a 28 pin DIP ) run by programming it through the UNO.. and it worked.. 😀
So here is how u go about it..
On the left is my UNO with an Atmega328.
Now, the steps in brief :
- First of all, u need to burn a bootloader on to the atmega8, using the Arduino as an ISP (its ok if u didn understand this.. 😉 )
- Once the bootloader is uploaded, u can now upload a simple sketch like Led blink on the new IC, and check whether the program works by connecting the IC on the breadboard.
- Once checked on the breadboard, u can now go happy-soldering on a pcb.
But the procedure is a bit tricky, so lets get the hands dirty ..
Step 1 :Upload ArduinoISP code on ur UNO
Connect ur UNO to ur PC via the USB cable and go to File -> Examples -> ArduinoISP and upload this sketch.
Step 2 :Burn the bootloader
Connect ur Atmega (Atmega8 in my case) to the UNO via a breadboard as shown.
So what u need is :
a 16 MHz crystal
2 ceramic caps (18 pf or 22 pf or 33 pf)
a 10k ohms resistor
few jumper wires
and a breadboard.
( a better version of this cartoon is available at http://arduino.cc/en/Tutorial/ArduinoISP)
- Next, get an older version of the Arduino IDE (22 works & is available at http://arduino.cc/hu/Main/Software (older IDE versions) ) Donno why it doesnt work with the new IDE..
- then u burn the bootloader in 2 steps :
- Step 1: Select Arduino NG or older w/ Atmega8 Bcoz this board used Atmega8 and so the bootloader for Atmega8 would b selected.
- The bootloader should be burnt in a minute.. When the screen says bootloader uploaded.. u r half way through the work! 🙂
Step 3 : Burn the Blink code on the new Atmega8
Pull off the Atmega328 out of ur UNO and plugin the Atmega8 (b careful about the pin mappings (keep the notch side of the Atmega8 on the lower side of the UNO ) )
Now , go to File – Examples – Basics – Blink
Then go to Tools -Board – NG or older w/Atmega8
When the code is uploaded, u can check it right there as there is an LED on pin 13 of the UNO and it should start blinking by now.. 🙂
Step 4 : Time for breadboarding
The bare minimum connections required for an Atmega8 are as shown.
to this connect an LED + a 220 ohms resistor on pin 18 of the IC (it corresponds to dig pin 13 of the UNO ). Once done, it should start blinking.
If it blinks implies that ur power, reset and crystal circuit are alright.. 🙂 Bravo!
Step5 & final : Solder ur circuit on a pcb..
In my case, I had to turn on a relay after some interval and the soldered circuit is as shown..
Happy DIYing.. 🙂
useful links on the web :