Click here to go to the programming of the board.
The main concepts that we have to know when working with circuits are Voltage(V), Current(I) and Resistence(R).
They are related with Ohm's Law, which was described previously.
The aim of this week asigment is to redraw the Hello-world PCB board adding some extra components like a LED and a button.
The software that I will use is Eagle, as the free version that I have as a student is quite complete for what I aim to do, and also because I am using Fusion 360 to design and this programs can interact between them.
First thing that I had to think about was what components I had to add. In order to obtain information about them I had to frecuently search for them in the Inventory and then visit the DigitKey website for the especifications.
LEDS: I will use a red and green LED. In the LEDs is important to know the Voltage-forward (voltage that you will loose) and the current that it can support. (To save energy you can reduce the intensity of the light). One LED will be connected to the INT0 pin of the microcontroller.
Buttons: They need a pull-up resistance for being able to read them. The legs of the 6-pin header already have a resistance so generally you don't need to add one to the button. I will place it on the right side of the board.
I gathered some of this information following a Sparkfun tutorial.
We have two main editors:
Installing the FabLab library: I went to the Resources repository and I downloaded the fab.lbr. I opened Eagle, I went to Options->Directories
, in order to see where the libraries are stored; and then I went to that file and I pasted the fab.lbr there.
Eagle Menu:
So, once I knew a bit what options the interface had I started to create a test project following the Sparkfun tutorial. I Right clicked on the Eagle file
, where you can directly create a new Project or create a new file; in the new file Create new project -> Create an schematic: and save it.
It is important to choose what library you are going to use, as it is not needed to have all of them active. We can click on the right button in Managed Libraries and we turn on the fab.lbr
library. And right click on Manage Library if we want to set it as Use none
.
Once you have opened the Schematic you can either click on the buttons on the left-side menu or you can just type the command that you are looking for and that tool will be activated. The main ones are:
use
in a certain library that you needed.
LINE
tool with the NET
one. To join components that are close to each other like in the first image, you just trace a net between them, but sometimes the components are far away from each other and to join them directly will mean to put a net across all the scheme. In this case, what we have to do is: Name
tool to change its name to what they need to be joined.
Label
to be able to see it.
Useful tips that I learned and I will apply to the desing of my board:
- Place the crystal/resonator close to the microcontroller, in general, all the components that are related as closer as we can.
- One of the capacitors needs to be placed next to the microcontroller as it will be connected to the GND and the VCC to avoid noice.
- Avoid rectangular edges.
I have explained these previous steps with screenshots of the test board that I created following the tutorial.
I did the next table because at the beginnign I was doubting about what components I had to include in my board and also what was their corresponding Digi-key link.
# | Name | Desctiption | Link DIGI-KEY |
---|---|---|---|
1 | Attiny44 -SSU | ATTINY44A-SSU-ND | Link |
2 | Head 3X2 pins(PINHD-2X3-SMD) | 609-5161-1-ND | Link |
3 | FTDI-SMD-HEADER 6pins | S1143E-36-ND | Link |
4 | Resonator 20 MHz | XC1109CT-ND | Link |
5 | Resistor 10Kohm (RES-US1206FAB) | 311-10.0KFRCT-ND | Link |
6 | Resistor 470 ohm (RES-US1206FAB) | ||
7 | Resistor 330 ohm (RES-US1206FAB) | ||
8 | GREEN LED of 1.8V (LEDFAB1206) | 160-1169-1-ND | Link |
9 | RED LED of 1.8V (LEDFAB1206) | 160-1167-1-ND | Link |
10 | Unpolarized capacitor of 1uF (CAP-US1206FAB (CAP-US)) | 445-1423-1-ND | Link |
11 | Button (6MM_SWITCH) | SW262CT-ND | Link |
The value that I choose for the resistance came form the calculations looking at their properties:
RED LED: 1.8V , 8mA
GREEN LED: 2.1V , 10mA
After checking that the schematic is correct you click on Generate/Switch to board
. All the components will appear on one side of the board. As we did before it is good to show the Grid
, as in this case it will be really useful by forcing the components and traces to match the grid that we have defined.
Save as...
.
size
is 0.254mm / 10 mil and alt
5 mil.Make sure you don't close one of the windows (schematic/board) because the program will give you errors.
I had some issues when drawing the traces because I started with the VCC and then I did the small traces between the microcontroller and the LEDS, HEADS..., leaving the GND the last one. When I went to connect the GNN to the components, I had a lot of conflicts and I had to erase some nets and re-do them. At first I was not aware that the traces could go trough the middel of the microprocessor!
Once I had joined all the components I checked the DRC settings and I had to change some of the nets as they were very close to other components or other nets. You can see on the right side of the DRC window in the image that the GND net is very close to the VCC pad. I had some distance errors at this point but also when I went to mods, some of my traces were not going to be milled. (Picture in that section.)
To export the file, you only need to select the traces and pats, in my case the Top layer, File->Export->Image
: Check the Monochrome check box, give a 1200 resolution and then click OK
.
- When I exported the image, I first forgot to check the Monocrome box
so the resulting image had the appearance of the one in the board interface.
- Another mistake that I had was that when I exported it, the shape of the button and the microcontroller were appearing. The problem was that I used the command Layer
by writing it and the resulting window was not the same as the one that you open when you click the Layer settings
icon. So, when I was selecting the Top layer in the first way it was not working properly.
Once I had fixed all this mistakes I exported the final Image in the .png format.
Once you have exported the image from Eagle you open the image in an image editor, Photoshop in my case, in order to include a border for the Modela to cut the outside part.
- We make the canvas bigger, adding 1.6mm on each side, centered, and we leave the default background in white.
- You export this file as .psd just in case and as .png. = The resulting file is the traces one.
Then you do the outside file, you select the border and you fill it with black and you invert the selection to fill the inside with white.
First thing I had to do was to press the ON
button to turn on the machine. Once you have done that the machine will move to the right side and the board will come to the front. Then, in order to be able to change the location parameters in the computer we press the button VIEW
.
ctr-alt-t
), to start the server (cd mods -> http server -> sh start
).DOWN
button in the machine until you have 0.5 cm distance in the head of the machine (see picture) move to origin
.calculate
, and you check that is going to mill properly the traces. When I was doing this step I realize that my traces were not going to be good.After checking all the traces and modifying the board in Eagle I send it to the printer and the boar was milled successfully. Here yo can see two pictures of the Modela.
For soldering the components I had to look at the board design and decide in which order I will solder them and think about the positions of those components that are directional.
I checked that the program was working in three different ways:
I did the first steps that are required for programming the board on the 7th week, Electronics design, in the Programming the board section:
I downloaded the code files from the Academy:
- hello.ftdi.44.echo.c
- hello.ftdi.44.echo.c.make
- term.py
I connected both the programmer and my board to my computer and between them, using the FDI connections. When you connect the programmer and the board between them you have to make sure that the pins are ok connected. Check in the scheme where do they have the GND.
In the same way as I did when programming the programmer (Week 05), as the file make has the commands that I need to create the .hex file, I opened a new terminal, I went to the directory where I had saved the files and I wrote:
$ make -f hello.ftdi.44.echo.c.make
Then I executed the command that allows the creation of the fuses:
$sudo make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses
Everything worked properly so I proceed to the next step:
$sudo make -f hello.ftdi.44.echo.c.make program-usbtiny
Aditional Board Manager URL
, in Arduino's preferences. burning the Bootloader. Then, go to Tools -> Board -> Board Manager
and select the ATTiny thay will now appear thanks to the previous step.
Then you write a code and you upload it to the board using the top left buttons of Arduino's IDLE.
#include <SoftwareSerial.h> const int buttonPin = PA7; const int redLedPin = PA3; const int greenLedPin = PB2; int buttonState = 0; SoftwareSerial Serial(PA0, PA1); // RX, TX void setup() { Serial.begin(9600); // setting the LEDs to outputs and the button to output pinMode(redLedPin, OUTPUT); pinMode(greenLedPin, OUTPUT); pinMode(buttonPin, INPUT_PULLUP); } void loop() { buttonState = digitalRead(buttonPin); if (buttonState == LOW) { digitalWrite(redLedPin, HIGH); Serial.print("The red LED is on"); } else { // turn LED off: digitalWrite(redLedPin, LOW); } }
If you now open the Serial monitor of Arduino and you type some letters, you will have them printed.
I created the rectangular base in Fusion giving it the size of the board. Usually you have to do it in the other way round but as I created first the board I will do it like this. I just created a rectangle of 40,26x30,8mm, and pull it a few mm up.
Then I went to Preferences -> Preview ->
and check the PCB feature checkbox
.
Then you go to the Create Menu->Create PCB
. You choose the first option in the top menu PCB profile
, selecting the sketch as the profile and the (0,0) as the origin. The board will change the colour to green.
Now we move on to Eagle, you can find the steps in this Autodesk tutorial, and in the board interface you click on the Fusion SYNC
, and check the Link to an existing Fusion design. There I pulled my design from Fusion and once it was done I clicked on push to Fusion. (Because before I put the shape of the board in Eagle, and then I 'send' the components to Fusion). As in my library the components don't have a 3D figure, for now in fusion you can only see the shape of them.
Now I will have to add the 3D figure of the components in the library and then push it again to Fusion for having the real rendering design. So, to do that, I created a new 3D library Right clicking on the desired library, Fab.lib in my case - > Create Managed Library
. You wait until the library is created and then you right-click the new one in order to Open
it.
Then, Edit 3D Package on Web
, logging in with the Autodesk user.
Go to package selecting the component you want to modify and then you click on Add model
. When I opened this option I spend a lot of time searching for the components, and a realize that there is a window where it suggest you one shape and usually it was the one I was looking for. Once you have finished you have to refresh the library not only in the online version but also in the Eagle one.
One you upload the component to the 3D model you have to Save
it, Save a version of it, so when you go back to the online library it will appear in the top part Upload(#number of components you added).
I used two devices to measure my board components. One was the Multimeter and other one was the Oscilloscope.
Measuring the resistance value: in order to check if they were working properly I used the 20K option to measure the 10k resistance and then the 2K to measure the led resistances of 470 and 330 ohms. You just need to move the wheel when the multimeter is switched off to the option you want and then place the plugs on both sides of the resistances.
Measuring the voltage: I used the continuous current option to measure the voltage value between components. I measured from side to side of the LED using the 2V option.I also measured from side to side of the resistance observing, as is expected, a loss of voltage. I also checked that from the VCC to GND I had 5V.
Checking the continuity:
Is important to check the continuity of a circuit, not only to check that the components are really connected between them but also to check that we don't have a short-circuit. The way of doing this is by selecting the continuity symbol on the multimeter and placing the plugs over a trace or component connected to GND and other to VCC.
For using this oscilloscope we need to connect the probe to both ground and the part we aim to measure.
When I used the Oscilloscope I had compiled one of the example programs in arduino, the Blink one, to see how the signal in the oscillatory was changing. You can see in the square signal of the screen when the light was turning on and off.