After I wrote several articles about using ATmega microcontrollers (DIP40) in Arduino environment I had some feedback that I was asked how to be effectively put into operation this project. As I came into the Arduino world from classical microcontrollers development world, I have not found necessary to elaborate a method or hardware project for this.

Meanwhile I realized that in Arduino world as there are many users who not have a background in digital electronics / microcontrollers development. This is the great advantage of Arduino, it is so easy to use that even if someone have no knowledge or experience with electronics or programming, can get a simple project running in hours (or minutes).

Personally, I use the Arduino as a platform for experimentation. Even if most of the times I bypass hardware "abstraction layer" (and working directly with microcontroller hardware) I continue to use the Arduino IDE because is so simple(and fast) to start experimenting with different algorithms or techniques to control various peripherals.

I must admit that sometimes I use Arduino IDE as a replacement for AVR Studio, as long as USBASP is well supported. So I think that this project will not be useless, although there are many similar projects, each with advantages and disadvantages.


  • Can be used with DIP40 ATmega Microcontrollers: ATmega16, ATmega32, ATmega644, ATmega1284, ATmega1284P
  • Thru-hole components / easy to solder
  • Can be used with Arduino IDE (or other IDE / programmer / compiler )
  • Include filtering of AVCC for better analog input.
  • Include 10pin ISP connector / easy to use with USBASP (or another compatible programmer)
  • More freedom in the choice of connections with external modules
  • ... I almost forgot ... price...


  • No bootloader (limitation or advantage, depends on how you look at). However a bootloader can be easily added (...some hardware is required)
  • No standard Arduino footprint. (We can not plug directly standard shields, but can still use them in more traditional way, with jumper wires)

Step 1: Comparison

Here is a comparison between various common microcontrollers (DIP40 package) from ATmega family.

Please note that ATmega328P and ATmega2560 are not DIP40. I put them here for comparison (ATmega328P ~ Aruino Uno / ATmega2560 ~ Arduino Mega 2560).

I also emphasized column for ATmega1284 / 1284P, this is the most capable microcontroller for ATmega in DIP40 package (at least at the time I wrote the article).

Step 2: Schematic

At first I make schematic to illustrate minimum requirements to start an ATmega microcontroller at full speed.

In circuit design I used both specific Atmel datasheets and Application note AVR042: AVR Hardware Design Considerations. I tried to follow them as much as I could without unnecessarily complications. Also I used Application note AVR910: In-System Programming.

At this step it is attached also pdf version of schematic.

Step 3: Schematic detail: Power

"Looking at the datasheet for an AVR microcontroller, one can be fooled to believe that power supply is not critical. The device has a very wide voltage range, and draws only a few mA supply current. But as with all digital circuits, the supply current is an average value. The current is drawn in very short spikes on the clock edges, and if I/O lines are switching, the spikes will be even higher. The current pulses on the power supply lines can be several hundred mA if all eight I/O lines of an I/O port changes value at the same time. If the I/O lines are not loaded, the pulse will only be a few ns.

This kind of current spike cannot be delivered over long power supply lines; the main source is (or should be) the decoupling capacitor." - Application note AVR042: AVR Hardware Design Considerations

Power supply of AVR microcontroller consists of two sections:

  • Digital supply: (Pin 10 = VCC and Pin 11 = GND)
  • Analog supply: (Pin 30 = AVCC and Pin 31 = AGND)

Power can be supplied from ISP connector (when J9 is on) or from power headers (J6 -VCC and J7-GND)

Decoupling capacitor C3 should be placed as close as possible to the supply pins.

AVCC is filtered with L1(10uH) and C4(100nF) for better noise immunity of ADC section. This filter can be omitted If you consider that ADC will not be used (or analog input accuracy does not matter too much).

Power LED and it's limiting resistor is optional (However it's good to have a visual feedback when the circuit is powered).

Step 4: Schematic detail: Quartz

"Most AVR MCUs can use different clock sources. The optional external clock sources are Clock, RC oscillator, crystal or ceramic resonator. The use of crystals and ceramic resonators are in some designs causing problems due to the fact that the use of these clock sources is not well understood.


Finally, the importance of the physical location of the resonator in relation to the AVR should be stressed. Always place the resonator as close to the AVR as possible and shield the resonator by surrounding it with a ground plane. " - Application note AVR042: AVR Hardware Design Considerations

