Arduino on a Breadboard |
In the previous post I showed threeways to reduce the cost of an embedded Arduino-based project: using one of the Arduino Pro variants, using a preloaded Atmega MCU and burning the bootloader yourself into a blank Atmega MCU. For the first option, a “Pro” board with a Sparkfun's FTDI adapter all you need to do is to plug the board in (making sure that GND pin on the board matches that of the adapter) and you're good to go. The only drawback is the price tag of $20. The last option is the cheapest, but requires an AVR in-system programmed, and if you have an AVR ISP, chances are you don't need me to explain how to use it. The “Goldilocks” approach is to purchase the chips preloaded with Arduino bootloader. This approach provides a good balance between beginner-friendliness and cost. This is the option I will be using in my open source projects. In this post I will show you how to build a basic Arduino circuit on the breadboard.
Power Supply
Most Arduino boards run at 5V. To provide the required voltage we can use one of the USB phone chargers that can be had for $5 or less. For a battery operated version we need to build a DC-DC power converted that can bring the voltage down to the regulated 5V we require.
Power Supply Circuit |
Important note: LM7805 has 1.2V drop, so to get 5V we need to use at least 6.2V supply. In practical terms this means either 5 1.5V alcaline batteries, 6 1.2 V rechargeable batteries or one 9V battery.
Microcontroller Circuit |
uController Circuit
Now that we have the power supply, let build the support circuit for the mictrocontroller. I'm using Atmega328 purchased from Sparkfun. The chip comes preloaded with Omniloader Uno. Additionally, Sparkfun includes a durable mylar sticker with Arduino pin functions that can be really helpful. Once you get the MCU, there isn't much to building the circuit. All we need is a 10-47 KOhm pull-up resistor on the reset pin (Pin 1 on the IC) connected to Vcc (V out), a 16 MHz crystal, two 22 pF ceramic capacitors for the crystal and .1 uF decoupling capacitor between Vdd and Gnd pins. I included the customary LED on pin 13 with 220 oHm resistor for debugging, but it can be safely omitted.
Please note, the crystal is connected between X1 and X2 pins of the uController and .1 uF capacitor is connected between Vcc and Ground pins.
Conclusion
As you can see, building an Arduino from scratch isn't too complicated. The only catch with this particular setup is that you need to take the chip out to program it with an existing Arduino board. A common approach is to use Arduino Uno or Duemilanove to create your gadget, and once its working, remove the chip and build the permanent circuit around it. Alternatively, the chip can be programmed in-system using the Arduino board. Finally, SparkFun.com sells a ATmega328 with Arduino Optiboot (Uno) chip that has the boot loader preloaded.
Please read the next post if you need help with Uploading Your Sketches
Hello
ReplyDeletenice post.
You can also build your own ftdi cable from a 2.50$ nokia phone cable :)
http://letsmakerobots.com/node/23728
Nicolas,
ReplyDeleteThank you for a great tip.
Yuriy