Monday, 31 December 2012

Fun with Arduino - Arduino on a Breadboard

How to remove the 'Arduino' from your Arduino project


In this tutorial, we are going to build a 'stand-alone' circuit that will allow you to run your Arduino code without an actual Arduino board.

The term Arduino actually refers to a system of components that include the board, the microcontroller, the boot-loader ,and the programming environment. It is a system designed to 'protect' the user from a lot of the complication that is part of microcontroller programming.

At the heart of the Arduino board is a microcontroller called the ATMEGA328P. The Arduino board acts like a space suit for the ATMEGA, providing life support and doing its best to protect the chip from damage.

At the end of the day, the Arduino is a development board. While you can make the Ardino a permanent part of you project, once you have finished with the development phase of your design, it is often cleaner and less expensive to replace it with a stand alone ATMEGA microcontroller circuit. This is what we are going to build.

The Arduino board has built in power regulation circuitry that provides a steady 5 Volts to the ATMEGA328P. But, since the Arduino is going bye-bye, we have to build our own power supply circuit. We also need to provide a clock source for the microcontroller.  The 16Mhz crystal and 22pF capacitors take care of that.

Parts required:

1 - 9v DC Power Adapter - 500ma or greater (Wall Wart)
1 - DC Power Socket (2.1mm or sized to fit the plug of your power adapter)
1 - LM7805 - 5 Volt regulator
1 - 1N4001 - rectifier diode
1 - 100uF (Micro-Farad) electrolytic capacitor - rated at 25v or more
1 - 10uF (Micro-Farad) electrolytic capacitor - rated at 25v or more
2 - 22pF ceramic capacitors
1 - ATMEGA328P microcontroller
1 - 16 Mhz crystal
Hook-up wire (22 Gauge - Solid)

(Optional)
1 - SPST Switch
1 - 220 ohm resistor
1 - LED

How it works


First take a look at the schematic.



Let's look at what this circuit is doing. The 9 volt power from your adapter is being fed to a 1N4001 diode. This diode will only allow current to pass in one direction so if the adapter is connected backwards, the circuit will be protected. The 7805 regulator then drops the voltage down to 5 volts and holds it there. The 10uF and 100uF smooth out any ripples in the 5 volt supply.

This steady 5 volt power is supplied to the ATMEGA328P chip. The 16Mhz crystal and 22pf capacitors supply a steady clock signal to the microcontroller. Finally, in 10K resistor holds the microcontrollers 'reset' pin high, so the chip will run it's program. It's a very simple circuit.

Choose your Power


A couple of notes about choosing a DC Power adapter. This circuit will accept a variety of power adapters, but 9 volts is a good choice. You could go a little higher but the extra voltage will just be wasted as heat from the 7805 regulator. You may need to add a Heat-Sink if you go too high. If you go lower than 9v you may find the regulator may have difficulty putting out it's full 5 volts.

Also check the current rating of the adapter. I am using a 500mA unit. This is a fair choice as it is the same rating as the USB port that was probably powering your Arduino not long ago. If your project is larger, you may want to go with a 1 amp unit.

Finnaly, check the polarity of your adapter. Most adapters have a symbol printed on the label that shows the polarity of the tip and sleeve of it's power plug. You can see the symbol in the photo below. This one is showing that the sleeve of the plug is positive. You can use either type, just make sure you wire up your jack accordingly.



Build it


This video provides a step-by-step guide to circuit construction.



You should now have a funtional ATMEGA chip on your breadboard happily running your Arduino program.

In the next tutorial, we are going to look at programming the microcontroller directly on the board. See you then.

11 comments:

  1. may I ask... why isn't the ISP socket used in the video ?

    ReplyDelete
    Replies
    1. Hi there. Thanks for stopping by. The ISP socket is included in the schematic to make the circuit workable even off of a breadboard. The breadboard is basically a giant socket so to add another socket on it is unnecessary.

      Delete
    2. thanks man!

      Delete
  2. Thanks a lot! I used your multisim diagram in my project report :P

    ReplyDelete
    Replies
    1. Nice! I hope you at least got an A.

      Delete
  3. Big THX! May I ask... Can i use instead of 25V capacitors 16V and 3.3V regulator instead of 5V? (And of course, it will be powered by a 2-6V)

    ReplyDelete
    Replies
    1. Hi There. 16V caps should be fine. I have not tested running from 3.3V but there may be issues trying to run it with the 16 Mhz crystal at that voltage. Also, you would want to use a 3.3v programmer.

      Delete
    2. Thx again. What do you recommend to use crystals with 3.3V?

      Delete
  4. Hi. I'm sorry Dave.

    I was thinking in make my personal Synth. But I have a just question:

    Is possible add a sequencer, the style drum machine?

    Sorry again, big thanks!

    ReplyDelete
    Replies
    1. Hi There. Anything is possible with a little ingenuity. What synth project are you working on?

      Delete
  5. I have tried the same method bot it gives an error:
    Error while burning bootloader,
    avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override
    this check.
    please help me...

    ReplyDelete