Electronics design

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:

smaller

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.

eagle add

While building my design I’m going to add the components from this library. For Hello board will need:

  • R1 10k - resistor 10 Oohm
  • C1 1uF - capacitor (package C1206FAB)
  • FTDI Header
  • ISP - 2x3 - 6 pin programming header
  • XTAL 1 20Mz - resonator 20 Mz
  • IC1 t44 - Attimy 44 microcontroller

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:

eagle add

In Schematic part I’m making the connections between components by using the Name tool. It connects the components basing on thesame naming.

smaller

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.

smaller


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 (164 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.

mods nodes

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.

brd


Now when I built the basic board I will add extra components:

  • LED
  • resistor which will prevent LED from burning - current-limiting resistor (we have to calculate its value)
  • button/switch
  • resistor 10 Ohm

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)

mods nodes

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 18 W!

schematics

board


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

layers

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:

  • Monochrome
  • more or equals 500 dpi

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.

layers

This files will I will upload to MODS in order to generate the .rml files, format needed for milling machine.

layers

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.

mods nodes


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.

multi

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:

  • Attiny 44 - the dot in the corner has to be where the VCC
  • LED the green line has to be on the side of the GND

mods nodes


Programming the board

I need to connect the board with the programmer and laptop USB port:

  • I’m connectiong ISP header from my Programmer with my Hello Board ISP header by using a rainbow ribbon cable (that I’ve previousely made myself:D).
  • I’m connecting a FTDI USB cable to 1x6 pinheader. This connection provides the power from my USB port to the Hello Board.

cables

I will program my board using Arduino platform First in the top menu under ToolsI have to specify the type of board and programmer that I’m going to use:

  • for Board Im choosing ATtiny 24/44/84
  • for Processor - ATtiny 44
  • for Clock - External 20 Mhz
  • for Port - dev/ttyUSB0

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

smaller

After running that operation I can start actual programming of my board.


I’m going to run thwo examples from ARDUINO examples:

  • Basics - Blink / Turns on an LED on for one second, then off for one second, repeatedly.

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_pins

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.

  • Digital - Button

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