December 1, 2014

As part of my research with children, I have been working with paper as a substrate for circuits. Paper is an extremely versatile, cost-effective, craft-friendly, and expressive medium. Moreover, it is child-friendly and can tolerate mishaps that tend to occur while children are playing or learning. It is by no means as sturdy as a PCB, but paper circuits can be easily created and replaced. Needless to say, other researchers and makers have explored this space, and my work here is merely following their footsteps.

One method to create low profile electronic traces on paper is to use copper tape. This method is cheap and does not require anything other than a pair of scissors and a soldering iron. While this method works for tinkering and creating simple circuits with minimal components (e.g. light up LED, make a switch), it soon becomes very time consuming and error prone to create even slightly complicated circuits that employ SMD parts or microcontrollers. Part of my research, explores the use of intelligent paper circuit blocks that children can magnetically interface with to create a variety of craft visualizations. While I can create one or two paper circuit blocks with SMD traces by hand, it soon becomes tedious when you have to create enough for a classroom of children.

To solve this problem, researchers and makers have typically used desktop vinyl cutters to cut out copper circuits from adhesive backed copper foil. This requires an expensive vinyl cutter such as the Roland GX-24. This post details my efforts at replicating this process with a less expensive (~$200) desktop craft cutter, the Silhouette SD. This is a somewhat older craft cutter and has been superseded by the Silhouette Cameo. However, the methods detailed here should work with the newer Silhouette models as well. Rather than cut out each copper trace separately and transfer it by hand, I focused on cutting the entire circuit and transferring it as one piece to a cardstock substrate. This maintains pitch, or the relative distance between pins in electronic components.

A few notes on the materials: it is fairly important that a sticky cutting mat is used; without this, the copper sheet will bunch up. The default blades with the Silhouette SD do not perform well. The ratchet blade in my experience produced the best results. The copper sheets can be found on Ebay in packs of 4.

I used Eagle PCB Design to model a simple microcontroller circuit that actuates a RGB LED. This paper circuit block employs circular magnetic connectors to interface with other circuitry. I used a through-hole package for the microcontroller, 1206 SMD packages for the resistors, and 6x5mm SMD package for the RGB LED. These are slightly larger SMD package sizes and provide some distance between the copper traces. If the packages are too small, there is a tendency for the copper traces to lift up while being cut by the craft cutter. Additionally, a 1mm trace width was used for all the connections. The traces, pads and dimension layers were exported to an EPS file format using the CAM processor in Eagle. The EPS file was then converted to JPG using Photoshop. The resulting circuit image is shown below:

The image can then be imported into the free version of Silhouette Studio. In order to cut the traces in copper, we need to trace the outline of the black connections. Fortunately, Silhouette Studio has a trace function (top right icon toolbar, also selected in the image below).

To use this feature, we have to first click the button, “Select Trace Area,” then draw a selection bounding box around the image as shown in the screenshot below.

With the bounding box drawn, we then set the high pass filter value to 12 and press the “Trace” function under the “Apply Trace Method” heading. This produces a red outline around the electronic traces.

We then need to remove the original image by selecting and deleting it from the workspace. Once this is accomplished only the red outlines will remain as shown in the image below.

Next, we firmly attach a piece or sheet of copper foil to the sticky cutting mat and load it into the machine (see image below). Make sure the copper sheet is secure on the cutting mat.

Next under “Cut Settings,” we select “Printable Foil” as the material type. We also want to set the ratchet blade to 1. Please note that this does not automatically set the ratchet blade on the cutter to 1. That must be done manually while loading the blade into the cutter. If you find that your blade ceases to cut after cutting a few circuits then increase the blade and ratchet setting to 2 or 3. The relevant settings for cutting copper foil are shown below.

Once we adjust the settings, we can then send it to the cutter. In the first image in the gallery below, we can see the resulting cuts for the circuit presented earlier. To transfer the copper from the sheet to the substrate, masking tape can be used to peel off the circuit (gallery below). If some of the traces are not lifting then push the masking tape back down and rub over the area. We can then cut the masking tape to the exact shape of the substrate and paste it on. In this case, the circuit is mounted on thick cardstock that is cut into the corresponding octagonal shape. When we peel off the masking tape, we are left with the full copper circuit on the substrate. All that remains is to remove the excess copper around the traces with a pair of tweezers.

comments closed

October 10, 2014