Step 5: Schematic detail: Reset

"The RESET pin on the AVR is active LOW, and setting the pin LOW externally will thus result in a reset of the AVR


The reset line has an internal pull-up resistor, but if the environment is noisy it can be insufficient and reset can therefore occur sporadically. Refer to datasheet for value of pull-up resistor on specific devices.


Connecting the RESET so that it is possible to enter both high-voltage programming and ordinary low level reset can be achieved by applying a pull-up resistor to the RESET line. This pull-up resistor makes sure that reset does not go low unintended. The pull-up resistor can in theory be of any size, but if the AVR should be programmed from e.g. STK500/AVRISP the pull-up should not be so strong that the programmer cannot activate RESET by draw the RESET line low. The recommended pull-up resistor is 4.7kOhm or larger when using STK500 for programming. For debugWIRE to function properly, the pull-up must not be smaller than 10 kΩ. To protect the RESET line further from noise, it is an advantage to connect a capacitor from the RESET pin to ground. This is not directly required since the AVR internally have a low-pass filter to eliminate spikes and noise that could cause reset. Applying an extra capacitor is thus an additional protection. However, note that this capacitor cannot be present if debugWIRE is used." - Application note AVR042: AVR Hardware Design Considerations

C1 and R1 values are not critical. I use values from Atmel documentation.

C1 value (if present) should be between 10nF and 100nF

Step 6: Schematic detail: ISP Connector

"In-system programming (ISP) is the ability of some programmable logic devices, microcontrollers, and other embedded devices to be programmed while installed in a complete system, rather than requiring the chip to be programmed prior to installing it into the system." - http://en.wikipedia.org/wiki/In-system_programming

"In-System Programming allows programming and reprogramming of any AVR microcontroller positioned inside the end system. Using a simple Three-wire SPI interface, the In-System Programmer communicates serially with the AVR microcontroller, reprogramming all non-volatile memories on the chip." - Application note AVR910: In-System Programming.

Power Jumper J9 allows to disconnect circuit Vcc from programmer to power circuit from an external source (using J6 - Vcc and J7 - Gnd)

Step 7: PCB Preview

The entire project was done with gEDA. http://www.geda-project.org/

At this step is attached a zip file that contains all the files needed to edit/modify project.

PCB were designed with to be "minimal", "low-cost" and "user-friendly", all components are through-hole, ordinary, easy to find.

I plan to make some PCBs (and check the design in this way). I will update information here if I will find some problems in design.

Step 8: Stripboard version - Components

Next follows the stripboard version of this project.

I did not put filtering circuit for AVCC. (I do not intend to use ADC from this board, if need I will add it later; same for AREF capacitor)

Anyway, I'll definitely put all components on the PCB, when it will be ready.

Step 9: Stripboard version - main socket

I have taken into account the following restrictions:

  • Short sides of socket should remain free, to be able to remove the chip (easier)
  • Is needed (some)space between socket and pin headers.
  • ISP header should have enough space around it.
  • The Reset button has to be easy accessed.
  • Power jumper J9 also has to be easy accessed.

Step 10: Stripboard version - finished

This is finished board. I did not put making connections in detail.

I risk doing more harm than good in this way. And I'm sure there are many better solutions to route connections...

The last two photos show project in operation, running first running the first tests (Blink example and Fade example on pin13).

A funny coincidence is that pin digital 13(aka PD5 for DIP40) (standard for LED in Arduino boards) also have PWM...

Step 11: At the end

This instructable has been done as a complement to my other articles posted here or on my website:





as a result of feedback received through comments, private messages, emails and so on...

All information on setting the Arduino IDE to use this project can be found in the links above.

Also I tried to do little more... an open source hardware project which can be used in several ways, with different microcontrollers, in Arduino IDE .. or not.

The project can be edited and modified in gEDA and can be the starting point for a custom project, according to your needs.

I will return with more information and photos after the PCB will be ready (2-3 weeks... I hope)

Later edit:

In conclusion, this board(project) was designed as a sort of auxiliary/disposable board, but can be also used in a final project.

