AVR 28 Pin 20MHz 32K 6A/D - ATMega328P

Atmel's ATmega328P 8-Bit Processor in 28 pin DIP package. It's like the ATmega168, with double the flash space. 32K of program space. 23 I/O lines, 6 of which are channels for the 10-bit ADC. Runs up to 20MHz with external crystal. Package can be programmed in circuit. 1.8V to 5V operating voltage!

AVR 28 Pin 20MHz 32K 6A/D - ATMega328P Product Help and Resources

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

2 Soldering

Skill Level: Rookie - The number of pins increases, and you will have to determine polarity of components and some of the components might be a bit trickier or close together. You might need solder wick or flux.
See all skill levels


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

2 Programming

Skill Level: Rookie - You will need a better fundamental understand of what code is, and how it works. You will be using beginner-level software and development tools like Arduino. You will be dealing directly with code, but numerous examples and libraries are available. Sensors or shields will communicate with serial or TTL.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

2 Electrical Prototyping

Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #627702 / about 9 years ago / 1

    What does 1.8V to 5V operating voltage mean? Does that mean that the chip is stable with an input voltage between 1.8V and 5V? If that Is true, can I safely power the chip with 4.5V (3 AA batteries) and not have a voltage regulator?

    Thanks in advance, -Rohan

    • M-Short / about 9 years ago / 1

      Yes, the chip is stable at 1.8V to 5V although faster speeds may not work at lower voltages (see datasheet). You should be able to safely power the chip with 4.5V, although a few words of caution. First is you don't want a power supply with spikes in it as that might damage the chip. AA batteries really shouldn't have spikes, but this is a general rule when choosing not to use a regulator. Second Alkaline AAs are 1.5V, but rechargeables are usually 1.2V meaning your total voltage on the chip would be 3.6V. The microcontroller will be fine with this, but make sure any peripherals, this will in theory limit the speed you can run the microcontroller although we often run this chip at 3.3V/16MHz even though that is outside of spec.

  • deemeetree / about 9 years ago / 1

    Hey! Can somebody tell me how those chips are programmed? For instance, what would be the program to make it work as a controller for light diodes in this SparkFun kit: https://www.sparkfun.com/products/13708

    I know it might be a lengthy subject, but maybe a short intro or a link to where I can read about those stuff?

    • M-Short / about 9 years ago / 1

      The short answer is to use an Arduino. The Arduino Uno is basically a development board for this chip providing you with things like a clock crystal, reset button, power regulation, and USB to serial adapter. But assuming you are using your own custom board, or putting that all on a breadboard or proto board the Arduino IDE is probably the easiest place to start. There is tons of example code for Arduino including example code for many of our boards. In fact the Simon kit you linked to actually uses this chip while running Arduino code.

      Arduino is a hard concept to explain because there are so many parts. There are the Arduino boards (and their clones) like the Arduino Uno(and the SparkFun Redboard) which provide you with the chip as well as supporting circuitry. There is the bootloader which is a piece of code that allows the chip to be easily programmed over serial instead of with a special programmer. Then there is the Arduino IDE which is a software development environment designed to make programming easier. Because the whole thing is open source you can put a copy of the bootloader on this chip if you want, and you can use the Arduino IDE whether or not you use the bootloader.

      In order to learn how to code in Arduino, we recommend the SparkFun Inventor's Kit, you can also check out the manual online if you don't want to buy the kit. The first few lessons are on how to blink and control LEDs which seems to be what you are looking for. You can also check out the code on the Simon Kit which you linked to since that is also written in the Arduino IDE. I've also included a few links for you to check out below, and if you have any other questions feel free to email our techsupport team at techsupport@sparkfun.com.

      What is an Arduino

      Installing the Arduino IDE

      Installing the Arduino booloader (or other code)

  • CY / about 14 years ago / 4

    What is the difference between ATMega328 and ATMega328p? What does the "p" mean?

    • KiwiJohn / about 14 years ago * / 2

      .

      • penguin359 / about 13 years ago / 3

        To clarify, the P means support for picoPower. Searching the datasheet for that term will help clear up a little more what the differences are.

        • NuDD / about 11 years ago / 1

          with the picoPower you can decrease the power need by the mcu during some of the sleeping modes (it deactivates the power supply monitoring). It is a deliberate action so if you don't use it the won't change anything.

        • Avatar / about 11 years ago / 1

          Does the Atmega328 without the "p" support Avrdude SPI? i don't see this part listed on the support device list.

          • MikeGrusin / about 11 years ago / 2

            Avrdude's 328 setting should work for all 328 variants. The 'p' doesn't affect ISP programming.

  • jpr / about 16 years ago / 2

    Double the ram (2k), and eeprom (1k), as well.

  • Member #457480 / about 10 years ago / 1

    Does this come pre-loaded with the bootloader???

    • M-Short / about 10 years ago / 1

      This does not come pre-loaded with any bootloader or software. We do sell this chip with the Optiboot bootloader as well. This is the same bootloader used on the Arduino Uno and the Redboard. If you are looking for a different bootloader you would need to install it yourself.

  • Member #601692 / about 10 years ago / 1

    Once already programmed with a sketch, do I still need the external 16mhz crystal for the standalone atmega328p to run normally?

    • M-Short / about 10 years ago / 1

      A bit late, but worthy of an answer. The ATMega328 has a built in 8MHz clock, you can use this clock at 8MHz, or divide by 2 or 8 and run it at 4MHz or 1MHz. Or you can use an external crystal (I believe up to 20MHz) which is much more accurate. The fuse bits are what controls whether you are using the internal clock or an external crystal, they also control whether you are dividing that clock or not. The chip does need to be configured to use a clock, and if it is set to use an external crystal and one is not there it will not work. But if you change the fuse bits to use the internal clock it will work. Keep in mind that your code is compiled knowing what clock speed you are using. If that clock speed changes all the timing will change (SPI, I2C, UART, PWM, delay, etc.), so your code may or may not work right.

  • GraysonR / about 11 years ago / 1

    Does this come pre-loaded with the bootloader?

  • Oddstr13 / about 11 years ago / 1

    Product Card: http://www.atmel.com/devices/ATMEGA328P.aspx

  • 16 BIT HOMEREW / about 11 years ago * / 1

    Has anyone used this as the main cpu in one of their projects? I need a Cpu capable of running a whole slew of motor controllers, other little Cpus and gadgets and gizmos. I need it to handle Gps as well. Would this work or should I wait for a different one to come along? Thanks, Eddie D.

    • Member #430885 / about 11 years ago / 1

      Propeller is good choice when doing lots of tasks at once: set each of eight cores doing a few tasks and don't worry about interrupts or other timing problems. Use C language and there is a good tutorial. Lots of objects/libraries for motor control, GPS, comm with other chips, etc. http://www.parallax.com/microcontrollers/propeller good fast tutorial: http://learn.parallax.com/propellerc

    • Member #197750 / about 11 years ago / 1

      These AVR processors are outdated for most robotics applications. I mean, these specs are 1990's vintage, at the same price as a much more powerful ARM chip*! It amuses me to no end every time someone tries to strap these to a multicopter and try and hack it into doing advanced flight calculations. If I were you, I'd snag the Maple or the Maple Mini for the application you described - it has multiple hardware UARTs, i2c and SPI ports that can run at the fastest bauds you could ever want; ideal for communicating with GPS modules at the same time you're talking to other widgets and gizmos.

      *= yes, I know the Maple is more expensive than this chip, but compare one to a full, store-bought Arduino...

  • Figured I would give my two cents on this processor. I have an Arduino Mega and wanted to move out of using it for projects. This seemed like a good start for using something that you can program in actual C and it is much smaller than the Arduino Mega. I hit some small snags with trying to interface to it. I used my Arduino Mega as an ISP, which probably makes things a bit more complicated than just using an actual AVR programmer. Will see how the processor holds up after it has been used for a while. So far processor has performed as expected.

  • IvanDeft / about 12 years ago / 1

    Hello! Please, answer: what difference with using other crystal? For example 16MHz? Can this make some internal errors, or this just make this chip slowly???

    • IvanDeft / about 12 years ago / 1

      Somebody, please answer! )

      • MikeGrusin / about 12 years ago * / 1

        20MHz is the maximum recommended speed., but you can always make these chips run more slowly. Around here we typically run these at 16MHz on 5V, or 8MHz on 3.3V. The slower you clock it, the less power it will use and it will run on lower voltage.

      • madara_x64 / about 12 years ago / 1

        Well it depends. Do you mean using this crystal with a 328 with the arduino boot loader on it or just a raw 328? If its the former, you'll need to tweak some settings but it can be done. A Google search for running Arduino on a 16Mhz crystal should give you the info you need.So long as the chip is configured properly for that clock frequency, it should run without a noticeable drop in speed. If I'm wrong, someone please correct me. If its the latter, sure, the chip will run "slowly" (depends on what you're comparing it against though), but 16Mhz is a good frequency for a great many number of things. Depends on your specific use case.

  • nodoubtman / about 12 years ago / 1

    Hi! I have arduino uno, can i upload the code using arduino to a ATMEGA328p chip??

    thank you! marC:)

  • Gen / about 13 years ago / 1

    Atmel says these have 8 A/D lines.

  • Member #284068 / about 13 years ago / 1

    I bought 5 of these chip to reprogram it using my Arduino as ISP. I try to burn bootloader with my MEGA 2560 and my UNO with no success. I always have this error: avrdude: Device signature = 0x000000 avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

    I'm sure i plugged it correctly. I put a capacitor between reset and GND too. What is the problem?

    • SuperCrackMunkey / about 13 years ago / 1

      I had this problem for a long time. Mine was fixed by pressing reset on my uno before burning the chips (after placing the capacitor). Also one of the chips I received from SF was bad. (I know this is an old post, but if it helps others its worth it)

  • Can anyone say what are the LOW and HIGH fuse values for Atmega328p to operate at 20MHz WITHOUT bootloader, When I read the fuse from Arduino UNO it showed as LOW FUSE=0xFF HIGH FUSE=0xDE these are the values for supporting bootloader.

  • Thimplum / about 13 years ago / 1

    Oops. Double post :(

  • Thimplum / about 13 years ago / 1

    Nice chip. I just burnt the Arduino bootloader onto it using another Arduino board as ISP.

  • Soshimo / about 13 years ago / 1

    Is this a drop in for the mega168? I can't find any eagle libraries that have this part and I've been scouring for at least two hours. The Sparkfun library does have a 168 in both TQFP and MLF packages though. If they are a direct replacement/drop in and the foot print is the same I will use that when I design the board. I really don't want to have to make my own since I plan on fab'ing these boards and I really don't want to spend 50 bucks on a couple of worthless coasters when I do my first run.

    • MikeGrusin / about 13 years ago / 1

      Try the MEGA8-P in the Atmel library. It should have the same pinout as the 328, but (always!) double-check against the 328 datasheet to be sure.

  • Member #161771 / about 13 years ago / 1

    I am a beginner and bought the arduino Uno as well as an extra one of these to use with the board. Is it possible to program this Microcontroller using the UNO then remove it placing it on a breadboard to carry out pre programmed code independant of the board ?

  • Promptcritical / about 13 years ago * / 1

    So no arduino boot loader?

  • UAV Dude / about 14 years ago * / 1

    If I wanted to use the Arduino dev board with an AVR ATMega328 without the Arduino bootloader (just programming in C), could I still program the chip via the USB connection (with some IDE) or would I need to use the ISP connection and some programmer to program the chip?

    • Istantinople / about 13 years ago * / 1

      I believe you can use an ICSP AVR programmer like this on your arduino.

      • Istantinople / about 13 years ago * / 1

        You can program one in C that does have the bootloader installed using the arduino IDE, or you can use AVR Studio (or whatever prefered IDE), AVRDUDE, and a command line workaround. There's a good tutorial for that here. If you reset the arduino right after starting AVRDUDE, you'll access the bootloader at just the right time and program your .hex file instead of whatever the bootloader would normally do.

        Your bootloader is necessary to program over the integrated USB/Serial connections on the board, but this is your best bet if you don't want to buy more hardware.

  • Dougie / about 14 years ago / 1

    I'm completely lost trying to get the Arduino bootloader on this. I've read about assembling a circuit with the crystal, setting 'fuses', I tried using an Duemilenove with an atmega168 and arduinoISP, still, Even though it says the bootloader was uploaded, when I take it out of the breadboard and insert it into my duemilenove, it won't upload any sketches. Only says stk500 programmer not responding.
    I'm willing to buy a header/programmer/whatever, this is frustrating. Help? Anyone? Bueller??

  • Member #148541 / about 14 years ago / 1

    I got three of these controllers from here. It's hell of mess. I am trying to use external occilator, the fuse settings i set are LB,HB,EB are FF,D9,FF.
    But its is freaking me out. I am totally disappointed. The controller is not picking up the clock. I tried every possible way. Then i soldered Crystal directly on this chip on 9 and 10 pin. It started working. But for rest of two controllers shill don't show any sign to pick up clock. I got alot of other contrllers of atmega i locally buyed from my country. all of them worked perfectly, but specifically buying from Sparkfun is really bad experince for me :@ :@ :@ :@

    • nebug / about 14 years ago / 1

      Make sure you have the loading caps (22pF) installed also. This could be your problem.

  • Tegs / about 14 years ago / 1

    does anyone know what the difference is between the atmega328 and the atmega328p? I've seen them at about a $1 difference per IC

    • Tegs / about 14 years ago / 1

      cancle this question, didn't see it was answered already :)

  • Digisynth / about 14 years ago / 1

    Noob question: Can this chip also read serial data that is sent at a diferent frequency than itself (for example 16Mhz)? If yes, also at a higher speed than 20Mhz?

    • Soshimo / about 12 years ago / 1

      Technically the fastest your bandwidth can go is half the frequency due to Nyquist cutoff. Since the Nyquist frequency is half the sampling rate (and you can't sample faster than the oscillator oscillates) then the best you can get is half your clock frequency. That being said, you can do nothing else in that time but sample. If you need to do any other operations your sampling frequency will drop and your Nyquist cutoff will drop as well. Sampling at double the expected rate is necessary to avoid aliasing. Check it all out here: http://en.wikipedia.org/wiki/Nyquist_frequency

    • ThinkerT / about 14 years ago / 1

      It can read the serial data of any other chip as long as the baud rates are the same. All the serial cares about is the baud, not the hertz of the chips. I think 20MHz is the fastest it "can" go, but I think hackaday did some overclocking with this chip... not sure.
      Verify?

  • Adamant / about 14 years ago / 1

    Is it possible to program this with an arduino uno, or is the bootloader required for that?
    Would this: http://www.sparkfun.com/products/9825
    be what I need to burn in the bootloader myself?

  • Puzzle / about 14 years ago / 1

    Does anyone get this chip work under 3.3V? I can only get it work under 5V 16MHz using Arduino IDE.

    • Member #183693 / about 14 years ago / 1

      You can only officially clock it up to 10MHz at 3.3v. High requires at least 4.5v.

  • Rednaxela / about 14 years ago / 1

    Is this the ATmega328P, or the ATmega328? The datasheet link and picture show the ATmega328P variant, but the description and title here do not reflect this. I have an application where the low power of the P variant matters.

    • Member #183693 / about 14 years ago / 1

      I had just recently purchased this, and the one I received was the ATmega328P. If you send an e-mail to customer service, they can probably confirm this for you.

  • EvilGenius121 / about 14 years ago / 1

    dang it they went all out when i was waiting for other stuff to be in stock... such is life

  • EvilGenius121 / about 14 years ago / 1

    Any idea when these will be back in stock?
    edit: Back in stock as of possibly 1.17.11 (yay!)
    edit edit: all gone :( sheesh people! they lasted all of one day!
    edit edit edit: back in stock as of 1.20.11. Lets hope the 200 will last longer than the 700some others... (re-yay!)

  • rjimenez / about 14 years ago / 1

    Could anyone please confirm that these chips use factory default fuse settings? I'm having an unusually hard time programming them with my usual setup (ArduinoISP), with which I've easily programmed the similar 168 from other vendors in the past.

    • Member #123659 / about 14 years ago / 1

      Were you able to program these using that method?

      • rjimenez / about 14 years ago / 1

        Yes - no problem at all. Turns out the chip was accidentally fused and programmed for Arduino. I placed it into my Arduino's socket and was able to re-fuse it to require no crystals (using FTDI bit-banging) and then program it through ArduinoISP using my 'duino's original Atmega328. You can also fix this using a breadboard and a crystal or resonator.

  • salsa / about 14 years ago / 1

    Now available! I <3 SFE!!

  • salsa / about 14 years ago / 1

    Too bad the raw chips are unavailable, but the programmed ones ARE available...:(
    8/30/10

  • CalcProgrammer1 / about 15 years ago / 1

    This chip is pretty awesome! I bought an Arduino as well as one of these. It comes set for the internal oscillator so all you have to do is throw it on a breadboard, feed it 5 volts, and hook up a programmer. You can program it using an Arduino using "Mega-ISP" (which emulates an AVRISP programmer with an arduino, just have to connect some Arduino pins to the 328's programming pins and use avrdude to write code to it). I also built a cheap "dapa" parallel programmer with around $5 worth of RadioShack parts that works fine. Flashing the bootloader to use this with an Arduino can be accomplished using any programmer (including the Arduino running Mega-ISP) so if you have a working Arduino you can save a bit and flash it yourself.

  • Riley / about 16 years ago / 1

    Does this have the arduino bootloader installed like the 168 does? If not could I request that you guys fork this product to have one with the arduino bootloader preinstalled?
    Thanks,
    Riley

  • Luco / about 16 years ago / 1

    Guys what are the fuse settings ?? I got 2, neither work in my stk500

  • Kam / about 16 years ago / 1

    How can I get one or three with a bootloader installed?

  • josheeg / about 16 years ago / 1

    This looks interesting too bad they didn't have a higher speed one I am wondering if my sensors hooked to the arduino might not be able to be shoveled to the usb port fast enough...

  • microbyte / about 16 years ago / 1

    Does it work with the Arduino?

    • randumnumber / about 14 years ago / 1

      I am not going to laugh, just to be considerate, but YES. this is the chip that is on the arduino, you could unplug the chip on your arduino and plug this one in.

      • WizenedEE / about 14 years ago / 11

        Actually, it needs to be bootloaded before it will work with the arduino. And please don't be so rude to people - especially since the comment is almost two years old and that was back when all arduinos were shipped with atmega168's rather than the 328 sold here.
        But yes, they can be made to be arduino-compatible.

        • stewie0056 / about 13 years ago / 1

          i fried my 328 in my duemilanove and i went on here to order a new on and they stop selling duemilanoves. so i searched atmega328 and the only chip i got in my results was the atmega328 with optiboot for uno. i already ordered that chip and today i came across this and now im worndering if the chip i ordered is going to work? does it matter which atmega328 i use, as long as the bootloader is correct?

          • WizenedEE / about 13 years ago / 2

            Try adding this to /hardware/arduino/boards.txt
            I attempted to combine the entries for the duemilanove and uno. It should then show up in the tools->boards menu.
            concoction.name=Arduino Duemilanove w/ Optiboot Bootloader
            concoction.upload.protocol=stk500
            concoction.upload.maximum_size=32256
            concoction.upload.speed=115200
            concoction.bootloader.low_fuses=0xff
            concoction.bootloader.high_fuses=0xde
            concoction.bootloader.extended_fuses=0x05
            concoction.bootloader.path=optiboot
            concoction.bootloader.file=optiboot_atmega328.hex
            concoction.bootloader.unlock_bits=0x3F
            concoction.bootloader.lock_bits=0x0F
            concoction.build.mcu=atmega328p
            concoction.build.f_cpu=16000000
            concoction.build.core=arduino

          • Soshimo / about 13 years ago / 1

            You can always burn a new bootloader as well. I breadboard these guys all the time. Just pick the right target board (if using 1.0 you can pick Duemilanove w/ATMega328). You can use either an ISP or another arduino board as an ISP to burn the bootloader (the latter is a good option if you don't have an ISP already). You can get an AVR MkII ISP for about 30 bucks.

            The bootloader and wiring-based language are a construct of the arduino environment. The wiring-based language just abstracts the hardware and pin outs of the devices, nothing more. You can still drop to bare metal whenever you need to, such as burning a new bootloader.

            • Mark01970 / about 13 years ago / 1

              I am glad you mentioned the breadboarding. I am new to microcontrollers, and I am of very limited income so it took me a while to save up and get an uno and other stuff. I kept thinking that the chips were so cheap, I wonder if it would be feasible to just slap a 328 in my breadboard and get some components. I was not brave enough at the time. Still not sure if I am LOL. ..but at least I know it is feasible now. I need to find a local group or something though. Forums are nice, but meet and greets would be so much better. :)

              • Member #3321 / about 13 years ago / 2

                To help build your confidence/comfort level, you might want to try picking up an Ardweeny kit for about $10 (http://www.diybin.com/products/Solarbotics-Ardweeny.html). You will have to spend another $14 on an FTDI (http://www.diybin.com/products/DFRobot-FTDI-Basic-Breakout-3.3-5V.html), which brings the total up to about the cost of an Ardunio on sale. But the FTDI is a one-time purchase - in the future all you'll need to buy is the Ardweeny. In fact, once you've seen the schematic for the Ardweeny, you'll probably just want buy the parts and assemble your own - that will lower the price to about $7 per project. At that point, you'll probably start buying in bulk to save on shipping!

              • Member #36671 / about 13 years ago / 1

                There are many instrucables and kits that accomplish this goal. All you need are the schematics and the right parts. Kinda on a time crunch for the Superbowl, but Google it yourself for some links and you will be very happy. :)

Customer Reviews

4.7 out of 5

Based on 3 ratings:

Currently viewing all customer reviews.

Its the core of the Uno

I configured mine to run with 8MHz crystals because I have too many. No problems at all. Can also be set to use no crystal.

Works as expected and is very forgiving.

As the title says, not only did it work as expected, but it is also decently forgiving if you happen to wire things up wrong.

Not sure how to program it

I put it in my Arduino Uno but it's not working. Maybe it doesn't work with Arduino Uno so this is not a negative review more of a precaution.

This is the bare chip without the Arduino bootloader on it. Check out this tutorial which goes over installing a bootloader on a board or chip as well as programming a bare chip (it is the same process for the most part as the bootloader is just a program).