Joao Wilbert
How to Make (almost) Anything 2019

Week 4: Electronics Design

For this week our task was to design and mill the Hello World Board adding a button and an LED to the board circuit. Given I had previous experience with Eagle I chose to use it as my PCB design sofware. As a starting point I used the board designed Neil (pictured below).

Eagle BRD File
Eagle Schematic File
Dimension PNG File
Top Traces PNG File

Designing the board

I choose to redraw the board in Eagle. Below are the schematics of my final board. I tried to organize the board by using less nets and make use of the Name feature in Eagle to connect signals. In this way the schematic looks tidy. I also checked the pinout of the Attiny44 to make sure I got the pins in the correct orientation.

I looked up the ATTiny Datasheet to check if the pins on the datasheet matcched the ones on the library and to ccheck the orientation of the microcontroller.

Having checked the datasheet I listed the remaining components based on Neil's design. For the button I choose to connect it to pin 6 of the microcontroller and connect it to ground with a pull resistor. For the LED I calculated the value of the resistor based on current rating and forward voltage drop of the LED. A 330Ohms resistor would suffice so I chose to use the 499Ohm resistor we have.

This is the final component list of the board:
ISP 2x3 header
1 uF capacitor
10k resistor
1k resistor
Blue LED
6mm switch (button)
1x6 pinout

For layouting the board used Eagle appluing the design rules of 16mil clearance and using a trace width of 10mm. This gave me some freedom of design but I found hard at some points to trace between pads of the microcontroller. I took me a few tries until i could get all traces to work within the board layout. I then ran the drc command to check of any errors and make sure that no airwires were present.

I then exported the board to mods and used the milling machine to mill the board. I exported the image using 1000dpi of resultion on Eagle. Based on previous experience I knew that on Maccbook retinas 1000dpi is twice the the real size of a board. So I opened the exported PNG in Photoshop and resized the board by 50%.

Milling and Production

Using mods and the SRM20 I milled the board withou major issues using a 1/64 end mill for traces and 1/32 for the outline the board came out successifully.

The board milling went smoothly, I got a board with healthy traces to the design that I had intended. I then moved on to soldering the board. My soldering skills improved, I managed to get all components soldered without any issues.

Here is an image of my final board milled without any components. After milling the board I then washed it with IPA and let it dry before soldering the components.

After soldering the components when checking the final design of the board with the schematic I realized that I didn't draw a trace. In debugging my board by probing with the multimeter I found that I didn't connect the reset pin from the 6 pin header to the microcontroller port. I then did a quick hack to try to connect the board. This is a temporary solution and would be ultimately replaced by a trace.

This is far from ideal but my plan was to move on and test the board like this to validate the design and then I will come back to fix the issue by redrawing some of the traces.

Components testing

In this last step I encountered a lot of issues which I am still working through.

Issue #1: Programmer Not Found

Here is where I ran into issues. After assembling the board I went on to connect it to my computer to program it using my programmer. The first issue I ran into was that ATTINY programmer board couldn't be found by my Macbook Pro (using USB-C). I then ported the code to a Desktop Macmini. In the Macmini the ATTINY could be found but when trying to run the command as described in programming tutorialI first was facing a -1 error from Avrdude.

Issue #2: ATTiny24 vs ATTiny44

After solving the issue with the reset button I stumbled across a new problem. When trying to upload the software I was getting a error that the expected id of the board was mismatched. Which made me suspect that the microcontroller that I was using wasn't in fact the 44 (even though I got it from the drawer of ATTiny44). After comparing it with Jack's board I then noticed that the chip inded wasn't the correct one which explains the issue I was facing.

Here is an image of the defunct board. My plan now is to: update the design of the board with a new rev that includes the missing reset cconnection. (2) select and check the ATTiny board before I solder in the component. (3) Assemble a new board.

I wan't really happy with this result, so I decided to design, mill and populate a new board.

A Fresh Start

Designing Board

In my new design I fixed the issue with the missing reset trace. It took me some time to redefine the traces and I had to move the components around to the new design. I also added a bit more space on the right of the board for the FTDI connector to sit nicely on the edge.

Milling and Populating Board

I took care to check the programmer markings before soldering on to the board to prevent my previous mistake. I also added a bit more solder to the components to make the connections stronger. The new layout worked fine so this is what the final board looks like.

Programming Board

To program the board I decided to write a step by step manual bringing all the tutorials I read to one place.

Based on Julia Ebert's tutorial I wrote a new tutorial that includes both the programming steps and the Python serial tests.

First you have to connect the board to the programmer and make sure that the pin orientation is correct. If the pins aren't correct (either on the 6-pin header or FTDI) you see orange or red blinking lights. If all pins are correct you then see green lights.

1. Download:
Hello World C File Hello World Make File Other links here

2. Put both files in the same directory, connect the FTDI and 6-Header Pin and run:
$ make -f hello.ftdi.44.echo.c.make

If you are using your own ATTiny Board:
$ make -f hello.ftdi.44.echo.c.make program-attitny
$ make -f hello.ftdi.44.echo.c.make program-attitny-fuses

If you are using AVRDude:
$ make -f hello.ftdi.44.echo.c.make program-avrisp2
$ make -f hello.ftdi.44.echo.c.make program-avrisp2-fuses

You should see a confirmation that the program has been uploaded OK before moving to the next step. Below is the output that you should see if the commands worked.

Running Python Test

Download the from CBA site. uses TkInter (Python module for GUI) and pyserial (Python module for serial communication). Make sure both are installed on the machine before proceeding. The steps below were performed in a Debian Linux desktop:

Install pyserial for Python2.7:
$ pip install pyserial

Install tkinter for Python2.7:
$ sudo apt-get install python-tk

After having both modules installed. Connect your board (after programming it) and use $ lsusb to check if the computer sees the device. You should see a Future Technology Devices International. If that's there it means the machine can see the FTDI adapter.

Now run $ ls /dev/tty/USB and press tab on the terminal. That should give you a list of the USB devices connected. The board will be either in /dev/tty/USB0 or /dev/tty/USB1 Final step is to then run declaring the port and speed.

$ python /dev/tty0/USB0 115200

You should see the GUI of Tkinter open and every character you type should be echoed by the board.