My Arduino Uno has a ATMEGA328P-PU microcontroller, and bunch of other stuff on the board. I'd like to program the chip without the Arduino software, and only the minimum of other components. I want to eventually create things without the cost of Arduino, and I want to learn about the other parts on the board and add them back as as needed. I'm comfortable with C and gcc, so I can probably figure out the software part. But what, if anything, besides these two products below, do I need to have in the breadboard with the microcontroller?
-
\$\begingroup\$ You could answer this question yourself by finding and reading the ATMEGA328P-PU datasheet. \$\endgroup\$– Phil FrostJan 11, 2013 at 13:20
-
9\$\begingroup\$ Maybe when I know more. The datasheet is 550 pages, I'm a beginner, and a skim revealed nothing to me. I do a lot of self-study, but I appreciate sites like this where I can get some answers from humans now and then. :) \$\endgroup\$– Rob NJan 11, 2013 at 14:05
-
10\$\begingroup\$ @PhilFrost That's the worst advice you could give to a beginner. \$\endgroup\$– capcomJan 14, 2013 at 17:34
-
3\$\begingroup\$ @PhilFrost While I agree with you that finding information is probably the most essential skill a beginner can have, especially with the plethora of information available thanks to the internet, opening a datasheet for the first time can be a little intimidating. Once someone more experienced answers their question and tells them where in the datasheet they found the answer, the beginner can re-analyze it themselves and start to gain some confidence. Also, the link you gave is not a datasheet. You told him to read the "ATMEGA328P-PU datasheet", not conduct a Google search for an answer. \$\endgroup\$– capcomJan 15, 2013 at 13:05
-
1\$\begingroup\$ OK, I'll rehprase. Rob, you should know that any manufacturer of a non-trivial device will publish documentation to answer exactly this question. The manufacturers have a clear interest in making it easy for you to use their product. Skimming the datasheet is the way to start. For complex things like microcontrollers, there might be a separate application note. "typical application" are the magic words you need to use in your search terms. It's not that it's bad to ask for help, but it's good to know how to fish. \$\endgroup\$– Phil FrostJan 15, 2013 at 16:28
3 Answers
All you need apart from the programmer and the chip is a couple of decoupling caps, and some way of connecting the programming signals to the breadboard.
So:
- 1 largish electrolytic cap (e.g. >100uF) You can maybe do without this if your source is nice and quiet (e.g. battery)
- 1 100nF ceramic across the power pins of the micro
- 1 10kΩ resistor to connect from the reset pin to Vcc to hold the micro out of reset.
- Some jumper wire to connect up nodes on your breadboard (you can buy ready made jumper wires, but I use a 22AWG roll and cut my own - much cheaper if you do this a lot)
- A header to plug your programmer cable into. According to the user guide it looks like you need a 2x3 pin 2.54mm pitch header.
Optional
- A button to connect your reset line to ground if you wish to physically reset the chip (I don't use AVRs, but I'm 99.9% certain the programmer can do this from the IDE)
- A crystal to use instead of the internal oscillator
- 2 * 22pF capacitors for the crystal (place from either side to ground)
- Passive components, LEDs, sensors, etc in order to do something useful with the code you write ;-)
Apart from the header (which is 10-pin with some unused pins - you can use the labels as a guide for your connections, the names are the same) this schematic is about the simplest I could find with a quick Google:
Funnily enough I just wrote a blog on doing pretty much the same thing with a PIC microcontroller (may be worth a look, the two are very similar)
-
3\$\begingroup\$ If we're talking absolute minimal, you don't need the pullup resistor on the reset line - the AVR has an internal pullup. And if we're talking advisable, you should include a cap on the reset line too - see this app note: atmel.com/images/doc2521.pdf . Also, the 2x3 pin ISP header you mention is much more common than the 2x5 shown in the schematic. \$\endgroup\$ Jan 11, 2013 at 11:04
-
1\$\begingroup\$ Thanks! If the 100nF cap is for the power pins, what is the >100µF cap for? \$\endgroup\$– Rob NJan 11, 2013 at 14:23
-
1\$\begingroup\$ @RobN the beefy capacitor is for power supply noise filtering / smoothing \$\endgroup\$– vicatcuJan 11, 2013 at 15:18
-
\$\begingroup\$ @NickJohnson - thanks for the finer points - feel free to edit my answer if you wish (as mentioned I haven't used an AVR, my small micro of choice is the PIC - or indeed an ARM like the STM32F10xxx more often nowadays) \$\endgroup\$ Jan 11, 2013 at 18:41
-
1\$\begingroup\$ If you use the Arduino framework, you also need a 100nF capacitor between the DTR signal from the serial-to-USB adapter and the reset line, otherwise you will be forced to hand-solder an adapter platine on perfboard with a 0402 capacitor because that is the only package you have 100nF available in, and nobody would ever do such a silly thing. \$\endgroup\$ Jan 11, 2018 at 20:18
I'm only posting this as an answer to hide the ugly URLs. You should certainly have a look at Atmel Appnote AVR042: AVR Hardware Design Considerations.
-
\$\begingroup\$ +1 for an excellent reference, I was looking for something just like this to complement the "general" small micro setup advice. @RobN - you should have a thorough read of this document. \$\endgroup\$ Jan 11, 2013 at 18:47
I also found this helpful link from the Arduino folks: https://www.arduino.cc/en/Main/Standalone It explains how to go from a chip you just got from DigiKey (or where ever) to loading the bootloader and the bare minimum support components.