Week 06 - Electronics design

Menu

Electronics design

In week 4, we already covered the downstream steps of PCB production by taking an existing circuit of the FabISP and going through the CAM process. This week, we will start at the beginning by actually designing the circuit. I will use Eagle for the layouting process, starting with the schematic view and then proceeding to the boards layout drawing the traces. Afterwards, the finished design will be exported into *.png files for the internal engravings of the circuits and the external cutting of the board.

image PCB_production_process Production workflow for PCBs (source: D. Ingrassia, course material - electronics production)

So here are the tasks for Week 06:

Eagle CAD circuit design

I will use the ATtiny44 for this assignment, which versatile little chip. The data sheet can be found here.

image ATTiny84-ATTiny44-pinout ATtiny 44 pinout

Design decisions

The ATtiny44 is an 8-bit microcontroller, can run at 16 MHz and has overall 12 pins on two ports for inputs and outputs. PB0 and PB1 are dedicated to the external crystal (marked with XTAL1 & XTAL2). Page 26 of the data sheet how it needs to be connected, including two capacitors.

Apart from VCC and GND, SCK, MISO and MOSI have to be connected to pin headers to program the microcontroller via the serial programming interface (SPI).

The defined input pin PA7 for the button needs to be pulled low in order not to be in a so-called floating state. Connecting it to GND required a pull-down resistor to avoid a short circuit. A 10K resistor will limit the current to 0.5 mA, which won't damage the microcontroller.

The LED needs to reach the recommended forward voltage V_f in order to light up (2.2 V), which you can find in the data sheet. A current limiting resistor is needed to stay below the forward current of 10 mA. With the supply voltage U_s of 5 V, we can calculate the resistance of current limiting resistor to 280 Ohm, R=(U_s-U_f)/I. I used 1 K and it worked, but a smaller resistor of 0.5 K would have been sufficient as well. The resulting power dissipation with 0.1 W (P=I²*R) is also way below the resistors power limit of 0.25 W.

Circuit board design

Eagle uses libraries to add the correct parts. I imported the Fab library which contains all relevant parts for this task, including switches, LED, resistors, capacitors, crystal and the ATtiny44. I used the label function to keep everything organized. The schematic is basically drag and drop. Just pay attention to the GND as there should be a common one.

image 1_ModificationOfHelloWorld_sch Scheme of components adding a reset switch, a second switch and an LED
image 2_ModificationOfHelloWorld_brd Go to board layout
image 3_ModificationOfHelloWorld_brd Place the components to ease the wiring
image 4_ChangeGridSettings_brd Lower the grid size to align the components properly
image 5_AddPolygon_brd Use the polygon function
image 6_AddPolygon_brd Draw a rectangle to define a ground layer
image 7_AddPolygon_brd Once closed, the polygon turns into a dotted line
image 8_AddPolygonName_brd Right-click the line and click "Name"
image 9_AddPolygonName_brd Type in "GND"
image 10_AddPolygonNameGND_brd The rectangle turns red and forms the new ground layer
image 11_StartRouting_brd Click Route to start the wiring
image 12_StartRouting_brd Connect the components one by one, this might take to iterations. Click Ratnest to update.

In this manual mode, it took me some iteration to arrive at the final design. In this rather simple setup, it was possible without any "zero Ohm" resistors or bridges. More difficult layouts with several layers however cannot be done manually.

image 13_FinishedRouting_brd Finished routing

Production of the board

CAM preparation

After exporting the monochrome layout, the preparation for the CAM process is done in GIMP. We need to create two files for the internal milling path of the traces as well as the external cutting path.

image 14_ExportPNG Click file/export
image 15_ExportPNG Choose a high resolution as well as monochrome and window
image 15_OpenInGimp Open the *.png-file in GIMP
image 16_CopyInternalSection Cut the PCB section and paste as new image and save it as internal path
image 17_RoundedEdges Use the select tool and choose rounded rectangle
image 18_RoundedEdges Choose a radius of 15
image 19_FillInvert Press select/invert and fill with black color
image 20_DeleteInternal Invert select again and delete the selected section
image 20_FillWhiteExternal Fill with white color and save as external path

Final results for the internal and external path:

image HelloWorldBoard_internal_CAM Internal path
image HelloWorldBoard_external_CAM External path

Use these files as an input for Fab Modules.

CAM process

By the looks of it something was already wrong here.

image FabModules_1 Select the internal path
image FabModules_2 Choose *.rml
image FabModules_3 Set the origin
image FabModules_4 Calculate path looks wrong due to lack of isolation

In my first trial, I forgot to set the isolation of the traces but I didn't occur to me until the milling was done.

image FabModules_2 The result of the first trial

In my second trial, I set the isolation to 0.015.

image HelloWorldBoard_internal_CAM First trial internal path
image HelloWorldBoard_external_CAM_v02 Second trial with properly isolated internal path
image FabModules_5 Fab Modules calculation

I had to do the cutting twice as it did not go deep enough in the first place. In the second go, I went 0.3 mm deeper. After the second run, removal was no problem.

image Finished_Cutting Cutting process completed
image Removed_PCB Finished PCB

However, the external path image was to narrow by design, so I had to decrease the tool size (originally 2 mm to 0.5 mm) in Fab Modules to calculate the path. This made the mill hit the inner structure at the lower switch. As these are not connected, the board was still good enough to move on with soldering. Next time, it would leave a bit more space for the external path.

Soldering

The soldering is not very complex, as there is enough spacing between the individual components and the wires are well insulated. I collected all the parts and started soldering. In doing so, I mixed up the two resistors, so I had to remove the 1k resistors using copper wire which went without further damages. I used the multimeter to check the connections.

Bill of materials

image Finished_Soldering Finished soldering

Programming of the board

For programming the board, I needed the Arduino IDE as well as a patch for the ATtiny44 which could be found here . I used an Arduino Uno to burn the bootloader onto the ATtiny in the first place. Therefore, the Arduino needs to act as an in-serial programmer (ISP). Choose the correct example file from the respository, set the board as well as the port and upload the ArduinoISP program.

image ArduinoISP Flashing the in-serial programmer

Connect the Arduino to the board using the SPI connection.

image WiringBurnBootloader Schematic wiring for serial - ArduinoISP bootloader
image Burning_Bootloader Wiring for serial - ArduinoISP bootloader

In order to burn the bootloader, select the ATtiny44 from the board menu. and set the clock to external 20 MHz.

image Programming_ATtiny Set board & clock
image Burn_Bootloader Wiring for bootloader

I took the Blink sketch from the Arduino examples to verify the function. I was using PB 2 or pin 8 in Arduino language, so I had to add the respective line of code. Then, I flashed a test program onto the chip to make sure that it works...but it did not. It turned out, that most things where done correctly. Except for the fact that I used a 1M (1004) resistor for the LED instead of a 1k (1001) resistor. However, I could show with a multimeter that the voltage of the output pin was actually switching between HIGH 5 V and LOW 0 V and that the board was working. I will change the resistor as soon as possible.

image UploadTestSketch Flash test program
image ItsAlive Blinking board - it's alive!

After changing the resistor, the LED worked as you can see in the video. The code however needs to be modified to act on switching. Have a look at week 8 to learn about details.

Blink pushing a button

Extra: modifiying and making of a Satshakit

I designed and made a board for a weather station before. The board was a slightly modified Satshakit. As I had to solder a bunch of sensors to the board for the data acquisition of the weather station, I thought about soldering the DHT sensor directly to the board instead of wiring it. Therefore, I disconnected pin PC0 which will be the DHT's data pin. Additionally, ground & VCC were rewired, as well as a pullup resistor for the data pin. I added an MA04-1 component from the library which carries four pins. Pin 3 of the DHT does not have to be connected.

Circuitry scheme

As we have to solder a bunch of sensor to the board for the data aquisition of the weather station, I thought about soldering the DHT sensor directly to the board instead of wiring it. Therefore, I disconnected pin PC0 which will be the DHT's data pin. Additionally, ground & VCC were needed as well as a pullup resistor for the data pin. I added an MA04-1 component which carries four pins. Pin 3 of the DHT does not have to be connected.

image 6_ModifiedSatshakit_HumSen_scheme Modified CNC Satshakit for DHT11 sensor scheme
image 6_ModifiedSatshakit_HumSen Modified CNC Satshakit for DHT11 sensor board

Production of circuit boards

The standard manufacturing process involves a lot of steps involved also soldering of the components as well as testing of these. For this week, we will focus on the manufacturing of the PCB only (Milling step). Use GIMP to prepare an internal and external cutting path as in the lecture before.

image 6_Internal_Path Internal path (cutting with some margin)
image 6_External_Path External path (use rounded egdes, e. g. 14 % for the cutting. Choose right click --> edit --> fill with RGB color.

The settings for the milling of the circuits of the board can be found here:

image 6_Designing_PCB_CAM_internal Settings for milling of the external path, make sure to mount the engraving tool. Set the passes to 4.
image 6_Designing_PCB_CAM_external Settings for milling of the external path, make sure to mount the milling tool. Set the passes to 1.
image 6_EngravedResult Internal path (cutting with some margin)
image 6_SolderedResult Finished board: after soldering of standard Satshakit components.

Programming

For the programming part of our MEGA328P chip, we will need an additional microcontroller that already has a bootloader in installed as with the Hello_World board in lecture 5.

image 6_satshakit_programming Wiring of the Satshakit for programming. Download the ATMEGA328 bootloader here and follow the instructions to install it.

Download files

This weeks assignment

Extra task