Introduction: True Atmega Standalone, Running Without Crystal Oscillator (Arduino)

I recently ordered a bunch of Atmel Atmega chips, 328 to be precise and as soon as i got them i realised i was lacking some very important components to make these chips function. The 16mhz crystal and the two 22pf capacitors to accompany it. From previous knowledge of the Atmel chips i knew some of them contained internal clocks, i hoped that the atmega did to. After some research i found it was possible to run an atmega completely on its own, save power and a sketch of course.

This instructable will inform you how to run any atmegaxx8 series chip on its own.

Requirements:
Arduino
Atmegaxx8 (doesnt matter which one but i prefer the 328)
Breadboard (circuit on bottom left is irrelevant)
Jumpers
Computer
USB Cable
USB-FTDI/USB-TTL (optional)
LED and resistor (optional)

Step 1: Breadboard

The breadboard setup is fairly simple and requires minimal components, none at all.
I have included a resistor on pin 14 or digital pin 8, purely to test my chip.

Step 2: Computer Setup

The computer side of things consists of a few easy steps but many people seem to get the wrong folders, make sure you are sure.

STEP 1.
Download the bootloader files from here.

STEP 2.
Go to wherever your arduino sketchbook is and create a new subfolder titled 'hardware'.

STEP 3.
Extract the downloaded file Breadboard.zip into the new hardware folder you created.

STEP 4.
Restart/start you arduino programming environment and you should see in tools-boards a new entry called arduino on breadboard

Step 3: Computer-Arduino Setup

Make sure to plug in your Arduino with the breadboard setup and have the ide running when doing these steps.

STEP 1.
Under boards select the new arduino on breadboard entry.
STEP 2.
Under programmers set it to arduino as isp
STEP 3.
Under examples you will find an example called 'arduino isp' upload to your board.
STEP 4.
Under tools click burn bootloader, this can take a few minutes so dont think its not working.

When this is all complete, you should have a chip that can function like a normal arduino but without the clock.

Step 4: Uploading Sketches

There are two ways of doing this, either with an Arduino or a USB breakout board type thing.

The Arduino way is detailed in the image.

The USB way is to connect TX to RX and RX to TX between the chip and your breakout board and just upload from there.

This is where you may want and LED, just to test its working.

I also like to print out a sticker for the chip so i know which pins are which, if the one below doesn't work inbox me and ill fix it.

Comments

author
vanofham (author)2016-08-30

Hello, I was wondering if this would work for an atmega168-PU. I tried, but when I got to the burn bootloader step, it gave me an error. The error was:

avrdude: Expected signature for ATMEGA328P is 1E 95 0F

Is there something in the file I need to change?

author
AlistairM (author)vanofham2016-08-31

Well I've never worked with the 168-PU but my guess is you need to edit the bootloader file to match the specs of the 168, seeing as it is slightly different to the 328. I'm sorry i cannot help much more than that I'm afraid.

author
truglodite (author)AlistairM2016-10-03

The 168 and 328 use the same bootloader:

ATmegaBOOT_168_atmega328_pro_8MHz.hex

I believe vanofham's problem was in the coding:

avrdude -m328p

should be something like (for the 168):

avrdude -m168

;)

author
truglodite (author)2016-10-03

Just a heads up... I discovered a missing line in the linked board file (boards.txt inside Breadboard.zip). I added this line to the file and now I'm happily uploading to my 328p chips with IDE 1.6.8:

atmega328bb.upload.maximum_data_size=2048

Hopefully others may read this and avoid the hours of headache I went through troubleshooting serial upload errors. Regardless, thanks to the OP for sharing... this instructible taught me how to do custom boards with the new IDE (I was using 1.0.5 for custom boards until your I read this LOL... so much easier now THANKS!).

author
vikas vijayan (author)2016-06-20

Can I use any sketch unloaded atmega328 through breadboard without arduino? How can I do that ? How can I power the microcontroller? Which pin?

author
monusuthar2016 (author)2016-06-10

is this work with atmgea8????
please reply

author
JEWELJ5 (author)2016-04-28

Hi,

i'm using an ATmega328 with its internal 8MHz clock for my project.

While bootloading there was a signature mismatch error.I just changed the sinature in the avrdude.conf file and overcame that error.

Now the chip is working perfectly ,and i can program it using a FTDI breakout.

but the problem is i cant receive or transmit nothing using the serial monitor.

can this be the problem in baud rate mismatch?

please help,i cant do myproject without serial monitor

author
WasimA22 made it! (author)2016-04-16

Its IDE bug, they should remove Uploading... when its fail

Screenshot_2.png
author
victor.valadez.547 (author)2015-04-23

Actually there is a much simpler way to program a stand alone AVR using an Arduino board. Read this tutorial:

"Arduino Uno R3 as a true ISP programmer for any Attiny and Atmega AVR"

see:

No hardware removal is needed. No boot-loader has to be first loaded in your target AVR. You can simply program the Attiny or Atmega micro-controllers, existent on the breadboard, directly with the hex file generated from the source code you wrote (Blink a led, for example).

