Introduction: Arduino on All Sorts of Atmels

Picture of Arduino on All Sorts of Atmels


this is my first instructable, so I hope someone can do anything good with it.

So, what exactly is this about?
Imagine: You are working on a project. You want to program in the Arduino language because of the simplicy. But you don't want to use a 28 pin monster. Or you need peripherals like CAN or similar what the normal Arduino supported MCUs don't have. So, what to do? Where are two alternatives:
1. Just don't use the Arduino language and use things like bits and ports what you can't understand.
2. Or continue reading this!

So, this instructable is going to show how to use the core files available from I'm also going to show you how to program the different MCUs and how to connect them to do so. At the end I'm going to give some ideas on what you can to with your new knowledge earned from this.

As a little side note I want to say something; I'm just 14 years old, so please, if something is not as good as if an 40 year old engineer had done it, have mercy, write a comment about it and I will try to fix it.

If you have any problems, feel free to post a comment or drop me an email (jan[at]dalheimer[dot]de). If you can't figure out what to use instead of the [at] and [dot], I don't want an email from you.

I just saw that some MCUs use the ArduinoISP as default and some use the USBtinyISP as default. To see how to change, see step 5.

I want to say a big thank you to Mark Sproul for the modified core files at THANK YOU!

So.... Let's get started!

IMPORTANT: I give no warranty in any way for anything in this instructable. Some names like Atmel, ATmega etc. belong to their owners. Also almost all pictures do NOT belong to me.

Step 1: A List of That Atmels Can Be Programmed With This and That Is Needed

Picture of A List of That Atmels Can Be Programmed With This and That Is Needed

Now you know something about that this is about, but you wonder; what MCUs exact can I program using this instructable? First of all, only ATmegas, AT90s or ATtinys. Perhaps some day, PICs to. Or ARM. Or.. Or..
But for now, just MCUs from Atmel.

The frequency for each MCU can be found by choosing your MCU here, opening up the boards.txt file and then searching for your MCU. There will then stand yourBoard.bootloader.low_fuses=fuse and yourBoard.bootloader.high_fuses=fuse. Then copy the number that stands instead of fuse into the fields at the bottom of the page. Click "Apply Values" and then you can see what type and speed of crystal to use in the drop down menu further up on the page.

To find out that type of upload you should use, go to the AVR developers page and look that stands there.

So, here is a list of working MCUs, sorted by type and number:


== ATmega:


== ATtiny:


== Others:


Now you know what MCUs you will be able to program with this. But what do you need?

1. An ISP programmer. This instructable will use an Arduino as ISP, but I will add a category on how you can use other ISP programmers at the end of the instructable.
2. An USB <-> Serial converter or an RS232 <-> UART converter (only needed for programming MCUs with bootloader).
3. An breadboard. You can also solder on a perfboard or a custom PCB, but that is up to you and will not be covered here.
4. An computer. (I think you have one, otherwise you couldn't read this :))
5. The Arduino program. It can be downloaded from here .
6. The core files available at . See the next step for how to install it right.
7. The MCU to program.
8. Some really cool idea on that you want to do after reading this. (Optional, but recommend)

Step 2: Setting Up the Software

Picture of Setting Up the Software

This step is mainly about how to setting things up on the computer side.

First, if not already done, install the Arduino IDE from
Second, download the core files from . There is an instruction on how to install it right on the site, but to make it easy: just unzip the files to arduinoInstallPath\hardware there arduinoInstallPath is the path there you have installed the IDE.
Third, start the Arduino IDE and open File -> Examples -> Arduino ISP.
Fourth, connect your Arduino board to the computer.
Fifth, choose your Arduino board from the Tools -> Board and choose the serial port from Tools -> Serial Port.
Sixth, press upload.

Now you have set up everything on the computer side and made your ISP (Arduino) ready. You are now ready to start setting up your MCU to program.

Step 3: Program MCUs What Don't Have Bootloaders

Picture of Program MCUs What Don't Have Bootloaders

It will be different if you want to program MCUs without bootloaders or if you want to program ones with bootloader. For the ones without bootloader, continue reading directly, for the rest, go to the next step.

So, first, set your MCU into a breadboard. Open up the datasheet of the MCU to program (links on the second step). Look for the pinout and use this to connect VCC and GND to a 5V supply(this can be an Arduino). If there is an AVCC or AGND or similar, connect them to VCC (for AVCC) and GND (for AGND). Connect your Arduino to the MCU in the following way:

MCU          Arduino
SCK          13
MISO         12
MOSI         11
CS(reset) 10

Also connect an 10k resistor from the reset pin of the MCU to program to VCC.
And connect the XTAL pins to a crystal (see second step on that frequency) and with 22pF capacitors to ground.

After this you can start the programing!

Important : Remember the Arduino and the other MCUs do NOT have the same pin mapping. See this for what pin is that Port/Bit.

Step 4: Program MCUs With Bootloader

Picture of Program MCUs With Bootloader

Now we have arrived at the part for the programming of MCUs with bootloader. This is a bit more difficult than programming ones without bootloader. You can see witch MCUs have bootloader on the second step.

First, again, set your MCU into a breadboard, open the datasheet of the MCU and look for the pin out. Look for VCC and GND and connect them to a 5V supply. Connect your Arduino to the MCU after the following:

MCU           Arduino
SCK          13
MISO         12
MOSI         11
CS(reset) 10

Also connect an 10k resistor from the reset pin of the MCU to program to VCC.
And connect the XTAL pins to a crystal (see second step on that frequency) and with 22pF capacitors to ground.

Second, go to Tools -> Board and choose your board.
Go to Tools -> Burn Bootloader -> w/ Arduino as ISP . Now the bootloader will be burned onto the MCU. This may take some time, so do something good in the time like designing your next project or similar.

Then the bootloader is burned you can disconnect your Arduino from the MCU.

Now you can start the programming. For this you can use your Arduino again. Take out the ATmega328 (Arduino) from it's position and connect the reset pin of the Arduino to the reset pin of the MCU to program. Also connect Arduino pin 0 to the TxD pin of your MCU and Arduino pin 1 to the RxD pin of your MCU (see pin out in datasheet again)

You can also use an breakout board of the FT232. Connect CTS to ground if you do!!! If you do, connect like this:

MCU      FT232
Rx         Tx
Tx          Rx
Reset   RTS
VCC      5V

Connections not mentioned from the breakout board of the FT232 should not be connected.

Choose your serial port under Tools -> Serial Port . Open the code you want to upload and press upload. Done.

Important : Remember the Arduino and the other MCUs do NOT have the same pin mapping. See this for what pin is that Port/Bit.

Step 5: Using Another ISP Than the Arduino

Picture of Using Another ISP Than the Arduino

If you don't have an Arduino to use as ISP, there is another way. You can also use the following ISP programmers:

Parallel Programmer

To use one of these, you must do some things different. First of all; then burning the bootloader on MCUs with bootloader you must use Tools -> Burn Bootloader and then the ISP to use.
Then uploading code to MCUs without bootloader, you must go into arduinoInstallPath/hardware/arduino-extras/boards.txt and find your MCU. To find the right one can be a bit tricky, but if you use Ctrl+F and type the number (not the letters. for example: type 646 instead of AT90USB646 or 2313 instead of ATtiny2313 etc.) into the search field you should be able to find it. Then type type.upload.using=programmer, there type is the name of the MCU (look at the lines around) and programmer can be any of the following:

avrisp (AVRISP)
avrispmkii (AVRISP mkII)
usbtinyisp (USBtinyISP)
parallel (Parallel Programmer)
arduinoisp (Arduino ISP)

For example, in the boards.txt for the ATtiny2313 it stands:



Now add arduino_attiny2313.upload.using=avrisp, save the file, restart the Arduino IDE and voila!

If you need help you can write a comment.

Step 6: Pin Outs

Picture of Pin Outs

The pin outs are always like the following:

Digital pins:

Digital pin 1: Port A, Bit 0 = PA0
Digital pin 2: Port A, Bit 1 = PA1
Digital pin 8: Port A, Bit 7 = PA7
Digital pin 9: Port B, Bit 0 = PB0
Digital pin 10: Port B, Bit 1 = PB1
etc. etc. etc.

Analog pins:

The analog pins are defined like the above, but the ADC pin with the first register (after the alphabet; Port A is before Port B etc.) what has ADC and the first bit (bit 0) is analog pin 0, the ADC pin with the first register what has ADC and the second bit of that register is analog pin 1.
etc. etc.

PWM pins:

PWM pins have the same pin numbers as normal digital pins. To see witch digital pins are PWM enabled, look at the pin out in the datasheet. At some pins, there will stand "OC#@" There the # is a number and the @ is a letter. The @ is not always present. So on every pin there is stand OC + a number + a letter (not always) has hardware PWM.

Serial pins:

Serial pins are defined as RXD and TXD. Some times there are multiply hardware Serial lines. If this is present, TXD and RXD are Serial, TXD1 and RXD1 are Serial1 etc. etc.

Other pins:

To see that pins have I,,2,,C, SPI etc. look at the datasheet and search for the corresponding pins (I,,2,,C: SDA and SCL etc.)


The interrupt pins are labeled with INT#, there # is the number of the interrupt.

If anything is unclear, post a comment.

Step 7: USB and CAN

Some of the MCUs listed in the second step have onboard USB or CAN. For how to connect them, see here:


Just use 22ohm resistors between D+ & D+ and D- & D-. In some datasheets it doesn't stand D+ or D-, it stands DM (for D-) and DP (for D+).


There are many CAN circuits out there, with different ICs etc. Exchange nameOfDevice with the name of your MCU on this link. You should then find images with your device and CAN.


Bullitt4511 (author)2016-07-13

Thanks a million. Have spent countless hours searching for a pin explaination and have finally found this. Thanks to you, I can now finish my program. Great tutorial.

Jayson Intal (author)2016-04-05

Help please
I have some Attiny 26, Atmega 8au and Atmega 2561 au in my hobby box and I can't bootload them using this tutorial. what i got is just a lot of errors during compilation of the sketch.
My first question is, for those people who did bootload their atmega chips successful, what is your PC operating system and during that time what version of arduino ide you use?


AndiZehn (author)2016-01-13

Can anyone tell me how to get a Atmega169PA working?

I could only find this on :


But has not included the Atmega169PA (only Atmega169).

Can anyone help me please?

boop12343 (author)2015-09-30

Could you tell what changes to make to pin_arduino.h file to program an atmega128 using USBasp programmer.

I have programmed an atmega32 successfully using arduino ide but in this case the pin_arduino.h file was already available.

Thank You

Iqbal Samin (author)2015-09-13


I wanna use the third step on atmega32A. Is it possible? and which Crystal (XTAL) shall I use ?

Thanks for this nice instructables!


diy_bloke (author)2015-03-03

great work... but you haven’t solved one problem yet :-) The Arduino IDE doesn’t scroll... if your board is below the horizon of the screen in the arduino output, no way to get to it :-)

