Standalone Arduino

This is my make-through for a standalone Arduino UNO board so grab a cuppa and let's begin!

Process Map

Background

What is a Standalone Arduino?

This tutorial will show you how to build an Arduino UNO compatible breadboard with an Atmel ATmega328. In other words, we'll be creating our own Arduino UNO board.

There are many varieties of Arduino boards that can be used for different purposes and the Arduino Uno is one of the more popular boards in the Arduino family and is a great choice for beginners. Therefore, we will be getting more familiar with it here and looking into its main components in more details.

And since the Arduino is actually an open-source platform, its schematics are in public domain and can be used by anyone to apply it for their purposes which makes it possible to try our own ideas or even make changes/advancements.

So let's begin!


Arduino UNO Components

Components and Tools

What Will We Be Needing?

We'll be using the following tools and components:

Note: We'll be soldering components on a PCB. However, you can still do the circuit on a breadboard. In this case, you'll need some wires and you might not use some of the components or tools above such as the soldering iron, the IC socket and the header pins.

If you'll be creating your own PCB, then you'll be needing an electronic design automation software such as Eagle and a PCB milling machine as well.

Electronics Circuit

How Do We Start?

An Arduino Uno is a microcontroller board based on the ATmega328P microcontroller. So before we get started, we need to be familiar with the microcontroller's pinout as demonstrated below.

Atmel ATmega328P Pinout

You don't need to be familiar with all the pins but we will definitely be referring to it a lot as we go along. Now, lets start building our board.

  1. We could begin by adding the 7805 voltage regulator. The left pin is connected to the power supply, the middle pin to the ground, and the right pin to the 5V.

  2. We could add a doide for protection in case the input to the voltage regulator is shorted to ground. The diode is polarized so make sure to connect them in the correct direction.

  3. We'll also connect a 10uF capacitor between the 5V and the ground to regulate the voltage and keep it steady. The capacitor here is polarized as well so make sure that you wire it the right way around. This capacitor will discharge the current through the diode bypassing the regulator in case the output voltage is more than input to the regulator, which could happen in case of a short-circuit.

  4. Next, we place a 16 MHz clock crystal and add two 22 pF capacitors to each end of the crystal. The other capacitors' terminal will go to the ground. This crystal ticks 16 million times a second and on each tick, the microcontroller performs one operation.

  5. We add a small push button so that we can reset the Arduino whenever we'd like to and to prepare the chip for uploading a new program. We connect the switch to the RESET pin of the ATmega chip and the other terminal of the switch to ground.

  6. The Arduino board has a built-in LED at pin 13. Thus, we added a LED but connected it instead to pin 7 of the ATmega chip. Be careful of the polarity here. The anode, the long leg, is connected to pin 7 while the cathode, the short leg, is connected to the ground.

  7. Lastly, we add another LED that will light up when the board is powered on. Don't forget the polarity here too!

Wiring Diagram

PCB Soldering

Since the target of our session back then was to practice soldering PCBs, we were given a ready made PCB and we had to just solder the components onto it. However, the connections are exactly the same as the breadboard circuit above.

The most important thing before soldering onto a PCB is choosing the right soldering iron. Otherwise, the soldering process won't go well and you'll find it difficult. You might find the solder not melting or it might end up sticking to the tip of the iron instead.

As you practice soldering, you'll realize that the best way to solder is to first hold the iron tip on the desired joint for a couple of seconds before feeding a bit of solder. Only then the solder will melt and flow smoothly. We use enough solder to form a tiny cone-shaped joint.

It takes some practice to make the perfect joint so don't worry if they don't come out all good. This is quiet normal.


Soldering PCB

Checking Over Your Solder Work

Many things could go wrong while soldering and result in faulty joints. The solder might not be connected well to the pad, or the lead is loose in the hole. The solder might even runoff the pad, and touch an adjacent pad. Therefore, a good way to locate faulty joints is by using a multimeter to test for continuity. All you have to do is to set the continuity mode on your multimeter, then touch the leads together and ensure there’s a beep. Afterwards, you touch the leads to two points on your solder joint’s opposite sides. If the multimeter beeps, then there’s a detected continuity which means the solder connects the points between the leads and if you don’t hear the multimeter beep, then you don’t have continuity.


Note: You could use the multimeter on the breadboard as well to detect faulty wires or components.


PCB Layout
Soldered PCB

Testing

Almost There

As we mentioned earlier, we had a LED connected that'll light up once the board is powered on as shown to the right. Just connecting the VCC and ground will light it up. You could use the DC power jack as well for power supply but do not connect it to the board if the board is connected to the laptop. Only one power source should be connected at a time.

What's a Bootloader?

Microcontrollers are usually programmed through a programmer unless we have a piece of firmware in the microcontroller that allows installing new firmware without the need of an external programmer. This is called a bootloader. The bootloader is a small piece of software that allows uploading of sketches onto the Arduino board. It comes preprogrammed on the microcontrollers on Arduino boards.

Thus to be able to use the Arduino IDE to program our board, we need to burn the bootloader to the ATmega chip. We could either use the Arduino UNO board as a programmer by connecting the MOSI, MISO, SCK and RST pins in the ATmega chip with those in the Arduino UNO board or we could use a USBASP programmer. We'll be going with the latter but both are very similar and require almost the same steps once the connections are done.

Note: For the Arduino Uno, you'll need to add a 10uF capacitor between reset and ground to prevent the board from resetting.

Burning the Bootloader

When using USBASP, you may be required to install driver if it is not installed automatically. You can download the USBASP zip file from this link then update the driver from the device manager with this file. Or you could install Zadzig from here and download the driver from there.

So after we ensure the driver is installed, we need to connect the 5V, GD, MO, MI, CK, and RS on the USBasp programmer to pins 7, 8, 17, 18, 19 and 1 respectively on the ATmega chip. Then, we can open our Arduino IDE and navigate to Tools Programmer USBasp to set our programmer as USBasp. If you're using the Arduino UNO board, then you'll be choosing Arduino as ISP instead. Then, we can burn our bootloader from the same drop down list, Tools Burn Bootloader. If you're using the Arduino UNO board then you need to upload the ArduinoISP file first to your Arduino UNO board from the examples provided in the Arduino IDE by navigating to File Examples ArduinoISP ArduinoISP. This turns your Arduino into an in-circuit programmer to re-program ATmega chips.

We Are Ready

We are now ready to test our board. We can program this board using the blink program from the example files by navigating to File Examples Basics Blink. The blink program blinks pin 13 on the Arduino board but the LED is connected to pin 7 on our board so that the only thing we will be changing in the code. After uploading, the LED should start blinking every 1 second as demonstrated in the video.

Blink Program


Powered On PCB
USBasp AVR Programmer
AVR Programmer Wiring
StandaloneArduinoUni_Blink.mp4
Blink Program Uploaded to PCB

Conclusion

Wrapping Up

So in this tutorial, we became familiar with the main components in an Arduino UNO and implemented our own board. We also learned that a USBasp is an ICSP (In Circuit Serial Programming) adapter that allows us to install new bootloaders and firmware on common AVR microcontrollers and used it to burn the bootloader on our board. We finally tested our board using the LED blinking program in the Arduino IDE examples.

I guess that's all. I hope you found this tutorial helpful and if you have any questions, feel free to contact me.


Standalone Arduino UNO