All Work and No Play…

I’ve spent a good chunk of the last 18 months or so busy working on something for my J.O.B.  I’m hoping to get back to my long list of unfinished projects in my upcoming vacation time away from that job.  Looking at my bench, I see lots of started-but-not-finished projects and a few things I’ve purchased to play with but never got around to.  Let’s take a quick tour:

  1. Still need to finish fixing that toy for my son who is probably too old for said toy now.
  2. I got a Raspberry Pi 2 recently and other than booting it once with Windows 10 IOT, I haven’t done anything with it yet.
  3. I got a “serial to wifi” module for something but I can’t remember what.  <g>
  4. I (finally) picked up a Bus Pirate to play with, maybe I should hook it up to that serial wifi module.
  5. I started making an alternate board for Clue to play with the kids.  It is just drawn with Sharpie markers on paper printed with Clue-sized tiles.
  6. I have a couple of “I should repair this” things that I started but didn’t get time to finish.
  7. A couple printers to tear down and scavenge parts from.

Maybe by making this list I will get around to finishing one of these.

Make a Custom Membrane Keypad for Arduino

My son got one of these Leap Frog toys a few years ago as a gift.  He enjoys playing with it very much.  I am not sure how much counting and learning he is doing but it makes funny noises and sings to him so its a lot of fun.

Recently the unthinkable happened.  It died.  Not the batteries but something else.  I took the back off to look at what might be wrong (which was very easy for a toy).  Unfortunately, other than the speaker, a switch, battery compartment, and a ribbon cable to the front, there wasn’t much to investigate.  A couple of glop tops and nothing else.  I fiddled a bit more with it but everything “external” seemed fine.

Did I mention my son really loves this toy?

It can’t be that hard to make something similar using the carcass of the old one, right?  It has all the external bits and pieces.  I just need to figure out how to take some input and play some sounds. Right?  So I spent a few hours figuring out the basics of what I wanted to change this thing into.  Audio driven from an atmega328.  A simple amplifier.  Make it power friendly (and run off of two AA batteries).

But what about that input?  The original toy had a very thin membrane keyboard basically.  I need a membrane keyboard of my own.  There are a few places that will make custom membrane keypads but that is too costly.  You can buy one of these hobbyist keypads cheaply ($3-$10 from Amazon and less than that from places like DXSoul).

That screams fun right?

What other options are there?

I decided to make my own.  There are a few tutorials on building membrane keypads. Most of the DIY keypads I’ve found don’t seem like they would be all that reliable nor resilient. I’m not looking for something to last forever but it should last long enough to warrant the 30 minutes of work needed to make it.

Future blog posts will cover more details of the final new “front panel” of the toy.  The rest of this post will cover a (boring) prototype I used to verify some thinking.

As mentioned earlier, there are sites out there that provide details of what a membrane keypad is and (more generally) what a matrix keypad is.  For my version, I’ll end up with four layers:

  • A “front decal” layer that has the images of the buttons.  This is what the user sees.
  • A “top foil” layer that contains the traces that link the rows of buttons together and provides “pads” onto which to connect wires.  The top foil layer is the opposite side of the front decal layer (i.e. the “inside” of the front of the keypad).
  • A “bottom foil” layer that contains the traces that link the columns of buttons together and provides pads.  The bottom foil layer is the “inside” of the back of the keypad.
  • A “cutout” layer.  This layer is sandwiched between the top and bottom foil layers and provides just enough separation to prevent the row and column traces from shorting when a button is not pressed.

