arduino-standalone

Here is a recipe for using the atmega168 as a standalone arduino. It uses the internal oscillator of the arduino running at 8mhz, and is powered at 3.3 volts. I used this together with a xbee radio modem for my wind-up birds project.

You can find out more about how I used the minimal arduino to control a xbee network here.

The only external components needed is a 0.1µF capacitor and a 1k resistor.

The tricky part is to get the firmware onto the chip. You need some sort of avr-programmer, I use the avr-hid developed by Martin Howse.

avr-hid+connector

avr-hid+connector

This procedure is bypassing the bootloader which is used on the atmega chips that come with the arduino boards.

Different programmers use different layouts for the in-system programmer [ISP] header but for the avr-hid it is 1. MOSI, 2. V+, 3. x, 4. GND, 5. RESET, 6. GND, 7. SCK, 8. GND, 9. MISO, 10. GND

please read the instructions for your programmer carefully, there might be some headers for different settings.

I made a custom connector for the atmega168 since I needed to program many chips, also for outdoor use, but else you could of course just hook this up on a breadboard.

The connections:

MOSI – pin 17

MISO – pin 18

SCK   – pin 19

RESET-pin 1

Remember to also hook up ground and power connections.

The software:

Open the arduino application.

—-

Update (march 2011): If you are using Arduino 17 or later there is a slightly different procedure, since the Arduino environment is packed inside the application bundle. To get the address of the temporary file, use “verbose verify”, which means the arduino software logs everything it does when compiling the code, including the address of the temporary file, which is the last line from the verbose output. To access verbose output, simply shift click on the verify sketch button.

Copy the address of the temporary file, and then you can more or less follow the recipe below. However, avrdude is now contained within the arduino application bundle, and I haven´t figured out how to access it from a terminal application. Instead I just keep a copy of a pre-Arduino 17 folder, and use the avrdude which came with that version.

—-

Select lilypad as the board in the arduino tools menu. This is because the lilypad also runs at 8mhz.

Verify your arduino sketch, this creates a hex file in a tmp directory which will be used by avrdude.
Open a terminal program, you will access a program called avrdude to program the chip.

avrdude is installed with the arduino software (correct me if this is not the case for some platforms)
in the terminal, navigate to hardware/tools/avr/bin inside your arduino-0011 (or whichever version you are using) folder:
cd /Applications/arduino-0011/hardware/tools/avr/bin

copy the temporary sketch into this directory:

cp /tmp/build*/[filename].hex .
then after making sure your avrprogrammer is connected with a chip ready to get programmed, enter:

./avrdude -C ../etc/avrdude.conf -p m168 -c usbasp -U flash:w:[filename].hex -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m
It was a lot of contradictory information online about the fuse settings, but at least we have had no problems with the above settings.

If everything goes well you will eventually get this message: “avrdude done.  Thank you.”

Your minimal arduino is ready to be used!

This might be a useful diagram when programming and hooking up external components:

arduino atmega 168 pinmap from the arduino website:

17 Responses to “arduino-standalone”

  1. wind-up bird(s) « Conversations with spaces Says:

    [...] is a link to the first technical post related to the project, which covers how to program and hook up a atmega168 as a minimal arduino standalone, using the internal oscillator running at 8mhz and 3.3 volts. Possibly related posts: [...]

  2. How-to: Simple breadboard Arduino - Daily Buzz Says:

    [...] More about How-to: Simple breadboard Arduino [...]

  3. How-to: Simple breadboard Arduino | SquareCows Says:

    [...] More about How-to: Simple breadboard Arduino [...]

  4. in the spirit of piksel: a minimal arduino « Conversations with spaces Says:

    [...] first tech-post is about how to program and hook up a atmega168 chip as a minimal arduino standalone, consuming less power and being much cheaper. It uses the internal oscillator running at 8mhz and [...]

  5. FizzPOP! » Blog Archive » My First Arduino Says:

    [...] Standalone Arduino Once you’ve developed something it can be stripped right back to just one chip. [...]

  6. JT Says:

    I use this page as a reference in all of my Arduino hardware designs. This is a great compilation of all the things needed to have a working Arduino with only a few parts. (Shaving the oscillator saves you about a buck each.) It should be noted that without a precision oscillator, it is unlikely that the serial will work at any high baudrate due to clock synchronization issues.

  7. Making Coffee « Wire Jungle Says:

    [...] the board needs to be redesigned as a standalone, this has been done before. A minimal approach is too restrictive in this case, since the circuit will need an external [...]

  8. Jacob Fenwick Says:

    Thanks for the recipe, I managed to get it working!

  9. Tony Thompson · An AVR Powered Arc Reactor Says:

    [...] that in mind, HC Gilje has a great write-up on how to make a truly minimal arduino clone, using the LilyPad arduino [...]

  10. iphone serial communication « Conversations with spaces Says:

    [...] This works fine with the standard xbee, as it draws around 40mA. It would also work fine with a 3.3v based arduino, and also probably with the FIO (not sure how much current the combination of the xbee and atmega [...]

  11. j Says:

    I’m trying to use your arduino standalone setup.

    I’ve programmed an Atmega8 and Atmega328 (via USBtiny)

    When they’re plugged into the Arduino board, they run (blink LED 12)

    When I set them up alla arduino standalone, they don’t run.

    I’ve checked and checked; all the pins are hooked up right, the IC is getting power to the right pins.

    The only thing that is different is the capacitor I’m using. It looks like this one:

    http://quality-deal.com/osCommerce/images/CAP-003D.bmp

    Could that be the issue?

  12. Crowdsourced Arduino Q&A | Boomeroo Web Resources Says:

    [...] place it in your project. Here’s all you need if you don’t mind running it at only 8Mhz http://hcgilje.wordpress.com/resources/arduino-standalone/. Or.. here it is at full speed: [...]

  13. Crowdsourced Arduino Q&A - machine quotidienne Says:

    [...] place it in your project. Here’s all you need if you don’t mind running it at only 8Mhz http://hcgilje.wordpress.com/resources/arduino-standalone/. Or.. here it is at full speed: [...]

  14. Crowdsourced Arduino Q&A | dev.SquareCows.com Says:

    [...] place it in your project. Here’s all you need if you don’t mind running it at only 8Mhz http://hcgilje.wordpress.com/resources/arduino-standalone/. Or.. here it is at full speed: [...]

  15. Cool Wordpress Programmer images | ecommercewordpress.info Says:

    [...] minimal arduino Image by hc gilje how to program and hook up a atmega168 chip as a minimal arduino, using the internal 8mhz oscillator and running at 3.3 volts: hcgilje.wordpress.com/resources/arduino-standalone/ [...]

  16. Thinkin’ about the code | customfieldswordpress.info Says:

    [...] a atmega168 chip as a minimal arduino, using the internal 8mhz oscillator and running at 3.3 volts: hcgilje.wordpress.com/resources/arduino-standalone/ This entry was posted in WordPress Programmer and tagged about, code, Thinkin' by admin. Bookmark [...]

  17. On-board Diagnostic Between Mitsubishi ECU Using Arduino - DSM Forums Says:

    […] Here some of the tutorial how to make it: # Standalone Arduino / ATMega chip on breadboard # arduino-standalone | Conversations with spaces # Google […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 179 other followers

%d bloggers like this: