Skip to content

7. Electronics design


Week assignment

  1. Test the operation of a circuit board (group).
  2. Design a hello-world board with additional buttons and LEDs (individually)

Design a hello-world board with additional buttons and LEDs

I chose a board that I was going to be able to program using what I did in week 05. I decided to design a hello board ATtiny1614 with an additional LED and button. There are 3 main steps to design a PCS:

  1. Defining the schematic
  2. Designing the PCB with the traces
  3. Building the PCB

As we were introduced to Kicad during the class I followed the steps and use the ATtiny 1614 example as a base for my design.

Example ATtiny1614 board

attiny1614 example

I opened Kicad and created a new project. Clicked on the schematics icon and started adding the components using the FAB library that we added during the class. I redraw the hello board example using an ATtiny 1614, a connector to UPDI, a capacitor, and a connector to FTDI. Then, I added a LED, a resistor, and a switch.

In order to be able to define which pin I should use for the LED and the button I checked the following diagram:

Attiny1614

At that moment the only information that was clear for me was that all pins were and option except for Ground, VCC, UPDI and TX & RX. On my first attempt I decided to use pin number 8.

This was my first attempt. I got confused by the microcontroller, I made the schematic with the 3216, but then I corrected it and put everything together with the 1614. The file name in Kicad left it as 3216 because Oscar told us that changing the file name could generate bugs later. Also, I did not realize that in this design the microcontroller was completely useless.

first attempt

When I got to the lab, I started the process of exporting the .svg to open it in Inkscape and convert my file to a suitable .png. But, fortunately, I checked it with one of the instructors. He explained to me that I should move my LED to another pin for this to have sense. So, I went back to the schematic, changed the connections, and added a new resistor. I spend like 2hs trying to wire all the components until I realized that I was able to get some connections through the microcontroller.

Options to check when exporting to .svg

  • Cooper layers: F.CU
  • Technical layers: Edge cuts
  • Print mode: Black and white
  • SVG page size: Board area only
  • Print board edges
  • Pagination: All layers in a single file.

Getting the .png ready in Inkscape

When I finished organizing the components I created the outline and then exported the design to .svg. I opened this file using Inkscape and created 3 layers:

  1. Background
  2. Traces
  3. Interior

first second attempt

First, I drew a big black rectangle and move it into the Background layer. Then, I moved the outline into the Interior layer and filled the figure with white using the bucket. Finally, I moved the traces into the Traces layer and turn them white.

I choose the interior (outline+fill) and select the option to export it. I Chose selection, defined where I wanted to export, and then moved to custom and clicked export. By choosing custom instead of selection, I was able then to select the traces, define the name for the file, and exported again using the same size I used for the interior. For the image definition, I entered 1000 dpi.

After exporting traces and interior to .png, I opened mods and followed the steps I documented on the electronic’s production week.

I got my files ready to mill and started the process.

While I was doing the first one, the instructor noticed that my traces were a little bit thin and that the UPDI connector was located behind the capacitor. As I was focused on making everything match I didn’t notice that, so I went back to Kicad and moved this component. I also changed the thickness of the connections to make them less fragile and changed the outline shape to make better use of the space.

This was my last board and the one that makes more sense. So, I went back to the Attiny1614 diagram and this time chose 2 different pins, one for the LED and one for the switch. By doing this I was going to be able to program them. I discussed this with Josep and he told me I was also going to need one 1k resistor for the LED and one for the switch.

I used the multimeter to check how to connect the switch but I does have a very small G on the back for ground. The LED has a green line on th GND side. I connected the LED to the resistor and to the pin PA6 and then ground to GND. For the switch I did the same thing, connected the positive to the resistor and then to the pin PA5 but in this case I also connected the resistor to VCC.

last attempt schematic

last attempt

I selected my components and decided to make 2 boards in case that something goes wrong in the programming process.

  1. ATtiny 1614
  2. Capacitor 1UF
  3. UPDI connection
  4. FTDI connection
  5. 2 resistors 1K
  6. LED
  7. Switch

For this last board I milled, I choose to use the other corner as the one we all use (left-bottom) is not well level and I had to re-set the Z at -10 on the previous process. Anyway, in the end, I had to set the Z at -05 to get a proper cut.

board

different traces

I tested the boards to see if there was any short or something that was not connected properly. At least, the LED worked!

finished board

connected

To program I used the FTDI and UPDI made on the 4th week and I followed the instructions on this page.

I used Arduino IDE and I just followed this tutorial to install megaTinyCore, choosing the ATtiny1614 microcontroller and selecting the proper port. Which should have been the easiest part but I had some issues on my Mac, that I still need to understand, but seems that it was a problem of the type of USB connector I was using.

/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.

BOARD: ATtiny1614/1604/814/804/414/404/214/204
Chip: ATtiny1614
Programmer: jtag2updi (megaTinyCore)
*/

#define LED_BUILTIN 2 //PA6 (Pin 2)

// the setup function runs once when you press reset or power the board
void setup() 
{
    // initialize digital pin LED_BUILTIN as an output.
    pinMode(LED_BUILTIN, OUTPUT);
}

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

programming

Find all the files here:

Design Rule Check

I used the begginer guide to Kicad to understand how to use it properly. Here I found the tutorial to run the Design Rule Check. I used the same defaults for trace width and trace spacing that they use. But then I realized it was too thin so I changed it from 0.2mm to 0.3mm for the tracks and from 0.4mm to 0.8mm for vias. The button to check your design looks like a bug and on click it displays a modal were you can define these parameter. If something does not match is going to indicate it with a white arrow and will display what type of error is on the modal.

  • Clearance: By Netclass
  • Min Track Width: 0.3mm
  • Min Via Size: 0.8mm

Testing the board with the multimeter

As I was not able to join the group when they tested the Raspberry Pi, I decided to fulfill the assignment by testing my new board with the multimeter. I watched this video to understand how to use the multimerter.

I checked the board against my blueprint to understand how things should be wired and I also checked the schematic for polarities. Before I even connected the board to the power supplied I check for shorts between VCC and GND and if my microcontroller was solder in the correct position.

Things I measured:

  • Voltage
  • Resistance to check the resistors
  • Continuity to test if conductors were open or shorted, if the switch was operating properly and if circuit paths were clear.

Last update: June 29, 2021