I am trying to make a printed circuit board for a robot.

I would like to make this look as neat as possible, and I would like to have the peripherals like the sensors and other stuff, and the ATmega328 chip on the same PCB Board.

Unfortunately, all the tutorials online are for breadboards or recreating the actual Arduino with I/O pins, not what I am looking for.

I would simply like a circuit diagram explaining how to power the chip using a 9V battery, including a crystal oscillator.

If there was a place where I could download an Eagle schematic, that would be super helpful.

  • \$\begingroup\$ AVR chips don't require a crystal unless precise timing is needed, e.g. for USB or a RTC. \$\endgroup\$ Commented Aug 7, 2014 at 20:38
  • \$\begingroup\$ The Arduino Uno board is a good place to start, and its eagles are published: arduino.cc/en/uploads/Main/arduino_Uno_Rev3-02-TH.zip \$\endgroup\$
    – kolosy
    Commented Aug 7, 2014 at 21:05
  • 1
    \$\begingroup\$ Also check Atmel AVR042: AVR Hardware Design Considerations \$\endgroup\$
    – alexan_e
    Commented Aug 7, 2014 at 21:10
  • \$\begingroup\$ Also note that 9V batteries are mostly rubbish; consider using 4 AAs with a LDO or a 3.7V Li-ion cell directly (at a reduced clock rate) instead. \$\endgroup\$ Commented Aug 7, 2014 at 22:22
  • \$\begingroup\$ @user3731004 - I think my answer responds to every single part of your question. You could have your schematic in Eagle, exactly as you have requested, with all the features you have asked for, in less than 10 minutes. Have I misunderstood? What else do you need? \$\endgroup\$
    – gbulmer
    Commented Aug 8, 2014 at 3:33

4 Answers 4


The Atmega328 can take 5.5V before you risk damaging it. This is why most Arduinos will use a USB connection to draw power from. Since you want to use a 9V battery, you will need some sort of voltage regulation to push it down to acceptable levels for the ATmega328.

You chould use a linear voltage regulator like this one for example. These are vary widespread and can be adjustable as to which output voltage they will make. Many are fixed as well.

First off, you will connect your 9V battery to the input rail of the voltage regulator. Make sure you put the postive terminal to the input pin of the regulator and connect the negative terminal to the GND connection of the voltage regulator. It is wise to attached a capacitor on the input rail going from the positive terminal to the negative terminal.

After you have the battery hooked up to the voltage regulator, you will have 5V being created on the output of the voltage regulator. At this point you'll connect the output pin to the VCC pins of the ATmega328. Make sure you connect the GND pins to the voltage regulator as well. It is also wise to put another capacitor on the output voltage rail as well, one lead to the 5V rail, and the other lead on the capacitor to the GND rail.


simulate this circuit – Schematic created using CircuitLab

enter image description here

Sparkfun.com has many Eagle diagrams and board files for the Arduino line. You can also google "Arduino Uno Schematic" if you want the UNO and so on for the various Arduino boards. The Sparkfun RedBoard is their own clone of the Arduino Uno designs/Duemilanove design for which they offer schematic and board files for Eagle. The overall functionality is the same as the Arduino, although on some versions, the parts are SMD, and others, not so.

  • 1
    \$\begingroup\$ Don't expect a 3-terminal regulator to work well without capacitors. \$\endgroup\$ Commented Aug 7, 2014 at 20:35
  • \$\begingroup\$ @ChrisStratton Ah good catch! I've updated the schematic and the description \$\endgroup\$
    – Funkyguy
    Commented Aug 7, 2014 at 20:46
  • \$\begingroup\$ @gwideman Fair enough, I didn't want to seem too pushy. nevertheless, I removed the mention of a voltage divider so that voltage regulators are the only item discussed \$\endgroup\$
    – Funkyguy
    Commented Aug 7, 2014 at 20:48
  • \$\begingroup\$ Of course a 3-terminal regulator is just a voltage divider with a feedback control circuit to adjust it. \$\endgroup\$ Commented Aug 7, 2014 at 20:49
  • 1
    \$\begingroup\$ You refer to L7805 as an LDO, that is not the case, the device has a dropout voltage of 2-2.5v. A commonly used low dropout regulator is LM1117 with a voltage drop of 1.3v. It would probably fit better the task and would be able to provide a 5v output for a longer duration. \$\endgroup\$
    – alexan_e
    Commented Aug 7, 2014 at 21:21