author

indeed, this is simple and less hassle, tried on 16MHz standalone, going to try on 8MHz now

author

indeed, this is simple and less hassle, tried on 16MHz standalone, going to try on 8MHz now

author

indeed, this is simple and less hassle, tried on 16MHz standalone, going to try on 8MHz now

author

the idea here is to have an atmega that can be programmed easily from the arduino ide, using no external parts.

author

The tutorial "Arduino Uno R3 as a true ISP programmer for any Attiny and Atmega AVR" is also valid for programming a stand alone AVR that uses its internal oscillator and has no external crystal and capacitors attached.

author
Axinarb (author)2015-03-23

hi, i have the 1.6.1 version. i get an error message:

Error while burning bootloader: missing 'bootloader.tool' configuration parameter

any ideas?

author
ArifSae (author)Axinarb2016-03-10

check last part

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

author
aditya jindal (author)Axinarb2015-05-31

I have the version 1.5.1. I also get the same error

author
AlistairM (author)aditya jindal2015-05-31

The only solution I found was to revert to the older version. I know the arduino companies are having issues and software versions are doing funny things. I got exactly the same issue myself.

author
Dimitris Platis (author)Axinarb2015-05-29

Until they have fixed it to work with the standard way of adding custom hardware to the arduino IDE here's what you can do:
1. Locate your arduino installation folder
2. Inside the hardware directory, find the boards.txt file. Mine (on Ubuntu) is at (/arduino-1.6.1/hardware/arduino/avr/)
3. Append the following at the end of the boards.txt file and it will work as instructed here. :)

##############################################################

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=arduino
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.maximum_data_size=2048
atmega328bb.upload.speed=57600

atmega328bb.bootloader.tool=arduino:avrdude
#atmega328bb.bootloader.tool=avrdude

atmega328bb.upload.tool=avrdude

atmega328bb.bootloader.low_fuses=0xE2
#atmega328bb.bootloader.low_fuses=0xFF
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05

atmega328bb.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
#atmega328bb.build.core=arduino:arduino
atmega328bb.build.core=arduino
#atmega328bb.build.variant=arduino:standard
atmega328bb.build.variant=standard
###Experimental name:
atmega328bb.build.board=AVR_BARE

IMG_0376.JPG
author
AlistairM (author)Axinarb2015-03-31

sorry for the wait, yes I've had exactly the same issue recently. I believe its due to the way the arduino ide handles extra boards. it will work if you download an older version and I believe there are some updated board files for 1.6.1. google it. hope I've helped in some way

author
sspence (author)2015-12-02

This process does not work on 1.6.5, boards.txt in the sketchbook/hardware folder seems to be ignored.

author
ArifSae (author)sspence2016-03-10

check last part

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

author
Smidge204 (author)sspence2015-12-20

Sorry for the late reply, but I ran into the same issue and I figured out the solution. So for the benefit of anyone who happens to see this...

Find the *actual* boards.txt that the IDE is using. For me it was in:

C:\Program Files (x86)\Arduino\hardware\arduino\avr

Edit the file (you may need to launch Notepad with admin privs), and copy-paste the contents of the boards.txt file attached to this instructable to the bottom of the boards.txt on your computer. Done!

author
davidvarner101 (author)2016-01-21

Do you need to download the bootloader files if your Atmega already has the bootloader?

author
AlistairM (author)davidvarner1012016-01-21

I believe so, this is essentially a new bootloader that you will then flash to the chip.

author
davidvarner101 (author)AlistairM2016-01-22

Ok, thanks

author
dj505Gaming (author)2015-11-14

I got the code to upload to the ATMega328, error-free, but nothing happens. I have the blink example sketch uploaded, and an LED connected to pin 13 with a resistor, and 5v being supplied, but it won't blink. I have ground connected to pin 15 and 5v connected to pin 16.

author
EduardoS77 (author)dj505Gaming2016-01-05

May need a 10k or so pull up resistor on Reset ( pin 1 ) to Vcc

author
thor.stormlord (author)2015-12-11

i programmed the bootloader just fine.

but im wondering if this chip will work on the arduino after the process or is it "hardwired" on internal clock afterwards?

i
prefer the second choice cause im making something very low badget and
dont want much external components since its not high tech.

my problem is that i cant upload a sketch on it.

btw you should use the hardware folder in program files

author
thor.stormlord (author)2015-12-11

i programmed the bootloader just fine.

but im wondering if this chip will work on the arduino after the process or is it "hardwired" on internal clock afterwards?

i
prefer the second choice cause im making something very low badget and
dont want much external components since its not high tech.

my problem is that i cant upload a sketch on it.

btw you should use the hardware folder in program files

author
RichardBronosky (author)2014-10-07

I've heard that using the internal clock introduced some inaccuracy that could compromise certain timing critical operations. Would this "naked ATmega" be safe to use as an I2C slave?

author
DaveM11 (author)RichardBronosky2015-02-11

