Add an output device to a microcontroller board you’ve designed and program it to do something


My first task was to place the output device in the context of my final project. As part of this, I wanted to think further on the implementation and overall arrangement of the force sensors with the output device. 01
It was somewhat difficult to determine what output device to use. While I knew I wanted to display a count of successful pull-ups for my final project, I wasn’t sure which route to take for output device. I found a great looking 5x7 LED array in the lab with zero documentation or labels. Since it isn’t part of the FabLab inventory, I dug up the data sheet and worked on making sense of it myself. 01

I was also considering a 4 digit 7-segment display component that was also in the lab but not part of the inventory. I found this AVR tutorial and this SparkFun walkthrough instructive on the basics. 01

I finally settled on just using Neil’s LED array in order to limit the risk involved (trying to learn just a few new things at once). 01

Charlieplexing can take a bit of acclimating to have it ‘click’ but once it does the rest of pretty straight forward. There is a neat little formula, for example, to determine the total number of a LEDs that can be supported based on the number of pins desired. 01

Here are a few resources I found helpful:

Mill & stuff the boards

First I milled the board using the ShopBot. I decided to mill a FabDuino board while I was at it. I’d like to leave a healthy reminder for the future to make sure the spindle key is fully turned before you click ‘okay’ when cutting. It is possible to turn it without turning it completely, in which case you will certainly break an end mill. 02 02 02
This design uses charlieplexing and a single-sided board. How is that possible? There is another layer to the board which is created using 3M cast epoxy film over the bottom layer of the board. Unfortunately, this was unlabelled in the lab so I did a quick test with a multimeter to figure out which roll of tape was insulating.

Once the correct paper was confirmed, I used the Roland Vinyl Cutter to cut the mask for the board out.

Removing the little squares from the mask was more than a little frustrating. They are sticky! 02

I applied the epoxy film carefully (truth: I went through three of these masks getting it perfectly aligned). 02 Finally, I placed some tiny strips of copper to connect the pins and did a solder bump over top. This design allows each pin to take a turn being a source or a sink of current. 02

When it finally came time to stuff the board, the only real ‘gotcha’ to keep in mind is that LEDs have polarity (which is actually what multiplexing and charlieplexing hinge on). Make sure you know which side of the LED is the anode and which is the cathode. 02

Program the boards

Programming the microcontroller to drive the LED array was a ton of fun once I got a bit of experience and exposure to the LEDs.

The first thing I did was to program an earlier board to change the brightness of an RGB LED using PWM.

There were a few resources I found helpful in rounding out my understanding of charlieplexing. I recommend:

Next up, I programmed the board with Neil’s script. A reminder on workflow for programming. First, check that the new board is recognized. 03

Then, execute the makefile to create a hex file and run the make command again with ‘program-usbtiny’ appended to it to actually target and program the board. 03 03
Voilá, some LEDs are now frenetically PWMing with Neil’s ‘flash’ function.


Make numbers

My goal for altering this script was to create the basis for a counter. This is really a prototype for the pull-up count display. I’ll replace the code and hardware with a more significant version in the final project. This is where the rubber meets the road and where really understanding how to target each LED matters.

I drew a little schematic to help. 03 03

I created a bit of a brute force function for displaying digits called Counter using Neil’s flash function. I’m sure this will get refactored but it works for now. 03 03

We have NUMBERS! … 03

Some updates I’d like to make to this code for the final project will be:

  • Counter has a session which is activated by force and time
  • Counter listens for initial force change (someone is on the bar) and starts a session or ‘count’ based on that
  • Counter receives count updates from force board and displays appropriate number for the existing session
  • Counter has a time-out function to end a session

A table leaf for Thanksgiving

I also modeled a dining room table leaf for our Thanksgiving Day feast! This gave me a chance to look into Fusion 360’s CAM system. So far it’s pretty okay but I haven’t milled it yet so don’t have much to say…

03 03 03 03 03