Introduction: BaW-Bot Part 1: Build an Arduino on a Board

About: I’m not a rocket scientist. I don’t have a master’s degree in Electrical Engineering. I love automating, hacking, robotics, creating, building, understanding. A while back I discovered a way to turn my inter…

This is the first part of our BaW-Bot (Bells-and-Whistles Bot) build – 5 separate instructables that look into different Arduino-related technologies, combining to create a Bot with all the bells-and-whistles.

Part 1: Build an Arduino on a Board
Part 2: Build the motor-controller & body
Part 3: Adding Sight and Touch
Part 4: Blinging up the BaW-Bot
Part 5: Taking it to the Next Level

In this instructable, we’ll be building an Arduino on a Breadboard – this will form the base of the Bells-and-Whistles Bot series of Instructables, serving as the main controller through the next 4 instructables.


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

Update: Attached is a refreshed schematic in pdf and Eagle CAD.

If this instructable helped you, please visit Crash Bang Prototyping, follow us on twitter, and join in with other prototyping resources and tools.

Step 1: Parts

You'll need the following parts to get up and running. 

1 x Breadboard + jumper wires
1 x ATmega 328P 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)

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 supply, 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 – 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 Microcontroller

Gently insert the ATmega into the breadboard, so that it straddles the centre separator.  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 (I’ve bent more legs on these chips than I can remember!), 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

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 & 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 Power
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)
- Connect the GND to the GND power rail


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 below.

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.

Oh No - the sketch doesn't upload!

Are you sure that your microcontroller comes with a bootloader. If it doesn't, don't panic - there is a way to burn a bootloader onto your chip.

Congratulations!

You're now ready to move onto Part 2 of the series, playing with motors to create a basic BaW-Bot.