Arduino on a Breadboard – Build your own
Build an Arduino on a Breadboard
There are many resources on the internet explaining how to build your own Arduino on a breadboard. I’ve taken the best of these, combined with some personal experience, and put together the definitive guide to creating your own Breadboard Arduino.
Why build an Arduino on a Board? There are a number of reasons:
- Everyone loves a challenge – this is a fairly simple one, but a challenge none-the-less
- The cost is lower, so you don’t need to buy additional Arduino boards if you need them for your projects
- You have improved flexibility in terms of the form and shape that the controller takes
- You can take it to the next level, and use stripboards or create custom PCB’s for projects that you want to make permanent
Step 1: The parts
- 1 x Breadboard + jumper wires
- 1 x ATmega328P-PU microcontroller, with Optiboot
- 1 x 16MHz crystal
- 2 x 10uF capacitors
- 1 x 0.1uF capacitor
- 2 x 22pF capacitors
- 1 x 220 Ohm resistors
- 2 x 10k Ohm resistors
- 2 x LED
- 1 x 5V voltage regulator
- 1 x FTDI Basic Breakout board
- 1 x 6-9V power supply and connector (or consider a DC Barrel Jack)
- The Arduino IDE installed on your PC
Step 2: Setup the Power Connections
The first step is to get an external power supply regulated to a constant 5V that the ATmega328 needs for stable operation. You could also use a 3.3V regulator, as the ATmega328 has a wide operating range.
Depending on the size of your project, you may choose to create this on a half-size or full-size breadboard. To keep this compact, I haven’t put any diode protection in place – therefore make sure you connect your external power source correctly. Unless you like the smell of smoke, don’t connect the +ve to the -ve!
Connect your external supply
Connect your power supply connector to the board. Then add a 10uF decoupling capacitor across the supply pins. Note that these capacitors are polarised, so you’ll need to connect the side with the negative indicator (look for a stripe or -ve sign – or check your datasheet) to GND, and the other to +ve.
Connect the voltage regulator
Now add the regulator, ensuring that the external supply positive lead connects to the input , and the negative to the GND. Again, check your datasheet carefully.
Connect the other 10uF capacitor to the GND and output from the regulator, and then take leads from the GND and output to the power rails of your breadboard. This power is “clean” and will be at 5V.
Also add leads to connect the 2 power rails from your board so that they are both powered.
Add a power LED
Finally, let’s add a LED to show when the board is powered. Connect a 10k resistor from the GND rail to the cathode of the LED (the shorter leg), and run a wire to connect the anode to the positive rail. I’ve used a blue 3mm LED, and the 10k resistor so that it doesn’t burn too brightly.
Now you’re wired up and ready to add the processor.
Step 3: Add the ATmega328P microcontroller
Gently insert the ATmega328P into the breadboard, so that it straddles the centre separator. You may need to gently bend the pins inward to get them to align with the breadboard holes. Place it so as to keep the board nice and compact. If you prefer, you can use a ZIFF socket to allow for easy removal and re-insertion, but pay attention to how the pins in the socket line up with the breadboard pins.For this example place the notch towards the power we’ve just connected – or the pin 1 dot at the left.
Once the chip in mounted, connect the power:
- +ve rail –> VCC (pin 7)
- +ve rail –> AVCC (pin 20)
- +ve rail –> AREF (pin 21)
- GND rail –> GND (pin 8)
- GND rail –> GND (pin 22)
Step 4: Connect the Crystal and Reset
Connect the Crystal
Connect the 16MHz Crystal between pins 9 and 10. This will regulate the speed of the ATmega. You should also then add two 22pF capacitors between the crystal pins and GND.
Pull-Up Resistor on Reset
You now need to pull the reset pin up, using a 10k Ohm resistor. You could add a reset button that would connect to GND, however I’m going to use the reset functionality of the FTDI board so won’t clutter my board with one. Add a 10k Ohm resistor between the +ve rail and the Reset pin (pin 1).
At this stage you’ve got the basics of the board setup. It would now function, however there is no easy way to programme it. I’d also like to add a LED on pin 13, like the “real” Arduino.
Step 5: Connect the FTDI Board
The FTDI board acts as a USB-to-Serial converter with a few extra touches that allow you to upload sketches. You could also use the breakout to power your project if you don’t have an external supply, or while testing your project.
Connect the Reset
The FTDI board sends a reset signal to the chip, to activate the bootloader in preparation for receiving the sketch being uploaded. Connect the DTR pin of the FTDI, via a 0.1uF capacitor to pin1 on the ATmega.
Connect the Transmit and Receive
Next the FTDI needs to communicate with the ATmega – use the Tx and Rx connections for this. You need to connect the FTDI’s Tx to the ATmega’s Rx, and in the same way the Rx to the Tx. (The one needs to receive the others’ transmissions – the two Tx pins can’t talk to each other!)
- Connect the TXO of the FTDI to the RXD on the ATmega (pin 2)
- Connect the RXI of the FTDI to the TXD on the ATmega (pin 3)
- Connect the GND to the GND power rail
You can, if you choose, connect the power from the FTDI, so your project is powered from the USB port:
- Connect the 3v3 to the +ve power rail (my FTDI outputs 5V – pin is incorrectly marked 3V3)
You should never power your board from more than one power source at a time. If you are powering your board through a battery/wall-wart do not connect the power to the FTDI breakout board.
Now you’re one step closer – you can upload sketches using Arduino IDE (select the UNO, as the chip has been pre-loaded with the UNO Optiboot Bootloader)
Step 6: Connect the pin 13 LED
Finally, let’s add the LED we find on pin 13 of the Arduino Uno. This is a useful LED to have on-board for trouble-shooting or as an indicator. We’ll also use it now to test that the board is working correctly.
Connect the LED
Place the LED on the board, then connect a 220 Ohm resistor from GND to the LED’s cathode. Add a jumper wire from the LED anode, to pin 19 on the ATmega.
Important note: the physical pin numbers on the microprocessor are not the same as the (logical) pin numbers you refer to in your sketches. Physical pin 19 maps to logical pin 13. Refer to the image above.
Test the Board
It’s time for the blink sketch! Double-check your connections, then connect the FTDI board to your PC with a USB cable. For this example, connect the power jumpers from the FTDI to your breadboard first.
- You should notice a new COM port available (under the Tools – Serial Port menu). Select this.
- Under Tools – Board, choose the appropriate board to match your bootloader (most likely an Uno)
- Then load the Blink sketch and upload it.
The LED should flash a few times, and then the Tx and Rx lights on the FTDI should flash back-and-forth as the sketch is uploaded. Once the sketch has been loaded, you should see the comforting slow flash of the LED.
Congratulations: You now have a living, breathing Arduino on a Breadboard!
Need to bootload your Breadboard Arduino? Take a look here.