After you finish debugging your project, it is time to make your Arduino permanent.
You could buy something like this cheap nano form factor.
Or, you could build your own custom board.
Here is an example of my RetroPie power controller.
It has an custom Arduino built in.
In this episode of Addohms, I will show you how to build a DIY Arduino board, the key
things you need and stuff you should NOT miss.
[Music Playing]
This video is part one of a three part series.
In the future parts I will design the PCB and then turn on the assembled board.
Stay tuned and subscribe for those episodes are available.
Just a quick note, I am going to be using KiCad (in this video)… [explosion].
Wow.
It did not take long for the comments to explode.
Look, I could use EAGLE, or Altium, or Diptrace or even just a pen and some paper.
That is not the point of THIS video.
So regardless of what CAD tools YOU use, this tutorial is focused on the DESIGN, not the
tools.
Now that is out of the way, let’s go design something.
First up, we need a heart, or well brain.
So I am going to grab the ATmega328p.
There are a lot of pins and by the time we are done most of these are going to be connected.
Next we need something to drive the chip, which means we are going to connect a clock signal.
Everything that happens inside of a microcontroller is based on a clock signal.
Which is generated from an oscillator circuit.
Processors like the three twenty eight pee do have a built-in oscillator.
BUT it is slow and not what I would call accurate.
External clocks can run at almost any speed you want and have much higher accuracy.
Okay, but then what is an Oscillator?
When something Oscillates, it moves back and forth.
A waveform going from low to high is like a oscillating signal.
For a microcontroller, this signal is called a clock.
Here are three ways to create a clock signal for our Arduino: an RC circuit, a ceramic
resonator, or a quartz crystal.
RC oscillators are not very accurate and can change with temperature or voltage.
If you need U-ART, or serial, communication, this oscillator just will not work.
Ceramic resonators are slightly better, but still not the best option.
With that said, genuine Arduino boards tend to use Ceramic resonators—at least for the
three twenty eight.
Unless board space is limited or cost is a huge concern, I prefer using a crystal.
They require a couple of load capacitors to form the oscillator circuit.
Diving into how this circuit works is cool, but more detailed than I want for this video.
So for now, we will use the values in the three twenty eight’s data sheet.
Looking there, we see recommended values between twelve and twenty-two picofarads.
I already have twenty-two picofarad caps in my kit.
So let’s add a crystal and load capacitors to my design.
You might notice I called out C-ZERO-G ceramic capacitors.
These are ultra stable with voltage, temperature, and time.
But, more on that in a different video.
Speaking of capacitors, we need some decoupling capacitors on the IC.
Each of the V-C-C pins will get a one hundred nanofarad capacitor.
The idea of a decoupling capacitor is that you want to DECOUPLE the IC’s power pins
from the rest of the circuit or supply.
Picking the correct values for decoupling capacitors is a complicated topic.
Smaller loads like a simple IC usually need one hundred nanofarad to one microfarad;
while larger loads like motors could require hundreds of microfarads.
Keeping the IC’s decoupling capacitors in a group keeps the schematic clean.
When I get to the P-C-B design, I will need to remember to spread these back out.
While MY code never has issues, I have heard that some people occasionally need to reset
THEIR micro controllers.
So I will show how to add a reset button.
Node labels connect the signals together.
This is easier than drawing lines all over the schematic.
The push button connects to ground letting me force a processor reset.
You might think I forgot to add a pull-up resistor.
Well...The chip already has a built-in resistor on the reset pin.
However, I AM going to add one, but not for the reason you might think.
To use the Arduino boot loader to program over USB or serial, we need a few more parts.
First a one hundred nano farad capacitor connected between the serial signal, DTR
and the three-twenty-eight’s reset.
Here is that pull-up resistor.
The way this works is that DTR is held high, which means both sides of the capacitor are
high.
When the port opens, DTR goes low, discharging the capacitor to zero volts.
This brief drop to zero resets the three-twenty-eight.
Eventually the capacitor recharges, through the pull-up resistor,
bringing the processor out of reset and letting it boot.
The reverse biased diode makes sure there are no spikes above V-C-C.
Adding auto-reset does have a downside.
Any time a computer accesses the serial port, the processor will be reset.
You need to decide if that behavior is an issue for YOUR design.
If so, skip it and use the pushbutton to manually reset whenever you want to upload code.
If your board is U-S-B powered just add U-S-B socket, maybe a poly fuse, and a ten microfarad
capacitor.
Keep the cap kind of small, because if there is too much capacitance, you will violate
U-S-B’s in-rush current spec.
For my design, I am going to pretend we are not using USB power.
Instead let’s say we are going to power the board by this brick, or wall wart.
By the way, that is spelled w-a-r-t and NOT w-o-r-t.
For the regulator, I am picking the N-C-P one one one seven.
I am putting ten microfarads on the input and one microfarad on the output.
How did I arrive at these numbers, you might ask?
Well, the short story is, I am making a guess.
Here’s a quick tip on decoupling capacitors for a linear regulator.
Your output capacitor should not be larger than the input capacitor.
Linear regulators respond to changes very fast.
If there is a huge capacitor on its output, the regulator could go into short circuit
shutdown trying to charge up that big cap.
Also, the output cap is really a filter capacitor.
The input capacitor is the decoupling capacitor, since it is decoupling our DIY Arduino board
from whatever power supply it is connected to.
But, that is a subject for another video.
Since I am using an on-board regulator, I am going to add a barrel jack and a header
to bypass it.
For now, I am going to add a two-by-two header for power pins.
This will give me two additional five volt and ground pins.
When I design the printed circuit board, I might delete this header.
I’ll only keep it if I have enough space.
When this blank three twenty eight pee chip comes from the factory, it does not know how
to do anything.
It needs to be programmed either with your program or something like the Arduino boot
loader, so you can load programs over serial.
If I was planning to use a DIP style three twenty eight, I could just program the chip
before putting it on the PCB.
Since I am using a surface mount part, I need a header to be able to program the Arduino
boot loader.
Instead of a generic two by three header, I will use one that has the I-C-S-P pins already
labeled.
These labels make it easier to connect it to my three twenty eight chip with node labels.
In a real design you would have specific use for I/O pins.
In this case, I do not have a specific use and I do not want to just re-create an Arduino
Nano.
So I am thinking about just putting some generic I/O pin headers on the narrow end of a board.
So I will plop down this ten pin header.
It is enough for four analog and four digital signals, leaving 1 pin for five volt and one
pin for ground.
In this design, I am not going to place a dedicated serial to usb chip.
I am, however, going to add a header that the common FTDI style boards can easily plug
into.
One benefit of this approach is that we do not need TX or RX LEDs or another group of
parts.
And THAT is all of the blocks we need to make a functional board.
Wait a minute.
I totally forgot the most important thing, the power LED!
Let’s just add one of those right now.
I am using a one-kiloohm resistor as the limiter.
The LED does not need to be bright, just there.
Alright so now, there we go.
We have all of the electrical parts for our DIY Arduino.
In the future, I will take you through the PCB layout.
Stay subscribed to see that one.
Check the show notes at addohms.com/ep23 for links to the schematic files.
If you have questions, leave them here or at discuss.addohms.com.
When your circuit is not working, remember, the best way to fix it, is to just Add Ohms.
I
am curious how many people see this message, so leave a comment.
But not just any comment.
Just leave the name of a component, not a part number, but a type of component.
Like diode.
Okay?
Cool!
Thanks again for watching!