7. Electronics design

Objectives of this week are:

1- To redraw the echo hello-world board and add (at least) a button and LED with their current-limiting resistors.

2- To check the design rules, make the circuit and test it.

3- As a group, use the test equipment in the lab to observe the operation of a microcontroller circuit board.

Group Assignment

To check the group assignment please click on the link here.

Eagle

I have started this week by downloading Eagle software from Autodesk. Although I have an experience with Altium, I chose to work with Eagle software this time because it was recommended by the instructors. Also, I chose it becuase I would like to learn about different and new PCB designing tools. I have started by watching a youtube video to learn how to install libraries, add parts, connect wires and edit schematic layout in Eagle. The video was really helpful and I get familiar with the software very fast. Here are the steps I followed to design my circuit of this week.

I have created a new project, then new schematic, then:

1- Firstly, I have installed the fab library from this link. I have installed it in the same path of the Eagle libraries folder.

2- Secondly, in Eagle software, I go to Library > open library manager > In use > Browse > chose the library > open. The library then will be added and installed in the software.

3- After that, I added the electronics components of my circuit by clicking of the “Add part” icon from the tool bar.

4- Then a list of all the available libraries will appeared, chose the fab library and click on the component that you would like to add to your schematic.

5- Left click to place the component in the schematic.

6- Esc to return back to the “Add Part” section.

7- You can move, rotate and mirror the component by clicking on the following icons from the tool bar , then click on the component itself.

8- Keep adding the components of your circuit until you finish the schematic. Since I am redrawing the echo-hello-world board, I have redraw the original circuit with extra led and push button.

Here is how the original circuit look like:

Here is how my schematic look like:

  • LED added to pin 6 with 560 ohm limiting resistor.
  • Push button added to pin 10 with 10K resistor.

Tips:

  • Make sure that you are using the correct foot-print of the components.
  • If you can not find any of the components needed for your circuit, try to find it library and install it.
  • To add the ground to your circuit: go to Add Part > supply1 > GND.
  • To add the Vcc to your circuit: go to Add Part > supply1 > VCC.
  • To add a net to your circuit, click on the following icon from the toolbar.

PCB design

Next step is to design the PCB (Printed Circuit Board). The PCB components and connection is automatically generated from the schematic. Personally, I enjoy making PCBs and arrange the components layout. Making a PCB for me is like a game or a puzzle that should be solved smartly. Here are the steps I did to complete my PCB:

1- In Eagle software, click on File > switch to board > yes. Then, a window like this will appear.

2- Edit the size of your board (the black area) by left click on the yellow top line, and then drag down. Also, left click on the yellow line from the right side, and drag it to the left.

3- Edit the design rules by clicking on the following icon from the tool bar.

4- Start drag and drop the electronics components on your board (the black area). Organize the layout of the components, rotate them and keep what is connected to each other next to each other to make the routing easier later on.

5- After you finish, click on the “Route” icon from the tool bar to Start routing. Make sure that the wire width is more than 12.

Here is my final PCB layout:

Milling

To milling my PCB, I have followed exactly the same steps of week 5 but this time I had to create the circuit traces and outline images by myself. So, here is what I did:

1- Firstly, From Eagle software, I clicked on View > Layer Settings > Hide layers > I clicked only on top layer > OK.

2- Then, I have exported the file as image. I clicked on File > Export > image. I changed the settings as follwing.

3- Next, to produce the traces and mill-out files, I have used GIMP. I found this link very helpful.

  • First, I opened the traces image.

  • Then, I clicked on Modify > Canvas > Canvas Size.

  • I linked the proportions by clicking on the icon at the right side. Then, I added 20px to the width.

  • I clicked on “Center” to center the image.

  • Then, “Resize” button.

  • To have the 20px white boarder around the board traces image, I have flatten the image by clicking on “Image” > flatten image.

  • I added my name in the corner.

  • I saved the file and here how the traces image look like.

  • After that, I had to produce the outline file. So, I have used the bucket tool to fill in all the traces and white spaces with a black color.

  • Only the white border remained. And here is how the outline image look like.

  • I have saved the files and the circuit was ready to be milled.

The process of milling and soldering all mentioned in week 5. As using the fab modules, I have imported the traces picture first to generate the gerber file of it. The setting of generating this file was as following:

1- From image I have selected the traces image.

2- Next, from the output format window, I have selected the Roland mill as this is the machine we are using.

3- Next, from the process window, I have selected the PCB traces 1/64 as for milling the traces of the PCB we are using the drill bit 1/64.

4- Finally, from the setting on the right side, I have edited them as following:

5- Click on calculate to see how the machine will mill your circuit. You will get something similar to this:

6- Click on save and the file will be saved as .rml which will be later imported on the machine software for milling.

For generating the rml file for the outline, from image I have chosen the outline picutre that I created ealier using GIMP. From the output format window, Roland mill option has been chosen as well but, the prcoess was 1/32 instead of 1/64. For cutting the PCB and making holes, we changed the drill but to 1/32. Also, the setting from the right side has been changed as following:

After generating both files for the outline and traces from fab modules, 1-layer PCB has been placed on the SRM machine to be cut. Firstly, the traces have been milled then the outline.This has been done following excatly the same steps mentioned in week5

Here is the final look of my circuit.

Programming

For programming, I have used the Arduino uno board and Arduino software. I have followed those steps:

1- Firstly, I have installed the ATTINY44 library following this tutorial.

2- Secondly, I have connected the Arduino to my PC through the USB port and go to File > Examples > ArduinoISP and clicked on upload.

3- Then, from the tools, I have changed the board from Arduino uno to ATTINY44.

4- After that, I have connected the headers of my circuit to the Arduino pins as following.

  • VCC to Vin
  • GND to GND
  • MOSI to pin 11
  • MISO to pin 12
  • SCK to pin 13
  • RTS to pin 10

5- Then, I go to Tools > Burn bootloader.

6- Finally, I have uploaded a simple code to my circuit to blink the LED. Here is the code

void setup() {
  pinMode(PA7, OUTPUT); //PA7 is the LED pin
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(PA7, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(PA7, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

7- My circuit worked correctly.

Blink LED from Zahra Almukhariq Page on Vimeo.

Also, after testing the circuit with blinking the LED, I have write another code for controllering the LED from the pushbutton that has been placed in the circuit. The same connection was made as I have only uploaded another code. The code of controlling the LED from the pushbotton is below:

void setup() {
  //start serial connection
  Serial.begin(9600);
  //configure pin 3 as an input:
  pinMode(PA3, INPUT_PULLUP);
  pinMode(PA7, OUTPUT);

}

void loop() {
  //read the pushbutton value into a variable
  int sensorVal = digitalRead(PA3);

//Contolling the LED from the pushbutton:
  if (sensorVal == HIGH) {
    digitalWrite(PA7, HIGH);
  } else {
    digitalWrite(PA7, LOW);
  }
}

The video below shows that I was able to control the LED of the circuit using the pushbutton.

Download files

Schematic file

PCB file

Problems

After milling my PCB, I noticed that some of the tracks are linked togather. Therefore, I used cutter to separate them and doing the continuity test to make sure that they are not connected. This might happened because of the designing rules of my PCB.

Also, When I reached the programming stage, I noticed that the reset pin of the header is not connected to anything.

I checked my schematic and I noticed that I wrote the letters wrong (I wrote RST instead of RTS). And that’s why the connection did not generated and appeared when I switched to design my PCB.

I solved this problem by soldering a single core jumper wire from the RTS pin of the header to the rest RTS connection.