Skip to content

5. Electronics production

(This is last year’s text. I want to redo this week’s assignment, not least because my gorgeous little board has gone AWOL.)

This week’s exercise was about producing a modern electronic component, specifically a microcontroller programmer. Things have moved on a lot since last I made a device myself (a miniature swimming robot in a 10cc syringe). Where back then we used sockets for the chips and soldered all of the standard, full-sized components onto the backs of PCB breadboards, then scratched out the links between the rows of copper strips, today we get to work with highly miniaturised components and much more sophisticated PCB makers.

The adventure this week starts with a visit to Andy Bardagjy’s FabISP page, where he describes the design of a simple ISP which can be made out of the standard components available in the Fab inventory.

The FabISP

The FabISP is built around the ATtiny44 microcontroller. Andy makes the PCB layout available on his website, along with a simple circuit diagram, so that we FabAcademy students (and presumably the world at large) have a place to start. The circuit diagram (reproduced from Andy’s site below) is really very simple. It consists of a single chip (the ATtiny44) with a 22 MHz crystal and a USB connector. The USB data lines are connected through zener diodes and series resistors to convert the logic from 5V to 3.3V (the breakdown voltage of the zeners). The VCC positive power supply to the chip is filtered through a pair of capacitors to ensure it’s clean and reliable.

Andy provides a circuit board layout. There are two parts: the tracks (1st image below) which are to be milled into the top of the PCB, and the outline (2nd image) which is to be cut completely through.

Preparing for CAM

The black and white images need to be turned into a set of CAM instructions for the CNC machine to use. This was achieved using the tool on fabmodules.org. The first prompt wants the filename of the circuitboard image. The second prompt is for the type of mill (in this case a Roland mill, model MDX-40). And the third prompt chooses the process. The first pass (shown below) is of the tracks on the board (cut first!).

CAM program for the PCB tracks.

The next step was to set the rest of the parameters. First zero the x0, y0 and z0 values above, set the speed to 4mm/s, then set the process variables as below. Tool diameter is 200um. The offset overlap controls how many passes the tool makes over each area - here each “lawnmower” pass covers 50% of the previous pass. The “number of offsets” is set to -1 to make sure all of the copper between the various tracks is removed. Then click calculate to see the calculated CAM tracks. Click save to create the file needed for the CNC mill.

Settings for CAM program for the PCB tracks.

The process was repeated for the outer frame, this time using a 1mm tool and a speed of 1mm/s. A new .rml file was created and saved to disk.

CNC milling the PCB

The CNC PCB mill is a straightforward piece of kit to use. The mill itself is like any other (finally this old mechanical workshop technician meets a piece of FabLab equipment he recognises!). The appropriate endmill (we used two: 0.2mm for the surface milling and 1mm for the edges) is secured in the collet with a pair wrenches.

As with any mill, the precision of the part placement and the stability of the clamping are the most important parts of the operation. In this case, we afixed a new PCB to a 10mm piece of MDF using several strips of double-sided tape. The MDF was then clamped to the mill bed using 8 spring clamps.

PCBs taped to MDF and clamped in place.

The software that runs the mill is called VPanel. Its GUI is quickly understood. The controls are used to move the table in X and Y, and the head in Z. Before beginning the cutting, the head is placed somewhere central on one of the blank PCBs. The hard part here is touching down in the Z direction. It is possible to convince yourself that you can hear the mill just touching the surface, but better is to move it a bit in x or y and watch for the formation of a bit of copper dust. In my case, I had to stop and start the cutting a few times to dig further into the surface of the copper, until I found a zero which removed all of the copper but didn’t dig too far into the underlying PCB. Once the final zero Z is achieved, then use the “Set Origin Point” section of the GUI to zero the axes.

The local control panel

When all is set, then hit “Cut” in the bottom right corner, select the .rml file to be cut, and the machine goes to town on the copper. Change tools after the tracks have been cut, manually find a new z0 using the jog commands on the VPanel, then hit “cut”. The result is below:

The board is complete

“Stuffing” the PCB

Once the board is ready, the next step is to solder all of the components onto it. All of the components were readily available in the Fab inventory. Soldering was straightforward. Nothing really new to learn there, as I’ve been making electronics since I was a kid. The novelty for me was the surface mounting, but after the first few joints, that got easy quickly. I used the technique of tinning one pad, tacking the component down, then properly soldering the other end before returning to the finish the job at the starting end. The detail work was greatly simplified for my old and screwball eyes by the large, illuminated magnifying glass provided!

A work in progress

After all of the elements were soldered, I checked every connection with the continuity setting of the multimeter, making sure that the PCB tracks were in fact connected to the legs or ends of each of the components. I paid careful attention to the VCC and ground elements of the USB connector and connector pins - any shorts there and it would be lights out for the computer motherboard (I’ve seen that happen before, and not enjoyed the experience).

The finished board

Next came the “smoke test” using a separate USB hub to spare my Mac the potential damage. The device passed that fine.

The “Smoke Test” - note the absence of escaping smoke. All is good.

In order to program the ATtiny44 chip, it has to be primed by connecting its pins 4 and 10, which is achieved by making a solder jumper bridge across the two pads on the board between the chip and the header pins.

Board in programming state - note the solder jumper between the chip and the 6-pin header.

Interfacing with a Satshakit

Programming the FabISP required the use of another programmer. A chicken and egg problem.

CC credit: HDBuzz

The programmer of choice in our lab is the satshakit laser. This is connected to the computer using a Satsha-TTL USB-to-Serial converter. The latter is wired to the former using the diagram below (from https://github.com/satsha-utilities/satsha-ttl.)

The Satshakit is then wired to the the FabISP using the following two circuit board diagrams. (From https://github.com/satshakit/satshakita> and http://academy.cba.mit.edu/classes/embedded_programming/hello.ISP.44.res.png.)

In summary, the wiring between the boards looks like this:

Satsha-TTLSatshakit LaserFabISP
GNDGNDGND - Pin 1
VCC5VV - Pin 3
DTRRSTF
RXTX - Pin 1
TXRX - Pin 0
MOSI - Pin 11MOSI - Pin 2
MISO - Pin 12MISO - Pin 4
SCK - Pin 13SCK - Pin 5
Pin 10RST - Pin 6

The ground had to be divided between all three chips, so I used a breadboard for the temporary connection. The final wiring looked like this:

Setting up the Mac

Before I could get down to programming the chip, I needed to install some software and drivers on my computer. I already have XCode installed for another project, so all I had to install for this course was Crosspack AVR, which I downloaded from a link provided on the archive.fabacademy.org website. The next step was to download the FabISP firmware, also using a link provided on that same website. Once that was installed, I then started up the terminal and ran two commands:

make clean
    make hex

The first of those cleared out the executables from the download, and the second created new ones specifically for my computer.

To interface with the new device, I used a Satsha-TTL USB-to-serial converter. To do this, I needed to install the CH340G drivers for HighSierra, which I got from Björn’s Techblog

. To confirm that the Satsha-TTL was actually working with the Mac and to identify the name of the USB port, my instructor recommended I just use the Arduino IDE. Once updated to version 1.8.x for HighSierra compatibility, that software confirmed we had a connection to the Satsha-TTL and listed the port as /dev/tty.wchusbserial1420. I then modified the Makefile to work with it (using Dima’s documentation). This involved editing one line of the Makefile using vi. The line in question is the third AVRDUDE line in the pic below.

I’ll continue this shortly…

make fuse to set the first settings in a blank chip got the ok after it uploaded the first settings test make program got the ok after a complete upload disconnect the programmer, unsolder the jumper check that the FabISP appears in Apple:About:SysReport:USB

Downloads

Links will appear here shortly.