The pocket AVR programmer from Sparkfun is very useful tool for uploading bootloaders via ISP to any custom boards that use Atmega microcontrollers. However, the firmware on these programmers is often stuck at whatever version was the latest at the time of board production. In my case, I had a Pocket AVR programmer from February 10, 2010 (back from when they dated the boards). I found that the programmer was somewhat flaky in OS X Mavericks and would often fail during bootloader uploads with verification errors. While I could have easily purchased a new programmer with a later firmware, it felt wasteful, considering that the hardware had not changed all that much. All it needed was a firmware update. Fortunately, the folks at Sparkfun have provided a SPI header on board for updating the firmware.

Sparkfun’s version of the firmware is based on Dick Streefland’s work and the latest version can be found on his site. In the package, there is a subdirectory called usbtinyisp that contains a modified version of the spi application used by both Sparkfun and Adafruit’s AVR programmers.

In order to compile the latest firmware, we need an AVR compiler suite since the programmer uses the ATtiny2313. Fortunately, most Arduino distributions come with the necessary compiler tools. They are typically located in the Arduino install directory under /hardware/tools/avr/bin. You simply have to add this location to your path. I used the latest 1.5 version of Arduino since it contains a recent version of the AVR tool chain. Once the AVR compiler tools are in your path, change to the usbtinyisp subdirectory in the downloaded usbtiny package and type make. This should produce a main.hex file that can be flashed to the programmer.

To flash the new firmware, we need to solder a 2×3 male PTH header in the header holes marked Not ISP. The location of the holes are circled in green in the image below.

Once the header is soldered, we can use another programmer to flash the firmware. In my case, I used another AVR programmer with a programming cable that attached to the header pins as shown below.

If another AVR programmer is not available, an Arduino programmed as an ISP can also be used. The pinout for the header is shown in the schematic below and the corresponding connections to the Arduino are shown in the associated table. As a reference, Pin 1 is marked with a small underscore on the PCB silkscreen (right by the P in ISP).

Arduino as ISP

ISP Header

5V

Pin 2

GND

Pin 6

D11 (MOSI)

Pin 4

D12 (MISO)

Pin 1

D13 (SCK)

Pin 3

D10

Pin 5

Once all the connections are made, issue the following commands from the directory where the firmware was previously built (usbtinyisp).

The commands above utilize another pocket programmer to flash the target device. With the Arduino as ISP approach, you need to change the parameter -cusbtiny to -carduino and add -P COMPORT, where COMPORT is the port to which the Arduino is connected. This value shows up under Tools->Port in the Arduino IDE when your Arduino is connected. In the commands above, I have lowered the baud rate to 9600 and the bitclock (ISP clock) to 250 μs. These are fairly conservative values and results in a slow upload, but they are reliable across multiple platforms.

Note: If you are using another AVR programmer to flash the device, then make sure the programmer is set to power the target; this is often a switch on the programmer.

comments closed

July 7, 2014

Recently, I needed a reliable method for a master microcontroller to send commands to a set of uniquely identified slave nodes. In this network, the master microcontroller (ATMEGA328P) communicates with the slave nodes (ATTINY85) by broadcasting the unique node identifier along with a set of commands for that particular node on a shared serial line. Thus, only the node whose ID matches, alters its behavior while the rest discard the data. While we can send human readable communications (e.g. “Node ID: 5, Command:Blink, Buzz”) across the serial line, this method is often resource and bandwidth intensive, especially for smaller microcontrollers. In my particular case, the ATTINY85 slave nodes were also running on their internal oscillators and simulating serial in software. As I found out, this particular approach is sensitive to transfer errors since the internal oscillators are less accurate than their external counterparts. Thus, I also needed some form of error control.

To address these issues, I created a small library called SimplePacket that forms binary data packets for software serial communication. While the library is written for software serial, it can be easily modified to accommodate other methods such as I2C. The library essentially forms a packet as shown in the figure below. It includes a start and end flag to frame the user data along with a XOR checksum to address any transfer errors.

The data is specified through a struct and passed to the SimplePacket send function. The only restriction is that the data structure needs to be the same between the sender and receiver. A rudimentary data structure for the master-slave communication network would be:

struct DATA_STRUCT {
uint8_t node_ID;
uint8_t command;
};

The library itself is fairly simple and consists of three functions: init, send, and receive.

The init function expects a pointer to the software serial connection and the size of the data structure you expect to transmit or receive. This allocates a temporary buffer for receiving data. The send and receive functions expect a pointer to the data and the size of the data. These functions construct and deconstruct the packet respectively. The receive functions only returns true when a full error-free packet has been successfully received.

The library can be downloaded from my Github repository. It also contains examples for sender and receiver.