pastero007 (author)2014-07-19

i like your work dude please keep it up. thanks

decsam (author)2014-07-06


could you give more information about the bootloader for the at90usb646
in Arduino?

Build_it_Bob (author)2014-04-28

The best teachers are the ones who share the gift of knowledge that they have been given with others. You already show the character of a great teacher ...keep up the great work ; it is appreciated !


kamhagh (author)2014-01-06

thanks sooo much u saved me heart attack:D tought wont work for atmea32

agargrish (author)2014-01-04

hey boy? does it work on Atmega16??

3dotter (author)2013-11-04

Super Instructable!!!

3dotter (author)3dotter2013-11-04

What about the new Arduino IDE (vs. >1.0) ?

ironheartbj18 (author)2013-05-26

i was using usbasp with 168 ATMEGA like you said add on the program.txt arduino_attiny2313.upload.using=avrisp so i change lit bit by
ATMEGA168.upload.using=usbasp. it works. thanks for great instructable!

themroc (author)2011-03-20

It would be fine if you´d said, that the image is an ATtiny2313. To have a better access to this example try to have the pinmapping in a table.

A great job for a 14 Year old boy!


OCPik4chu (author)themroc2012-10-15

Pin mappings are on the mfr site for the chips, no reason for him to duplicate work for an indestructible with such a wide range of options.