The internal oscillator does lead to inaccuracies but I2C is one of those protocols that does not require a synchronized clock with the device it's interfacing with, so no I2C will not be adversely effected by the internal oscillator. The protocol that does require a higher level of accuracy is UART or 'Serial'. Without getting into too much details the faster your baudrate of your UART the more likely there is to be errors. So if you are going to use a UART with the internal oscillator just try out a baudrate like 115200 and see if there is garbage outputting to the Serial Monitor if so reduce the baudrate to 57600. I've personally seen garbage come out on 115200 but that was not consistent. It's probably because the oscillator is temperature dependant.

author
RichardBronosky (author)DaveM112015-02-11

Thanks for the info. I didn't know about i2c being tolerant of timing fluctuation. That makes me feel better about choosing it for my project.

author

thanks Dave my knowledge of the subject was not sufficient to help but I'm glad you did. we learn from each other

author

personally I've never dug into i2c but there is no harm in trying. you are tight to say that the internal clock is not as accurate as an external one.

author

"There's no harm in trying." Ha ha. That's usually true, but what I'm making is an altimeter for skydiving. There is actually a lot of harm in being wrong. By the way, I have successfully done this with [basically] the Leonardo chip as the host.

Programming AVR via Arduino Leonardo/Pro Micro: http://youtu.be/c4k59CFpYCA

author

I'd be worried too, more so about static electricity produced during free-fall, frying your circuit unexpectedly. It's an issue that many manufacturers have had to deal with.

author
zwebster (author)2014-11-29

When doing this i had a terrible time getting it to work. I kept getting the signature error. Upon further investigation i found that just putting a crystal between the pins 9 and 10 and rerunning the bootloader would fix my problem. other than that this was very helpful.

author
AlistairM (author)zwebster2014-11-29

I'm glad you got it working but the whole idea of this was to build it as barebones as possible, when you want to run one quickly cheaply and embedded with very minimal components. But as long as it works for you then that's great.

author
zwebster (author)AlistairM2014-11-29

let me explain further. the crystal was only needed when loading the bootloader. its not needed anymore making it exactly what you have described.

author
matiascoronado (author)zwebster2015-02-01

If you don't have any crystal, this is a workaround you can use:

1- Before to start the burn the bootloader, connect a jumper wire between the physical pin 9 (XTAL1) of your ATMEGA in the Arduino UNO board and the same pin 9 on the ATMEGA in the breadboard. This will feed temporarily to your standalone chip with a clock signal.

2- Burn the bootloader from the Arduino IDE menu.

3- Disconect the temporary jumper wire, and thats it. Now you can upload the sketches as usual with your Arduino UNO as an ISP.

author
FahmidaA (author)matiascoronado2015-02-03

My arduino and other components are working, i connected the wire as you mentioned, but still getting errors like this:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x9e

could you suggest me any possible solution?

PhotoGrid_1422974139257.jpg
author
matiascoronado (author)FahmidaA2015-02-03

I don't see the connection I mentioned in the picture you attached. The connetion have to be made between the "physical" pins

IMAG0010.jpg
author
AlistairM (author)zwebster2014-11-29

I apologise I misinterpreted your original comment. That's rather weird that you only needed it for programming, were you programming a blank chip or a previously boot loaded chip?

author
zwebster (author)AlistairM2014-11-29

Thats a good question. I do not remember if i got my chips with a boot loader on them or not.

author
BlueD2 (author)2014-12-17

avrdude: Send: 0 [30] [20]

avrdude: ser_recv(): programmer is not responding

avrdude: stk500_recv(): programmer is not responding

using an UNO, with correct board selected and programmer as ISP... any ideas?
IDE 1.05

author
AlistairM (author)BlueD22014-12-17

I think I know the cause, the board should be set as the atmega standalone one that you added earlier. The ide doesn't care what board you use as an isp only what boot loader it needs to burn, which is determine by the board setting.

author
BlueD2 (author)AlistairM2014-12-17

The board chosen when getting the above message was: ATmega328 on a breadboard. Should I be using a different option?

author
AlistairM (author)BlueD22014-12-17

sorry I must have misunderstood you initially. you are correct in having the breadboard atmega selected as your board. have you double checked your connections? it also doesn't hurt to re do the arduino as ISP bit.

author
BlueD2 (author)AlistairM2014-12-17

Checked connections, I did the following to error check (IDE 1.0.5):

1. Uploaded arduino as ISP to the chip on the arduino uno
2. Checked wiring on prototyping shield
3. Selected arduino as ISP in the programmer
4. Selected ATmega328 on a breadboard as board
5. Clicked burn bootloader under tools.

Still get the same result though...
I appreciate the help, any further ideas?

About This Instructable

107,977views

136favorites

License:

Bio: I am a young electronics hobbyist, interested in computers, rapid prototyping and electronics.
More by AlistairM:True Atmega Standalone, Running without crystal oscillator (Arduino)Arm Mbed Microcontroller BasicsArduino Clap Sensitive Light Control (The Clapper)
Add instructable to: