7. Electronics design¶
This Weeks’ Task:¶
Group Assignment¶
- Use the test equipment in your lab to observe the operation of a microcontroller circuit board.
Individual Assignment¶
- Redraw the echo hello-world board. Add (at least) a button and LED (with current-limiting resistor), check the design rules, make it, and test it. Extra credit: simulate its operation.
Group Assignment¶
Here is a link to our group assignment page.
Individual Assignment¶
To begin with, we had to design the echo hello world board ourselves using circuit board design softwares. The one that I used was Eagle. This was my first time using it and therefore, I had to look up some tutorials to help me get started.
These were the three tutorials that helped me:
These tutorials will help you get started with eagle including how to open, create a new project, adding a library, how to start a schematic and PCB. If you’re not familiar with circuit design softwares, please make sure to watch a tutorial beforehand. This surely helped me out quickly.
Library¶
The first step was to add the fab lab library in eagle. Here is a link to where you can find the library. Go to ‘eagle’ > ‘fab.lbr’ and click on the download icon at the top right corner. Save the library in your eagle > library folder that will appear when you install the software. Then open eagle and go to the top toolbar ‘Library’ > ‘use’ and open the library you just downloaded. You can now start adding components from this library while designing your schematic.
Schematic diagram¶
This is the schematic of my circuit that I have designed. As per the requirements, I have added the LED and button in which you will find them at the right of the schematic. I have also shown some of the basic tools that I have used to design the schematic. I did face quite issues while designing the PCB later since I wasnt able to connect one trace due to the overlapping problem. I did change my circuit design twice, changed the positions and orientations of the components but it did not work. I was always left with one overlapping trace, therefore, I placed a 0 ohm resistor which connects the VCC of the capacitor to the VCC of the AVRISP. This can be seen as R4 at the bottom left of the schematic.
PCB design¶
Moving on to the PCB design, the intial step is to create a PCB from your schematic drawing. In order to do that, you can find the icon at the top toolbar which will convert you schematic to PCB. Or, you could go to ‘File’ > ‘Switch to board’ and then the pcb page will open.
The next thing is to specify the position of your components by moving them around and rotating them until you find their best position. This might be confusing and time consuming if you are new to this, just like me, but you will get used to it once you proceed further. After placing them in their positions, try to reduce the size of your pcb by dragging the outer yellow outline of the black page by using the move tool. This might help you position you components properly according to the size of the board. You can always increase and decrease the size depending on your design.
Before starting to draw the connections or traces between the components. Check your design rules. You can find this icon at the bottom of the toolbar as ‘DRC’. Ask your instructor for the design rules. This will include the width of the traces, clearance, distance between each trace etc. Start drawing the traces by selecting the ‘route’ icon in the toolbar. Draw the route by dragging from one end of the component to the other end of another component.
Here is the PCB design. As i mentioned earlier, I added a 0 ohm resistor to connect between the overlapping trace.
This is the design rules used for designing my PCB
Exporting the PCB¶
Go to ‘View’ > ‘Layer settings’ and select hide layers. This will remove all the layers on your board. You only want to show the top layer, therefore just click on the left side of the ‘Top Layer’ row, so that the eye icon appears. Something like the image below will be displayed.
Then go to ‘File’ > ‘Export’ > ‘Image’ and change the resolutions settings to 500 DPI and select the monochrome. This wil give you a black and white PNG image.
Editing the board¶
After exporting, I opened the image using GIMP to edit it.
- Go to ‘Image’ > ‘Canvas size’.
- Link the width and the height together by clicking on the link icon at the right of the boxes. Then add 20 px to the width. Automatically the height will change as well.
- In the Offset settings, click on centre to centre your image.
- When you’re done, click Resize.
- Go to ‘Image’ > ‘Flatten image’.
- This created a white border around your image which will be considered as your board outline.
-
Save the file. This is the file that you will use to create the traces. You can add a white text if you want and it will be milled out with the traces.
-
Use the bucket tool with black colour to fill in all the traces and only keeping the white outline.
-
Save this as a separate file since this will be used to mill out the outline.
Milling the board¶
After saving the the png images, I used Fab Modules to prepare them for milling.
Traces¶
- Insert image as png.
- Choose the output format as the machine you’re using for milling. In my case it was Roland mill (.rml)
- Choose the process as PCB traces (1/64).
- Adjust the output settings found at the right side of the image.
- Set the machine. In my case it was SRM-20
- Speed: 3mm/s
- x0: 0mm
- y0: 0mm
- z0: 0mm
- zjog: 12mm
- Click calculate and the image preview will show how the traces will get milled.
- Click save.
Outline¶
- Insert image as png.
- Choose the output format as the machine you’re using for milling. In my case it was Roland mill (.rml)
- Choose the process as PCB outline (1/32).
- Adjust the output settings found at the right side of the image.
- Set the machine. In my case it was SRM-20
- Speed: 0.5mm/s
- x0: 0mm
- y0: 0mm
- z0: 0mm
- zjog: 12mm
- Click calculate and the image preview will appear.
- Click save.
Open the VPanel to adjust the origin settings manually before milling. This defines the starting point of where the drill bit will be to start cutting. After adjusting the origins, allow the spindle to spin for 5 minutes atleast and then add the file you want mill and click on cut. Dont forget to change the drill bit while milling the traces and outline. The tool bit for traces is 1/64 and for outline is 1/32.
Soldering¶
Tools used:¶
- Sharp tweezers
- Solder flux pen
- Solder iron
- Solder
Components used:¶
- 20 MHz Resonator
- 0 ohm Resistor
- 2 10k ohm Resistor
- 200 ohm Resistor
- 1uF Capacitor
- IC1 ATTiny44
- J2 FTDI
- J1 AVRISPSMD
- Push button
- Blue LED
Here is an image showing how I soldered the resistor.
Here is an image showing how I soldered the microcontroller.
Here is an image of the final PCB.
Programming¶
Before programming, I did the continuity test using a multimeter to check whether all the connections are right. I found one connection which was not done properly due to the solder and I fixed it.
In order to program the board, I used an arduino and the software Arduino to program it. First of all, we need to install the attiny44 in the arduino software. I followed this tutorial to help me do that. These are the steps I did.
-
Install the ATtiny support using the built-in boards manager. I found the link to install in the above mentioned tutorial. You can also just type in google ‘attiny44 programmer arduino’ and you will find many links. Then, go to File > Preferences, paste the link in the ‘Additional Boards Manager URLS’ as shown below and click ok to save.
-
Go to Tools > Board > Board manager. You must find the ATtiny at the bottom of the list. CLick install and after its done you should see the word ‘installed’.
-
Go to Tools and edit the board, processor, clock, port and programmer settings depending on what you’re using.
-
Go to File > Examples > Basics > Blink to test out if the LED works in your circuit.
-
For programming the board to turn the LED on, I used the blink example code in arduino to do it. This is the code example:
// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(PA3, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(PA3, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(PA3, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
I replaced the pin in the example with the pin that I connected the LED to the ATTiny44 in my schematic. In my schematic its connected to pin 10 which is PA3. Before uploading the code, I did the burn bootloader just to ensure that the programming will follow the code accurately. It is recommended to do that once at the beginning of a new code just to ensure that the program flows systematically with the code. Go to Tools > Burn bootloader.