Doityourselfuino – not an Arduino

Why use an Arduino? Why don’t you build your own PCB like I do?
This way you decide which AVR pin is used for what and how you layout your own PCB. And you can save a lot of money. On the other hand you have to invest some time to build it.

What do you need to build a simple AVR circuit?

  • An AVR :)
  • A 100nF block capacitor.
  • A power source.
  • An IC socket for the AVR (optional).
  • A crystal and two 22pF capacitors (optional).
  • An ISP connector (optional).
  • ISP power jumper (optional).
  • A serial interface, USB-RS232 or MAX232 (optional).
  • A PCB (optional).

Here is the schema for this circuit:

So let’s have a look at all those components:

AVR

I always use one of those ATmega48/88/168/328 devices. So far they have been big enough and cheap enough for my projects. The ATmega164/324/644/1284 series also looks very nice if you need some more I/O lines. Both are available in DIP packages.

Block Capacitor

Always put a 100nF block capacitor between VCC and GND as close to the AVR as possible, and also next to every other IC on the PCB. This reduces noise on the power supply traces. Too much noise on these traces can cause strange things to happen, for example unexpected AVR resets. You can’t see this capacitor because I hid it in the IC socket under the AVR.

Power Source

Like every other electronic circuit this circuit needs a power source. This can be a connector for an external power supply, an on-board power supply, a battery or it can come from a connector which also contains other signals, for example ISP.

IC Socket

An IC socket is needed if you put the AVR into a programmer to download the code and then put it back into the circuit. It is also a good option if you plan to fry the AVR ;)

Crystal

A crystal is needed if you want a higher clock frequency than the standard 8MHz, a more accurate or a special frequency. I normally use 18.432MHz or 14.7456MHz because they are a multiple of the baud rate 115200. Don’t forget to set the fuses to tell the AVR to actually use the crystal.

ISP connector

If you want to program the AVR in the system you need an ISP connector. You can get nice AVR ISP programmers for less than $10 these days. Another option is a bootloader on the AVR.

ISP Power Jumper

All my newer boards feature an ISP power jumper which is used to connect the 5V coming from the programmer to the 5V on the board. Sometimes the board is already powered, then i disconnect the ISP power from the board.

Serial Interface

A serial port comes in handy when you want to send commands to the AVR or if you want to see some debug ouput. Just add a connector for a USB-RS232 adaptor or a MAX232 breakout board. If the AVR contains a bootloader it can also be programmed over this serial connection.

No pull-ups?

Reset and the I/O pins have integrated pull-up resistors, so often external pull-ups are not needed. I’d recommend to add an external pull up resistor for RESET when you have a long trace or a noisy environment. The I/O pull-ups are enabled if PUD is 0, the DDR* bit is 0 and PORT* bits is 1. The reset pull-up is always enabled. The resistor values (RRST and RPU) are specified in the section “DC Characteristics” of the datasheet, for ATmega48PA it is between 30kOhm and 60kOhm for RESET and between 20kOhm and 50kOhm for I/O pins.

Prototyping

Before you build your circuit make a schema and print it. Then when building it mark each wire on the schema when you added it to the circuit. That’s an easy way to keep track of what has been done. I like the following “3 hole islands” prototyping boards. They make it easy to connect a few wires together and there is no need to cut traces like with the striped PCBs.

PCB

Designing a circuit on breadboard or prototyping PCBs is OK. Buth when finished it’s more nice to have a real PCB. A custom made PCB is less fragile and can be made pretty cheap these days (f.ex. seeedstudio.com and iteadstudio.com). The prototyping PCB can then be reused for a different project.

Here are two examples:

This should be enough to get you started. Happy hacking!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>