WWC (author)2012-09-22

Have you loaded the blink sketch, chose ATtiny2313 board and tried to compile it?
It always throws a error for me. Has yours been compiling OK?


Higgs Boson (author)2012-04-30

I have been having a lot of trouble getting my computer to get any core files in the IDE. I have tried following this instructable and some others to add core files, but when I save the files to where the preference menu says my sketchbook is in, or even directly into the hardware folder in my arduino file nothing gets added. What could I be doing wrong?

Lord Fawful (author)2012-04-06

Would it be possible to change the fuses so the chip can use the internal Oscillator?

02JanDal (author)Lord Fawful2012-04-06

Yes, but then you would have to change some other things to, otherwise everything timing related (Serial, delay, millis etc. etc.) won't work.

Lord Fawful (author)02JanDal2012-04-06

what would i need to change?

02JanDal (author)Lord Fawful2012-04-06

I don't know exactly, but probably some things in the boards.txt, and also some of core files, but I couldn't say out of the head what exactly to change.

sarveshk (author)2011-10-27

Another thing, I also tried to flash ATmega32. I chose Penguino Board from the list, as it uses ATmega32 mcu. But the pin mapping of this board is totally messed up. You can find it's pin mapping at

I wish to add another board for ATmega32 with std pin mapping as shown in this instructable. How can do that? Do I just have to add another board profile in "boards.txt" or do I also need to add a pin mapping file in the core folder?

02JanDal (author)sarveshk2011-11-03

I would try to use the available pin mappings. Adding new ones is not just to edit the boards.txt file, you also have to create a set of core files (there you could perhaps use the ones for penguino) and you also have to create the new files for pinmapping.

That would be a lot of work, and I don't feel like explaining it.


sarveshk (author)2011-10-27

Please elaborate the pin outs. I am confused. Please make an PDF if possible for convinience.

02JanDal (author)sarveshk2011-10-27

Some day perhaps, then I have time, much time, but that is a very much work, but I'm working on pinout tables for some normal MCUs, like ATtiny2313 or the ATmegaxx8 family

sarveshk (author)02JanDal2011-10-27

Nice! Keep it up buddy!

Well, I am not able to compile servo program for Atmega16. Do you know how to solve it? It gives me the following errors

..\arduino-0022\libraries\Servo\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':

..\arduino-0022\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope

..\arduino-0022\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope

02JanDal (author)sarveshk2011-10-28

That is because different MCUs use different register names. The servo library from the Arduino IDE does only work for some MCUs, but for most, it generates errors.

I would recommend a google search. I'm sure you will find something.

jekkerdieschmekkerdie (author)2011-10-17

Hi There,

If an MCU doen´t appear in your list does that mean it won`'t work or that you haven´t tried yet?

I´d like to use a AT90PWM (which one exactly I'm not sure yet). you think that would work as the other AT90's?

Thanks in Advance

The list is taken directly from avr-developers, and it contains the MCUs Mark (and others perhaps) have tested. I can not say anything to the AT90s, as I have never used them myself.

francisroan (author)2011-10-15


thats wat i got so now wat should i do ???? id idnt understand wat u wrote so help??

02JanDal (author)francisroan2011-10-15

Sorry, but I don't really understand that it is you want help with. Perhaps you can specify some more details, like your operating system, the programmer you want to use etc.


francisroan (author)2011-10-14

i need to upload code to the attiny 2313 frm the arduino!!
and one more thing
can we just use the normal coding we use for arduino (arduino ide code?)

02JanDal (author)francisroan2011-10-14

Yes, the whole idea with this is you can use normal "arduino code" for other MCUs than the ones originally supported by arduino.

francisroan (author)2011-10-14

hey i downloaded the software the avr developers and then these came

after that wat should i do ????

02JanDal (author)francisroan2011-10-14

It stands clearly in the instructions.

dustinandrews (author)2011-07-28

Fantastic instructable. Two questions:

Do just the controllers with "USB" or "CAN" in the name have USB or CAN built in respectively?

What is CAN?

02JanDal (author)dustinandrews2011-08-08

No, basicly the MCUs with USB in the name or ending with u2 or u4 have USB, and the MCUs with CAN in the name have CAN. The best way to find out is looking at the product specs on atmels web site.

CAN is an industrial producol. Just do a quick google for CAN and you will find all info.


espert92 (author)2011-05-18

what would happen if I didn't connect CTS to ground?

02JanDal (author)espert922011-05-18

CTS means ClearToSend, and the computer may only send data if this pin is pulled low (to ground). So if you don't you won't be able to send anything.

But it differs, some computers don't mind CTS, while others do.

espert92 (author)02JanDal2011-05-19

I just programmed the bootloader for my atmega8 using the "Arduino NG or older w/ Atmega8". everything works fine until I upload the sketch. it says "avrdude: stk500_getsync(): not in sync: resp=0x30". help please? :P

02JanDal (author)espert922011-05-19

Check what you have the right frequency on the crystal used (if any), and make sure all connections are alright.

espert92 (author)02JanDal2011-05-19

I checked everything and everything seems to be okay. I used a generic usb-to-serial cable by the way. is that different from the ftdi cable?

02JanDal (author)espert922011-05-19

Ok that's the problem.

Normal serial cables use RS232, while the MCU needs UART/USART. They have different voltage levels.

Here is a link for a RS232 to UART converter: (the bottom left part)

espert92 (author)02JanDal2011-05-23

is this a reliable design for a converter?

02JanDal (author)espert922011-05-23

Yes, but I don't know that the wire from RS232 connecter pin4 to pin6 does.

espert92 (author)02JanDal2011-05-23

works like a charm. thanks. but I still need advice.

before your rs232-uart advice, my working setup was:
compile arduino programs into hex files using (
upload using usbtinyisp

the advantage of my usbtinyisp setup and disadvantage of the serial connection was:
no need to press reset button, and program runs right after programming,( unlike for the serial connection, program runs around 8 seconds after hitting reset, and reset needs to pressed before uploading

the advantage of the serial/official method, which is the disadvantage of the usbtinyisp/makefile method is:
all library files are used in compiling using the original IDE. unlike for my makefile which doesn't include certain libraries. also the original IDE works as planned in both linux and windows

so. is there anything I can do for the resetting dilemma? or the library dilemma?

espert92 (author)espert922011-05-23

amazing. I just edited the boards.txt file to use usbtinyisp intead. thanks 02JanDal. nice work

02JanDal (author)espert922011-05-23

Another way would to hold shift while pressing compile/upload and then finding the path in the output. Go to that path and find the *.hex file. Use that hex file to upload via avrdude.

But i'm glad it worked,

espert92 (author)espert922011-05-23

I heard that pin4 of the rs232 is auto-reset, is that correct? so my only problem now is how to remove the ~8 second waiting time for the program to run. do you have an idea on how to remove this wait time?

About This Instructable




Bio: I'm only 14 years old, so don't expect my instructables to be as good as if a 30 year old engineer had done ... More »
More by 02JanDal:Extra inputs for Arduino with a keyboardArduino on all sorts of Atmels
Add instructable to: