POSTS
Week 5: Electronics Design
This week we milled a “hello world” board using an attiny44 microcontroller.
The first step was drawing a schematic and routing the board in eagle. Here’s the original board we used to re-draw:
I wanted to add a potentiometer to the board as a part of my final project, so I found the footprint for a pot:
The problem is the potentiometer we had in the shop available has pins on it and the footprint in the previous board diagram is surface mount.
I changed the footprint to have actual holes in it so my pot would fit- not an exact match but close enough for a first iteration.
I then adjusted some of the wires to make the new pot fit in a space efficient manner.
Once I finished the schematic, I switched to board mode and routed the airwires.
Once I finished routing, eagle helps you clean up by throwing errors where there’s extra ‘routes’ or where you didn’t connect pins properly.
At this point, I exported as a .brd and used the OtherMill to mill the board. Alternatively I could have used gimp to edit the red and black colors on the .png from eagle and make the colors white and black so the monoFAB mill would know how to parse the colors. But I didn’t and instead just sent my current board file as is.
The othermill instructs the user to switch the mill bit accordingly- it chooses which tool it uses to do different traces and outlines.
The othermill shows a display of the mill bit in real time on the monitor which is cool, although I don’t know how useful it is.
I used a 1⁄64” and then a 1⁄32” to do the traces, but on the othermill there’s an option to use a conservative 1⁄32” bit which goes slower when milling. The first time around I had a lot of burs on my board and had to sand it a lot and even then there were still many burs.
The next step was to figure out what parts I needed and then solder them on. The parts included the attiny44, ISP header, an FTDI, 10k resistor, 1uF cap, and a 20mHz resonator (to set the clk for us since the internal clock on the attiny44 is not reliable).
First round results came out really grea- bad!
My first mistake was trying to solder tiny components at midnight. My second mistake was trying to use a soldering iron to solder surface mount components when I have perfectly good soldering paste and hot air available! I ended up connecting two pins on the attiny44 and instead of using wick/hot air to remove the component, I was impatient given the time of night and ripped the component off my board, not realizing that would result in the copper ripping off and ruining the entire board.
So I had to mill a second board- the good news, is that I used the conservative 1⁄32” mill bit this time and my board had way less burs, although I still sanded a little bit after for cleanliness.
Then, when I began soldering, I used hot air to place the attiny, resistor, cap, and resonator on the board.
The only piece I soldered using an iron with was the FTDI. The FTDI is front heavy so it’s really hard to get it to sit on its own if I were to place it on the solder paste. I actually tried solder paste at first and then it moved around a bunch and I actually ended up removing copper from one of the pins on the ftdi but fortunately that specific pin was not relevant to this board.
I also ended up overheating my board using hot air and it started to bubble up but luckily no major damage was done so I was able to continue with the same board.
Now it was time to program the board. I connected the ISP header pins of my board to a programmer and the FTDI to my laptop using a USB to FTDI:
I ran the following commands:
make -f hello.ftdi.44.echo.interrupt.c.make program-usbtiny
make -f hello.ftdi.44.echo.interrupt.c.make program-usbtiny-fuses
I again forgot to power both the programmer and my board so I got this error when running the make file:
Once I plugged in both sides as shown, it worked and my board was programmed with the hello world code.
Once I did this I reprogrammed the board to use the hello-world interrupt code, meaning the code was setup using interrupts vs having a lot of the functionality in the while loop of the main function. Interrupts will help speed things up for me in my final project and will keep the code clean and avoid blocking other processes.
Last step was using the FTDI finally! I first tried using screen as a serial port, but screen did not handle the carriage returns well and the print statements were everywhere on the terminal.
I installed pyserial instead and ran the following command (make sure baud rate matches whatever the baud rate of data being sent:
sudo python -m serial.tools.miniterm /dev/ttyUSB0 115200