I drew the four layers in Adobe Illustrator and printed them out.  The decal layer uses a 4×4 matrix arrangement with some “custom” graphics (thanks  After printing out the four layers separately, I had the templates to which I could attach my traces. (As soon as I figured out how to make the traces.)

There are a few options here but I ultimately need the keypad to be as thin as possible and as cheap as possible.  Using paper for the substrate covers those needs pretty well.  After a bit of searching around I came across copper foil tape that seems to be popular (or at least known) in the wearable electronics space.

This stuff is pretty cool.  It is tape so it is sticky on one side and thin conductive foil on the other.   It comes on a roll where there is a paper separating each winding.  You unroll some of the tape, cut it off with scissors, peel off the backing and stick it where you want.  To connect two traces you just overlap the tape.  It took a bit to get used to getting the backing off but it is very easy to work with.

In places where I needed multi-layer traces (!) I just used normal masking tape between the layers.  I’m sure this causes some subtle capacitive effect but everything seems to work out.

At the bottom, row and column traces are pulled off the keypad using jumper wires. They are attached using the same copper foil tape.

Top foil layer:


The bottom foil layer is simpler and once I was happy with it I glued the cutout layer directly onto it and attached leads there as well.

IMG_4596 IMG_4597

Final construction of the keypad was to glue the decal layer to one side of a piece of cardstock (thicker paper) and the top foil layer to the other side.  Then I glued the bottom foil+cutout layers to another piece of cardstock.  Finally I glued the two assemblies together.

The final bit was to test out the keypad with an Arduino.  The breadboard and jumpers below are just for my convenience so the keypad could lay flat while I was testing.


Driving the keypad is simple using the existing Arduino Keypad library.  I just had to plug in the right row and column pins.  The code follows (which is just the Keypad sample with the correct row and column information filled in).

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
byte rowPins[ROWS] = {A0, A1, A2, A3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){

void loop(){
  char key = keypad.getKey();

  if (key){

In retrospect, I probably should have attached a ribbon cable of some sort to the pads instead of the jumper wire pigtails but this works.

This prototype version of a membrane matrix keypad isn’t necessarily cheaper to build than to buy one of the ones like linked above.  However, this approach has some benefits that are important to fixing the blue toy:

  • It is thin.  Total thickness is two pieces of cardstock paper.  You can make it pretty much as thin as you want it to be.
  • Custom decals.  While the layout of this is still a pretty boring 4×4 keypad, I got to choose my decals.  Some of the matrix keypads out there let you print out buttons and insert them but that would affect thickness and possibly reliability.
  • Custom layout.  I didn’t change the layout or size of the buttons in the example above but using the foil tape lets me effectively have any layout I want to.  Buttons can be arbitrarily placed and the traces can follow arbitrary decal shapes and sizes.  This is critical for replacing the blue toy’s front panel.  I’ll follow up more on this later.

(I’ll clean up the Illustrator files and post them as PDFs.  For some reason when I view the ones I uploaded, all layers are baked together.  When I view the local files I just uploaded they look correct.  Odd.)

Update on 1/25/2015

A few people have noted that I could just use off the shelf parts or try to mimic
the tactile feedback of membrane keyboards using domes for the buttons. In this case, I
was mainly going for a very thin keypad where there are no physical switches and the
circuitry is on the structure itself. The post is really about the prototype I made to
figure out how well this method works.

The original toy had this great “touch panel” feel. It recognized soft touches and there
was no tactile response. Even though it used a matrix keypad, the button shapes and thinness
helped give a nice feel to the toy that I want to replicate. I’ll write up the actual
replacement I made for the toy and hopefully it will make more sense why I wanted something
without off the shelf switches or domes.  For a sneak peek, here is the new keypad decal layer where each truck, person, etc… you see is a button that is shaped roughly like the sticker you see.



Update on 2/4/2015

Here’s a Fritzing diagram for those curious what the circuit looks like.  This uses tact switches for the matrix keypad.



“Lab” Upgrades

For the longest time my home electronics projects have been done on a 60″ x 30″ folding table in one of our spare bedrooms.  My growing collection of project boxes, spare parts, and equipment finally started to put stress on my furniture – particularly my table.

The old lab table.

The old bowing table in its “clean” state.

I spent embarrassingly too long fretting over whether to buy a desk or build it.  If I bought something, what should I get?  Do I need an “electronics” workbench?  If I build it, what should I build it out of?  I probably spent five months going back and forth – all the while piling more junk on my table.

Spurred on by my better half (and Ministry of Finance), I swallowed my “I can build this” pride and just bought something.  I went with a Kennedy bench by BenchPro.  Specifically, I got a KF3696 which has the rounded front Formica top.  At 8′ x 3′ and well over 100 pounds, it is substantial.  It has a very sturdy feel which is exactly what I wanted.  I went with a cloudy gray top and black frame.  I like the looks very much.  I also went with the adjustable legs and set the height at 36″.

New bench.

The bench in its new home.

I couldn’t be more pleased with the ordering & delivery.  I got a quote from BenchDepot over email and called to confirm the order.  The bench came on a 9′ palette delivered to my home by the freight company.

While switching out the table for the bench, I took the opportunity to clean things up a bit and get organized. All of my project and spare parts boxes now fit neatly under the left half of the bench.  Power strips and what not are neatly along the back (both on top and bottom of the bench).

More space, better organization.

More space, better organization.

I have a few additions left that are on their way – a 4′ x 2′ dissipative rubber mat for the left half of the bench for example.  That hasn’t prevented taking the new configuration for a few test drives.  My daughter used the “new lab” to do one of her science experiments (a homemade accelerometer).


Homemade accelerometer.

So far, so good.

UPDATE: The rubber mat arrived from All-spec.  I really dig this over the previous setup.  Very sturdy and is great to work on.



Ancient History

Found a link to one of the many “big huge awesome” projects that we started in ACM@UIUC back in the day. I’m pretty sure this page is the only thing that actually came out of this project. :) I think (hope?) that I’ve gotten a little better at completing things (retro pc project and this blog not withstanding).

These big huge unfinished projects were not really failures. Many of the people who worked on projects like these at ACM@UIUC are now veterans of the startup scene or leaders behind the scenes at the hot tech shops around. I look back at these projects as ambitious and a great learning experience.

A Simple Remote-Controlled Arduino Tank

A little while ago my son was showing some interest in robotics. His birthday was coming up and we were having trouble deciding between a beginner robot kit focused more on construction or lots of bits and pieces.

The kit we looked at was the Elenco OWI ATR – All Terrain Robot:

The alternative was to build a robot based around Arduino. There are many robotics kits out there but I liked the idea of investing in Arduino as the basis for exploring robotics. I figured we would get the Arduino Uno, a few shields to control motors and sensors and whatnot, throw some wheels on it, and blammo, have a robot.

Then the shopping set in. There is a multitude of places to buy a multitude of robot stuff. I was tempted by RobotShop’s DFRobotShop Rover. Arduino compatible, everything we need to get started. And it was on sale at the time I was looking.

In the end, we bought our son the OWI ATR kit mentioned above for his birthday and I ordered a bunch of bits and pieces instead of the RobotShop Rover to build something more advanced with him. He really enjoyed the OWI ATR kit – he likes to build with his hands so it was the right balance of technology and construction.

For the Arduino robot project, I decided to start with a simple remote controlled tank. I really had no specific plan though I had searched around a bit on YouTube and such to see that others had managed to throw something together. I ordered everything from Amazon though not everything was fulfilled by Amazon so I paid shipping for a few things. Otherwise, I tried to spend as little as possible.

For the mechanicals, I used cheap Tamiya plastic bits. The instructions on these are not the most verbose but my son and I managed to stumble through without any damage to ourselves or the parts.

For the brains behind the operation, I went with a fairly stock setup with an Arduino Uno and a Motor Shield from DFRobot.

Additionally, I wanted to use a wireless PS3 controller for the remote control. I picked up a used Logitech wireless PS2 controller from my local Gamestop (since closed). You can find them on Amazon as well.

I allowed myself a bit of luxury by buying jumper wires.

A battery pack to hold four AA batteries seemed like enough power.

Assembly of the chassis was straightforward…

Tank Chassis

Assembled tank chassis with motors.

After building the chassis, the motor, and doing a quick test with the battery pack connected directly to the motors, I moved on to attaching the Uno and motor shield, I had some 1.5 inch nylon standoffs with screws that I used to mount the Arduino complex to the chassis. I did another quick test controlling the motors using the Arduino + Motor Shield.

Mounted Uno and Motor Shield

Mounted Arduino Uno and Motor Shield

//Arduino PWM Speed Control for DFRobot Motor Shield

int E1 = 6;
int M1 = 7;
int E2 = 5;
int M2 = 4;

void setup()
    pinMode(M1, OUTPUT);
    pinMode(M2, OUTPUT);

void loop()
  int value;
  for(value = 0 ; value <= 255; value+=5)
    digitalWrite(M2, HIGH);
    analogWrite(E1, value);   //PWM Speed Control
    analogWrite(E2, value);   //PWM Speed Control

Finally, I tore apart the wireless dongle for the PS2 controller, soldered on some jumper pigtails and connected it to the Arduino. Using PS2X from Bill Porter, I got basic remote control working pretty quickly.

Wireless PS2 Controller Dongle

Wireless controller dongle hanging off the back of the tank.

// Glue together PS2X controller code with DFRobot Motor Shield code
#include <PS2X_lib.h>  //for v1.6

PS2X ps2x; // create PS2 Controller Class

//right now, the library does NOT support hot pluggable controllers, meaning
//you must always either restart your Arduino after you conect the controller,
//or call config_gamepad(pins) again after connecting the controller.
int error = 0;
byte type = 0;
byte vibrate = 0;

//Arduino PWM Speed Control for DFRobot Motor Shield (default pins)
int E1 = 6;
int M1 = 7;
int E2 = 5;
int M2 = 4;
int lmotor = 0;
int rmotor = 0;

void setup()

  // set pin modes for DFRobot Motor Shield
  pinMode(M1, OUTPUT);
  pinMode(M2, OUTPUT);

  error = ps2x.config_gamepad(13,11,10,12, true, true);   //setup pins and settings:  GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error

  if(error == 0)
    Serial.println("Found Controller, configured successful");
    Serial.println("Try out all the buttons, X will vibrate the controller, faster as you press harder;");
    Serial.println("holding L1 or R1 will print out the analog stick values.");
    Serial.println("Go to for updates and to report bugs.");
   else if(error == 1)
     Serial.println("No controller found, check wiring, see readme.txt to enable debug. visit for troubleshooting tips");
   else if(error == 2)
     Serial.println("Controller found but not accepting commands. see readme.txt to enable debug. Visit for troubleshooting tips");
   else if(error == 3)
     Serial.println("Controller refusing to enter Pressures mode, may not support it. ");

   type = ps2x.readType();
   if (type != 1)
     Serial.println("warning: DualShock Controller Not Found!");

void loop()
 if(error == 1) //skip loop if no controller found
 if (type == 1)
    ps2x.read_gamepad(false, vibrate);          //read controller and set large motor to spin at 'vibrate' speed

   lmotor = 0;
   if (ps2x.Button(PSB_L1))
     lmotor = 255;
   if (ps2x.Button(PSB_L2))
     lmotor = -255;

   rmotor = 0;
   if (ps2x.Button(PSB_R1))
     rmotor = 255;
   if (ps2x.Button(PSB_R2))
     rmotor = -255;

   lmotor = 0;
   rmotor = 0;

 // update motors
   if (lmotor < 0)
    digitalWrite(M1, LOW);
    analogWrite(E1, -lmotor);   //PWM Speed Control
    digitalWrite(M1, HIGH);
    analogWrite(E1, lmotor);   //PWM Speed Control

   if (rmotor < 0)
    digitalWrite(M2, LOW);
    analogWrite(E2, -rmotor);   //PWM Speed Control
    digitalWrite(M2, HIGH);
    analogWrite(E2, rmotor);   //PWM Speed Control


Overall, the little tank worked pretty well and we had fun building it. I think the four AA batteries aren’t really enough to power the system as I couldn’t drive both motors in opposite directions simultaneously (or there is a bug in my code which is equally possible).

Assembled Tank

Assembled tank with battery pack.

Since we built this, I’ve used the Arduino for a number of projects (yet to be posted) and picked up an Ultrasonic sensor that we’ve yet to put into use on the tank. That’ll have to be a future post.

Updated: A Mostly Complete Parts List

Here’s the items I used with links to Amazon (based on looking at my order history).

From Breadboard to Protoboard

The time has come to clear some space on my breadboard so I can continue to build out the remainder of the system. I’ve collected a few prototype boards from Futurlec by tossing a few in each order over a few months. I bought a few different flavors of boards (PROTO777, PRBRDLG, and EXPBRD) to see which worked best for my random projects.

Step one was to create a few more bundles of jumper wires to use. I don’t buy jumper wire kits, instead I keep a roll of CAT5 cable and cut off lengths I need, strip off the casing, and make my own jumpers. I’ve gone through about 40 feet of cable so far on the retro pc project. Fry’s usually has 25, 50, and 100′ bulk cat5 bundles in their networking aisles for reasonable prices (definitely cheaper than the jumper kits in the components aisle ).

Another bundle of jumpers.

Next, I took a few boards and laid out sockets for all of the components that are currently on the breadboard. I taped them to the board temporarily with labels for what each part was. This let me get an idea of how many boards I would need, what parts should be located near each other, etc…

Examples of placement.

And then the soldering begins…