All of the specifications, pinouts, and diagrams are provided in the ATmega328 datasheet. The pinout shows you what pins to connect to Vcc and Ground, etc.

ATmega328 Pinout

As for a schematic, you won't likely find anything pre-designed for use in Eagle. The ATmega328 is just a microcontroller, and could be connected to pretty much anything you want on your own PCB.

In the Arduino world, "shields" provide modular plug-and-play style connectivity with various things such as relays, sensors, audio playback, wireless transceivers, etc.

When you design your own PCB, you can elect to connect whatever pins of the microcontroller to your other components as needed. You are free to use alternate functions of pins and configure the microcontroller for that purpose. For example, you might choose to use a pin as an analog input (ADC), or you might use it as an output to drive a transistor.

Atmel does provide additional guides and documents related to the ATmega328 (such as for external crystals), which you may find useful.

See also: Using a 16 MHz crystal on a ATMega328p

  • \$\begingroup\$ +1 for the note on 16MHz crystal. That's going to come in handy. \$\endgroup\$
    – gwideman
    Commented Aug 7, 2014 at 21:08

To your questions:

Power from a 9V battery: You can use a three-terminal regulator, such as one of the 7805 series, which is available in different models for different amounts of power dissipation. You will need to add an input and an output capacitor. See 7805 datasheet for details.

The 7805 is a "linear" regulator, which is to say it handles the 9V to 5V drop by dissipating heat. That is waste of battery power, which may or may not be a concern.

Instead you can use a switching regulator. There are many off-the-shelf DC-to-DC regulator modules which accept a range of input voltages, and provide a specific output voltage, such as 5V. A good place to start is Digikey or Jameco, search for DC-DC converter.

As for the crystal oscillator: you can just use a crystal with the ATMega, plus a couple of 18pf or 22pf capacitors. If you must use a crystal oscillator module, this can also run off 5V, but consumes somewhat more power.

[Added comments regarding the Arduino schematic]

The Arduino Uno schematic does provide a useful example for your situation.

  1. On the orignal Uno, you will see that it has two 5V regulators, in parallel. That is so that the PCB contains pads for either of two different models of regulator chip, only one of which gets installed. The Uno R3 schematic shows only one regulator. Either of the models of regulator chip is a possible choice for your project.

  2. The schematic shows the arrangement of capacitors that are usually needed with a 3-terminal regulator. An input capacitor (here 47uF) and output capacitors (here 47uF and 100nF). It's worth noting that different 3-terminal regulators have different recommended capacitor values: see this discussion: What capacitance should be added over the inputs and outputs of a voltage regulator? .

  3. The Uno includes circuitry to switch between USB-supplied power and power-jack-supplied power -- that's MOSFET T1, and the op amp circuit that drives it. You don't need that.

  4. The Uno shows the connection of a crystal to XTAL1 and XTAL2, along with two capacitors and a resistor to get it to oscillate nicely, in combination with the ATMega's internal circuitry.


I would start with the Eagle schematic and PCB from the Arduino Diecimila, or Arduino Single-Sided Serial Board (version 3)

An Arduino UNO, has a lot of circuitry that you do not seem to need.

The Diecimila is less complex than more recent Arduino's, which have smart power selection, and a different USB to serial interface.

I assume you can use Eagle.

I assume you do not need the USB adapter on board. I'd buy one ready made from eBay for a few $'s instead.

Arduino Single-Sided Serial Board (version 3):
Load the schematic and PCB into Eagle Delete everything to the left of JP4, labelled 'autoreset', including JP4
Delete J1, J2, J3 and power header
You have a schematic which does everything you have asked for, and a PCB ready laid out.

Diecimila (more to delete):
Delete the FTDI chip, and all the parts out to and including the USB socket.
Delete the Tx/Rx LEDs and resistors, the FTDI chip has gone, so there is nothing connected to them.
Delete the 3-pin header which chooses power from the external socket or USB.
Either use the 2.5mm barrel jack to connect your 9V battery, or delete it, and replace it with a battery lead (a two pin header will do), and connect it to the connection remaining after deleting the 3-pin power-select header.
Delete the Arduino 6 and 8 pin header sockets.

Now, you are pretty close to a Diecimila-based schematic, and you have a much of a PCB layout if you want to use SMD parts.

If you do want to use the Arduino PCB layout as a starting point, adjust the board dimensions, and carefully select and copy the parts and tracks to a convenient location.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.