Introduction: 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.
5 years ago
A couple of comments:
1) re Ferrite bead on Vcca: AVR042 actually recommends the ferrite bead between the system power plane and digital Vcc, and the m328 datasheet recommends an actual inductor between Vcc and Vcca (as well as a separate analog ground plane.) How important these are to the average Arduino-like application is probably subject to debate.
2) The circuitry you have on RESET seems overly complex and a bit wrong. the cap, which avr042 says is only needed for especially noisy environments and probably interferes with both AVR debugWire and Arduino auto-reset. The pullup resistor should be at least 10k, in order not to interfere with debugWire (so say AVR042!) (The diode is important, though, and not present in other tutorials afaik. It's lack can cause mysterious problems with auto-reset.)
3) It'd be nice if this included an actual schematic as well as the fritzing diagrams, perhaps with the irrelevant pins removed.
Reply 5 years ago
Do you have a page number for the datasheet where it recommends the inductor? The word "inductor" does not occur anywhere in the datasheet. AVR042 actually suggests one ferrite bead on VCC and another one on AVCC.
Point 2 is very valid. I figure most people aren't using debugWIRE with the Arduino IDE and went with the 4.7k circuit they recommended.
You are probably right about the capacitor interfering with auto-reset. Anyone using bootloaders and serial should connect it to the DTR line instead of ground.
I might consider doing a schematic eventually if I get the urge.
Reply 5 years ago
In the most recent datasheet (Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf), the terms used are actually "Low Pass Filter" (section 5.2.7) and "LC Network" (section 28.6.2) The schematic 28-9 shows a 10uH inductor.
(It's just a nit, of course. Any circuit built on a breadboard is unlikely to need (or benefit from) this degree of attention paid to the Vcca)
Reply 5 years ago
Ok I see it now. This will be updated.
5 years ago
Thanks for the well done instructable.
I was excited to see your title. I thought "maybe finally there are instructions that don't show AREF connected to VCC (or AVCC)!", but it was not to be. Do you have a reference that suggests this connection is required? I'm convinced it's a bad idea but I could be mistaken. My understanding is that the AREF pin is for connecting something other than VCC as an analog reference , and connecting VCC there could short to the internal 1.1V reference if I happen to load a sketch that switches to the internal reference source.
Reply 5 years ago
Yes, you are absolutely correct. That was a mistake on my part. The capacitor should be there, but the jumper to + should be removed. I'll have to correct this when I get a chance.
It doesn't hurt anything to connect it like that unless it gets switched to the internal 1.1V reference according to 24.5.2 in the datasheet.