Intro: Breadboard Arduino the Right Way
There are literally hundreds of Breadboard Arduinos out there, so what is different about this one? Well there are several things that most of them and indeed even the Arduino itself aren't doing right. First of all, the analog supply is tied to the digital supply. There is a reason Atmel brought them out on separate pins. The digital section generates noise that can interfere with analog conversions. Atmel recommends a 10µH inductor and separate capacitor for AVCC to filter this noise. I did not use this inductor or the ferrite bead recommended for VCC, but if you're going to do lots of analog stuff, it's probably a good idea. The Stray inductances of the breadboard and jumpers do help some.
Another improvement concerns the RESET line. In order to allow HVPP mode, AVRs have no ESD protection on the RESET pin. So if you aren't high voltage programming, it is recommended to use a diode to help protect against ESD. All of this is covered in AVR042: AVR Hardware Design Considerations. Apparently few people are aware of this document.
Another common practice is to place a capacitor directly across the switch on the RESET line. This can generate high voltage spikes according to AVR042. This is not done so much with AVRs, (probably because it kills them outright) but is often seen with many other micros and even on manufacturer's dev boards. Relying on the ESD protection in this way is just bad design in my opinion.
Step 1: Gather Materials
BOM for this project:
- (1) 630 (830) hole solderless breadboard
- (1) Assorted breadboard jumper wires kit or 24AWG solid core wire silver or tin coated
- (1) USBtinyISP, Arduino ISP, etc.
- (1) 6-pin ISP breakout or male to male DuPont wires
- (1) Atmel ATmega328P-PU AVR Microcontroller (28-pin DIP)
- (1) Green 3-5mm LED indicator
- (1) 1N914/1N4148 fast diode
- (1) 9mm shaft tactile pushbutton switch
- (1) 16MHz quartz crystal oscillator, 15-20pF
- (1) Ferrite bead (optional)
- (1) 10µH inductor (optional)
- (1) 10µF multilayer ceramic
- (4) 100nF monolithic ceramic
- (2) 22pF ceramic disc
- (1) 4.7k 1/4W resistor
- (1) 680Ω 1/4W resistor
- (1) 330Ω 1/4W resistor
For the switch, pay a little extra and get something decent. The commonly available square ones are unreliable garbage.
Step 2: Begin the Assemblages
Mount all low components and jumpers first. Cut component leads down to 8mm below the lowest point on the component body after bending. DO NOT CUT the leads on the 3 components used in the next step. Only cut them even but leave them at the maximum length. Be extra careful with the disc capacitors. The dip coating at the bottom is fragile and breaks off where it covers the leads if they are flexed.
Pin 1 of the ATmega should go into row 11 to make it easier to find pins. Pin 5 is row 15, pin 10 is row 20, etc.
One 100nF capacitor goes from A11 to GND, it's hard to see it in the photos. The 330Ω resistor is in holes D10 and D11. The Fritzing diagram makes it easier to see what goes where.
The other 100nF caps go in D17, D18, another in G17, G19, and another in H17, H18.
The jumper going to AVCC may optionally replaced with a 10µH inductor. If your analog measurements require it, it will help with noise.
The optional ferrite bead goes to VCC. Use it if there noise generating components, for instance 7400 series logic chips. Remove the VCC jumper and replace it with the ferrite bead.
Don't forget the jumpers connecting + and - across the board.
Step 3: ISP and the High Stuff
The taller components come next. These are the diode, the 4.7k resistor, and the quartz crystal. Be sure to observe the polarity on the diode. The cathode band goes on the + side. Yes it is supposed to be reverse biased.
When everything is in as shown and you are sure nothing is shorting out, it's time for the ISP squid wires. Pins 17, 18, and 19 on the ATmega are MOSI MISO and SCK respectively. RESET can go to J10 with this type of switch. VCC and GND are + and - of course.
Step 4: The Optional Bootloader
It is necessary to flash a bootloader into the ATmega to "upload" sketches from Arduino IDE. Otherwise it will only upload over ISP. Serial is much faster, but the bootloader takes up a little bit of the flash memory space that would otherwise go to your sketch and slows the boot process. Optiboot is recommended if you go this route and is very small. Personally, I forego the bootloader and just use ISP.
Another consideration is weather to power over ISP. For instance, the USBtinyISP has a jumper inside to power the target. Old phone chargers also make an excellent power source. USB breakout boards are available or just cut off the connector and strip and tin the wires if you're brave. I had an Android charger that caught on my leg and busted, so it was no problem. With squid wires leave out the VTG/VCC pin on the ISP when powering externally or leave it connected and take off the jumper.
Step 5: Conclusion
You're all done now. Upload the blink sketch for a test and the LED should begin to flash. I have an interrupt driven blink sketch somewhere. See if you can find it.