For instance I am using (see picture above) to develop a library for a TFT display which is not supported by UTFT library (based on R61509V controller) I have this display from a development board for STC51 microcontrollers.(It is less common display. I think that is most common in the Chinese market).

As long the project will take time, this small board will stay locked here, and I will save myself to dismantle and assemble the project every time I work on it.

I look forward for that PCBs to be ready, I have too many projects in development, and so few development boards. :)

Step 12: Update: PCB done

As I promised I returned with photos of PCB.

Even if I not mounted all components (I have to go on to electronics stores coming days), I was able to test the project and see that it works smoothly.

<p>Hi Guys,</p><p><br>I developed a scketch to work on Arduino Mega and I need to compile in an AtMega1284p-pu<br>- Can I compile the same scketch in Atmega1284p-pu? <br>- Is it necessary to change anything on the scketh? pins for example?<br>- The AtMega1284p-pu is still a &quot;virgin&quot;, which Arduino's bootloader is better to burn in?<br><br>Thanks <br><br>Angelo Ventura</p>
<p>I tried to answer your question here:</p><p><a href="http://openhardware.ro/using-atmega32-arduino-ide/#comment-156" rel="nofollow">http://openhardware.ro/using-atmega32-arduino-ide/...</a></p>
<p>Thank you, you really helped me out! I use the board that diy-bloke mentioned. With some more help from your site, some thinking... And setting the right controller I finally made it to program a &quot;stand alone atMega32A&quot;. I'll need to tweak the fuses a bit, to have the exact 1sec delay. Oh, your site is really worth a lot!</p>
<p>nice! :)</p>
<p>Great Ibble. For those who want to venture in 40 DIP ATMEL microcontrollers but are weary to grab a soldering iron: you might be interested in a really cheap 40 dip experimenter board: </p><p><a href="http://www.aliexpress.com/item/C18-Newest-2014-1set-ATMEL-For-ATMEGA16-ATmega32-AVR-Minimum-System-Board-USB-ISP-USBasp-Programme/32224290518.html" rel="nofollow">http://www.aliexpress.com/item/C18-Newest-2014-1se...</a><br><br>The crystalfrequency of it is 8MHz I think. it comes with a programmer</p>
<p>Thanks for feedback! :)</p><p>I ordered myself one of them few months ago. Can be purchased with or without USBASP programmer. </p><p>They are incredibly cheap, considering that have ZIF socket onboard...And if you order it without USBASP, there are cheaper. </p><p>Some are equipped with 8MHz crystal some with 12MHz... or even16MHz </p><p>But the crystal can be changed easily, there is a socket for it ...look at the pictures attached. I overcloked an ATmega1284 at 24MHz this way...</p><p>Advantage: ZIF soket... :)</p><p>Drawback: ZIF socket... :)</p><p>Yes, sometimes ZIF socket bothers me, sometimes helps me a lot...depends on what I use board... for the final version of a project I prefer without ZIF ... </p><p>Regards!</p>
<p>darn, you are right. I had not even seen the socket for the crystal.<br>Yes I agree, i like a regular socket on my final board. only use zif for programmers.<br>in a quick setup with the USBasp I havent been able to get the USBASP to work yet, but that was on an attiny just with some wires plugged in. I expect it to wok on this board once I decided what chip to order. Maybe the 32 is good enough for what I needs. Your perfboard build looks definitely great</p>
<p>noo .. no 32. If you are starting in this kind of projects .. start with 1284 /1284P or 644. These are the newer microcontrollers and have PCINT interrupts...</p><p>Atmega32 and 16 does not have PCINT ...You'll need PCINT if you use SoftwareSerial or some Rotary encoders libraries.</p><p>Also timers registers are slightly different and you need to adapt some arduino libraries to function.(for 32 and 16) </p><p>I suggest you start with the most powerful microcontroller in development /research phase and downgrade for final project only if it permits this.</p><p>Have fun!</p>
<p>thanks. the 1284 it will be. <br>From your openhardware link I understood I may need the iom1248.h file. <br>Eventhough I have the arduino 1.06, i only hav the iom1248p.h file.<br>odd. Guess i will stick to the 1284p. :-)</p>

About This Instructable




More by Silvius:Reading 15 Rotary Encoders with Arduino and ATmega1284 Open Source TV Box - GeekBox AVR Transistor Tester 
Add instructable to: