This time the task is to redesig the Hello Board - by adding extra components. Further steps are testing and programming it.
Here is the design of pcb board
that we have to follow at first:
I’m going to use Eagle
for that. To start the design process I have to import the fablab components library
- fab.lbr. I have to download the file and place it into the library folder created by Eagle on my computer. Than I have to open the Library Manager
and add the file.
While building my design I’m going to add
the components from this library. For Hello board will need:
It’s good to check datasheets to get informations about components:
- Attiny 44
: http://ww1.microchip.com/downloads/en/DeviceDoc/8006S.pdf
- ISP header
: http://www.equinox-tech.com/products/details.asp?ID=362
Now I have to design the schematics in Eagle. Eagle is divided for two parts sch (schematics)
and brd (board)
. It will also generate two files with extensions .sch
and .brd.
Underneath short overwiev on the layout:
In Schematic
part I’m making the connections between components by using the Name
tool. It connects the components basing on thesame naming.
If one wants there is also an option of drawing the connections using the Net
tool. Though one has to be careful when the nets are crossing each other.
From schematic
level one can export the BOM
(Bill of Materials) - the list of all components used in the project.
Now I’m switching to board part
. Befor starting with drawing the traces
we set up the clearance
values in DRC
(Design Rule Check).
Clearance
is the distance between two elements. This one can’t be smaller than the drill-bit size of the milling machine. In our case is 16mil (1⁄64 inch).
It’s also very good to set up the grid
to the size of the clearance so that its easier to move around components when distributing them on the board.
You can use the Dimension
tool to measure the board, so that you have an idea of the size.
When I will finish buildingconnections on a schematic
level, I can switch to the board
part. I will see the yellow lines which are connecting components. I should draw the path following the start and end point of the yellow line
, but draw it around the components and not cross the paths. I will use the Route
tool for that.
I have to pay attention to anchor the beginning and ending
of the route in the middle of the components. Also important is to set up the trace width value
in the top of the file. I’m setting up 16mil.
Now when I built the basic board I will add extra components:
NOTE:
A LED is a diode that emits light. A diode is a component that allows an electric current to flow easily in one direction, but strongly restricts current from flowing in the opposite direction.
For calculation we can use online LED calculator
Behind this calculator stays a formula to calculate the resistance:
Voltage (v) = Intensity (A) x Resistance (ohms)
We need teo enter following values:
- Source voltage
- the voltage providec to the board from my laptop through USB port: 5 Volts
- Diode forward voltage
- this we can find in the datasheet. We can check it on https://www.digikey.com. To know for what exactly we are searching for we can chcek fabinventory database
- Diode forward current (mA)
- on the LED-calculator site there is an information:
If you have good specs from your supplier, you’ll want to enter the typical forward current in milliamps here. For 3mm and 5mm LEDs, this is usually 20 mA or close to it. A few special, high-power LEDs exist, but they always come with specs. So if you need to guess, use 20 here.
Now we know that the resistor has to have value more than 180 ohms 1⁄8 W!
After adding the extra elements and creating PCB layout we have to run the Rule Check
.
There are two to run:
- Electrical Rule Check - ERC
- This one is checking the connections on schematics. We got alerts about not connected paths.
- Design Rule Check - DRC
- This one wrns about the distance mistakes, if one component or path is too close to another.
Exporting the PCB layout
To export the layout above, we have to hide all layers (with informations etc.) ecept the red one with paths. To do so we go to the layer settings
window.
Than from top menu we choose Export - Image, and entering/marking the following:
This is how we get the png
file with traces. To get the png with cut-line we can open the traces file in Gimp/Photoshop ( NOTE: We have to pay attentionif the programm is not scaling up the file! ) and create other file just with outline.
This files will I will upload to MODS in order to generate the .rml files, format needed for milling machine.
Detailed description of creating the rml
files in MODS you can find in Electronics production assignment
Milling PCB
I was following the process that I’velearnt during the Electronics production assignment. Though some new problems occurs!
from one line the copper layer was not removed properly
. The reason is probably sight uneven surface of the wooden-sacrificial layer. Luckily this doesnt affects the current flow.
one line was not being cut properly
. That’s really weird since eagle didn’t reported the clearance allert in thet case. It must has happened during creating .rml file in Mods.
Later on I checked again the paths generated in Mods and one can see it.
In the end ettect I did scratched this part out with a cutter.
Now it’s a time for testing the traces with Multimeter.
It’s an electronic measuring instrument that combines several measurement functions in one unit, like voltage, current, and resistance
.
This is how the Continuity check
looks like:
Here an iteresting small tutorial from Kris on how to check properly DC values:
Soldering process
In this case ofsome components one has to pay attention of orientation:
Programming the board
I need to connect the board with the programmer and laptop USB port:
ISP header
from my Programmer with my Hello Board ISP header
by using a rainbow ribbon cable (that I’ve previousely made myself:D).FTDI USB cable
to 1x6 pinheader
. This connection provides the power from my USB port to the Hello Board.I will program my board using Arduino platform
First in the top menu under Tools
I have to specify the type of board and programmer that I’m going to use:
Board
Im choosing ATtiny 24/44/84
Processor
- ATtiny 44
Clock
- External 20 Mhz
Port
- dev/ttyUSB0First thing I have to do before uploading the actual code is burning the bootloader
The bootloader is a program that starts every time a device is powered on to activate the right operating system.
After running that operation I can start actual programming of my board.
I’m going to run thwo examples from ARDUINO examples:
We have to specify which pin from microcontroller realays to which pin from Arduino. We know that on the schematic made in Eagle the LED is connected with 6th pin of ATtiny44. For translation we cancheck this schematics underneath:
Attiny44 - pin 6 = Arduino - pin 7
We set up:
const int ledPin = 7;
const int buttonPin = 3;
The setup
function runs once when you press reset or power the board. In this case it initializes digital pin LED_BUILTIN as an output.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
Here I’m going to change (LED_BUILTIN, OUTPUT) for (7, OUTPUT)
The loop
function runs over and over again forever.
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
HIGH
- turns LED on
LOW
- turns LED off
delay
- specify the break before another loop
Here I can manipulate the frequency of blinking.
With this code I would like to reach such an action: when pressing the button I’m switching on fast blibkinog of LED. When I release the LED turns off. To make it true I have to combine the code from first example with this one.
const int buttonPin = 3;
const int ledPin = 7;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);
} else {
digitalWrite(ledPin, LOW);
}
}
Files made during this assignment:
Button board pngs
Button board rmls
Button blink_1
Buttob_blink_2