Archive for the ‘Tutorial’ Category

Building push button arrays (keypads) the easy way

Wednesday, November 30th, 2011

I thought I'd share the method for constructing arrays of push buttons using common 4-pin tactile switches that I came up with while building some keypads for testing an upcoming project. All you need is a little perf board, some solid core 22-gauge-ish wire, and a handful of 4-pin tactile switches.  The specific switches I'm using here are Omron 12mm tactile switches, but there are plenty of similar switches out there (check out the huge selection at Digikey and Mouser).

First off, these 4-pin switches generally have two pairs of pins that are connected to each other internally.  The switches I'm using have pins 1 and 2 and 3 and 4 connected internally. When the button is pressed, the two sets of pins are shorted. We can take advantage of the internal connections of these buttons to easily create the interconnected rows or columns of our button array.

Tactile switches placed on perf board

Start off by laying out your array on your perf board and cutting it down to size. I've left exactly one row of perf holes between each button. You can get away with placing them closer, but do not place them further apart, as we'll be bending the pins of the buttons to form electrical connections between buttons on the back side of the perf board. It doesn't matter what orientation you place the buttons with, as long as you're consistent.

Next, flip the board over and bend the neighboring pins you want to connect together. You'll want to form a nice line of buttons that are all connected together on one side as shown. These connections form a row (or column, depending on the orientation) for your array.

Next we'll need to form the columns of our array.  You'll want to connect the side of the switches that you didn't bend together in the previous step together in columns perpendicular to the  connections you just made.  I do this with 22-guage solid core wire by first sizing a single jumper needed and pre-cut all 6 that I'd need to place to save time.   I placed each wire jumper and bent the protruding ends in opposite directions so that each would stay in place until I soldered them down.

After all the wire jumpers are in place and the correct pins are in place, inspect your work and make sure everything looks good and that no columns or rows have been accidentally connected.  If everything checks out, solder up all the connections.

Soldered connections

Now the array is actually complete, using only 6 wires. Now all that's left to do is wire the row/columns of the array to whatever circuit you happen to be using with them and add some finishing touches.

I added a 10-pin header to the board for connecting to some other hardware with some 10-pin ribbon cables I've got around, added some holes for mounting the keypad (and probably its cover plate), and added cap hardware.  Hopefully I'll be posting details on the project these keypads will be used in in a couple weeks...


Building an Electic Hamster

Friday, November 18th, 2011

RC Hamster Ball

I recently revisited a project I threw together about 2 years ago, the remote control hamster ball!  I made my original prototype out of a light switch cover, some L-brackets, 1/4" threaded rod and some spare RC stuff.  It wasn't the prettiest project, and it didn't work great, but it did work:

Prototype RC Hamster Ball Mechanics

Fast forward a couple years an now I've got my handy laser cutter, some more cheap RC gear, and a bit more free time.  My new design features nice durable laser cut ABS parts, is considerably easier to build, and goes in and out of the hamster ball fully assembled (it's a tight fit, but the original design had two parts that had to be assembled in the ball).  I've posted up my design files for the new ball on Thingiverse here.  A list of hardware you'll need and a cheat sheet for the parts is included with the design, but here they are if you need a reminder:


I get my skate bearings from a local skate shop for a lot less than McMaster-Carr, so you might want to price skate bearings before ordering.

The only tricky thing to get in terms of electronics is a continuous rotation servo, and I suggest you just get a cheap standard servo an modify it yourself for continuous rotation.  You can of course buy a stock continuous rotation servo rather than modify your own, but they're a lot less common than your standard RC servo and can be a bit slower based on some of the cheaper ones I tested (specifically the GWS35 STD).  If you need some pointers on converting the specific servo used here over to continuous rotation, see my previous blog post.  There are also plenty of good tutorials out there on the subject as well.

Now to to build this thing!

Assembly Instructions

Step 1: Assemble and install the mounting brackets in the hamster ball.

Ball Cover Mount

Ball Internal Mount

Part Qty
7" Hamster Ball 1
Drive Bracket Parts 1
Support Bracket Parts 1
8mm M3 bolt 4
M3 Nut 4

Make sure you pay attention to which side you install the brackets!  One bracket couples the main assembly to the ball and should be installed in the ball itself.  The other side supports the main assembly bit isn't driven and should be installed on the lid.  You should be able to operate the ball if you switch this around, but it will be harder to assemble and harder to keep the lid from popping off during operation.

You'll need to glue the brackets in place and try and get them fairly centered on both the lid and the opposite side of the ball.  I used special plastic epoxy to bond my brackets to the ball, but whatever you use, make sure it makes a strong bond between acrylic and ABS.  Some epoxies don't bond to acrylic well and might not work.

Step 2: Install the drive servo brackets.

Drive Servo Brackets

Part Qty
Drive Servo Bracket 2
Continuous Rotation Servo 1
1/4" Nylon Spacer 4
20mm M3 bolt 4
M3 Nut 4

You'll want the rubber inserts for the servo installed. Take care to not pinch your servo wires when sliding the brackets on.  Also, make sure the orientation of the servo matches the above picture.

Step 3: Assemble and install the drive servo gear.

Assembled drive servo gear

Part Qty
Servo Horn Gear 3
1/2" #2 Screw 2

The drive servo gear consists of 3 layers of 1/8" ABS sandwiched together and screwed down to your drive servo horn.  There are 2 sets of holes on all the drive servo gear parts, differentiating them from the drive shaft gear parts.  These two sets of holes have slightly different spacing for use with different servo horns and you should only use one set of these holes to attach your servo drive gear parts.

Step 4:  Place nuts and attach the drive servo to the main body.

Part Qty
8mm M3 Bolt 4
M3 Nut 4

Drive brackets with nuts installed

Main body on top of drive servo bracket
Screws added to attach drive servo mount

Place the drive servo assembly on a flat surface and install the M3 nuts.  Next, carefully place the main body as shown and install the 8mm M3 bolts (the shortest M3 bolts) and tighten everything down.

Step 5: Attach steering servo horn to the main body.

Stering servo horn attached to main body

Part Qty
3/8" #2 Screws 2

Attach one of the servo horns provided with the servo to the main body with two 3/8" #2 screws.

Step 6: Attach the steering servo to the steering servo bracket.

Part Qty
Steering Servo Bracket 1
Standard Servo 1
Servo Mounting Screws (hardware that comes with the servo) 4

Steering Servo Attached to Steering Bracket

Use the mounting hardware that came with the servo to attach the steering servo to the steering servo bracket.  Again, you' ll want the rubber inserts installed as well as the metal eyelets.

Step 7: Attach the weights.

Washers attacher to steeing bracket

Washers attacher to steeing bracket

Part Qty
1" #8 Bolts 6
3/4" Fender Washers 96

Now we'll attach stacks of washers to the weight plate.  Shifting the weight of these washers around will allow the ball to move and be steered in a particular direction.  Stack 6 washers on the side that will face the main assembly and 10 on the opposite side as shown for all 6 stacks.

Step 8: Center the steering servo and attach it to the main body.

steeing bracket attached to main body

The steering servo needs to be centered before attaching it to the main body.  You can do this one of two ways.  The first way to do this would be to attach the servo to a powered RC setup and let the servo find center automatically.  Just plug in the servo and power up your receiver and transmitter and it should find center if you're not touching the controls.

The second way is to find it mechanically by installing a horn on your servo and moving it gently until it stops, indicating you've hit the end of travel in that direction.  Note where the end of travel is then turn the horn gently in the opposite direction until it stops and note that location as well.  Now move the horn until you're exactly half way between the two end of travel points and your servo should be centered.

You don't have to be too exact here, as you're transmitter should allow you to tweak the steering a bit.  Once your servo is centered attach it to the horn you already installed on the main body with the horn screw supplied with your servo.

Step 9: Assemble the bearing brackets.

Completed bearing mounts

Part Qty
Bearing Bracket Parts 2
3/8" #2 Bolts 6
M3 Nuts 4

The main thing to remember here is that the part with the tab at the bottom goes in the center of your 3-layer bearing bracket sandwich.  That, and remember to put your M3 nuts in between the layers as you're assembling them so you'll be able to attach them to the main body later.

Step 10: Assemble the drive shaft gear.


Part Qty
Drive Gear 4
1/2" #2 Screw 2

Using the 1/2" #2 screws, screw all 4 layers of the drive gear together.  Here we see the completed drive gear with drive gear washer in place after the drive gear has been assembled:

Step 11: Assemble the drive shaft "kabob".

Completed drive shaft kabob

Completed drive shaft kabob

Part Qty
Drive Key 1
Completed Drive Gear 1
Completed Bearing Brackets 2
Drive Gear Washer 1
7" M8 Rod 1
M8 Nuts 7
M8 Washers 4

Next we take the assembled bearing brackets and drive gear and make the drive shaft kabob.   Insert the skate bearings into the brackets and use the above diagram (not scale) and pictures as guide for the ordering of components.  You'll want the open side of the brackets facing toward the center of the assembly.  Leave about an inch of space on both sides of the bearings.  You may want to try and use the main body assembly as a reference for the placement of the bearing brackets on the kabob as well as the drive bracket in the ball for the placement of the drive key on the kabob.  Once all the parts are installed in the correct order with about the right spacing, tighten the pairs of nuts shown in the above diagram together with a pair of wrenches (hold one of the nuts in place and tighten the other, just like locking a pair of jam nuts).  This will lock each bearing and the drive key in place on the drive shaft.

Step 12:  Install the drive shaft.

Part Qty
8mm M3 Bolts 4

If everything's spaced correctly, you should be able to attach the drive shaft kabob to the main body without any problems.  If the bearing brackets don't line up to the slots for them on the main body, you may have to make some minor adjustments to the kabob, retighten everything and try again.

Step 13: Assemble the battery wiring harness.

Battery wiring harness components

Completed battery wiring harness

Part Qty
4-AAA Battery Holder 1
RC Receiver Battery Switch Assembly 1

Next you'll want to prepare the wiring harness.  Do this by simply splicing in your standard 4 AAA battery holder where the normal RC 4 cell battery back would plug in (the shielded connection not like the other 2 on the switch assembly).

Step 14: Install the batteries and power switch.

Part Qty
Velcro Strap 1

Use the hardware provided with the switch to mount it on the main body, add batteries, and use a Velcro strap to secure them to the main body as shown.  Make sure you run the strap through both the slits on the main body provided for this.  You'll probably have to trim a little of the strap off when you're done as well.

Step 15: Attach the receiver and clean up the wiring.

Part Qty
Velcro Strap 1

Next attach the receiver in a similar fashion.  Plug the steering servo into port 1, the driver servo into port 2, and plug in power as indicated on the receiver.  Clean up the wiring a bit by folding the excess lengths of wire under the Velcro strap holding the batteries in place.

Here's what everything should look like when you're done:

Operating Instructions

Now that everything is assembled it's time to give this thing a test drive!  Here's how to get everything in the ball and rolling.

Step 1: With the receiver powered off, insert the assembly into the ball.

Having the receiver turned off allows you to maneuver the steering servo around by hand, allowing you to more easily get the assembly in the ball.  Make sure the drive coupler goes in first!  I like to position the steering assembly so that it goes in first and the drive servo second.   Try not to force anything, it'll fit without having to stretch the opening of the hamster ball.

Step 2: Power up your transmitter and turn the power on on the main assembly.

Now that the assembly is inside the ball you can turn on power after powering up your receiver.  Be prepared for the steering servo to swing to center and the drive servo to start turning slightly if you don't have the trim for the throttle adjusted.

Step 3: Close up the ball and drive!

Now all that's left to do is put the cover on and drive.  I've found that some ball covers don't secure all that well (or the ball get's distorted a bit when you run into something at a reasonable speed, popping the cover off), so if the cover pops off during operation you might need to add a strip of scotch tape or two across the cover to keep it secured while driving.

Here's some video of the mechanics:

And here's some driving videos:

When you're done, just open the cover and switch off the power to the ball and power off your receiver.

If you want to pick up the laser cut parts or hardware for this project from me (or a fully assembled ball), check out my store!

Build Notes

The design posted here is about the 3rd minor revision of the design.  The first revision and had a belt driven design using a small 0.2" pitch belt and had the drive servo mounted up at an odd angle.  The only part that got built from the first revision is the servo horn attachment for the 0.2" belts, which I might reuse later:

0.2 inch pulley mounts for a hobby servo

Revision 2 is pretty close to the design I have now, but it didn't have captive nuts for the bearing brackets.  It also used flattened out 8 1oz. lead egg weights wired together with solid 22 gauge wire as the steering weight.  The washer design's a bit bigger, but a lot easier to assemble and actually weighs more and allows for some tweaking of the design.  Here's some pics of the second revision weight:

Lead steering weight

Lead steering weight

I'll probably stick with the lead free method in the future.

Also, you may have noticed the GWS S35/STD servo in a couple pics.  This servo is a relatively inexpensive off the shelf continuous rotation servo you can pick up so you don't have to modify a servo manually to get continuous rotation.  This servo has the torque to drive the hamster ball, but is just not nearly as fast (and thus not near as fun) as the modified TGY-S4505B servo I ended up using as the drive servo.

I also built some handy stands to set the balls in when not in use out of a couple pieces of cardboard:

They're simply  glued together with regular old Elmer's glue and keep the balls from rolling around (and off the workbench) when you do don't want them to.


Laser Cutting Sandply

Sunday, September 25th, 2011

burnt sandply

So I went to Home Depot several months ago to pick up some plywood for cutting on the laser decided to try out some sandply. It's cheaper than birch or oak, lighter, and seems to be less prone to warping, which is pretty important when laser cutting. Given that sandply is less dense than the bitch I had been cutting, I expected the laser to cut through it without issue. When I tried it out on the same settings I had been using for birch and I was not impressed.

Above you can see that some parts continued to burn after the laser cut through the wood (air asset doesn't seem to have an effect on this charring) and below you can see that the laser just barely failed to go all the way trough several parts at the same laser settings used for birch. I haven't tried to see if I can elevate the issues I was seeing, but I'd say that sandply is probably not a go to material for laser cutting functional wood parts.

Sandply that's not cut all the way through


Making Stamps with Lasers

Saturday, September 17th, 2011

The above image shows the first mounted stamp I made up with my laser cutter, which was created as a stand in for CCCKC's official hackerspace stamp for hackerspace passports (I can't wait to get mine own soon)!  It should be no surprise that I love to use laser cutters for making all kinds of stuff.  I thought I'd start posting some of the myriad of ways you can make stuff with a laser cutter/engraver and today I'm going to cover making stamps like this.

First off, you'll need access to a laser cutter that supports raster etching.  Almost all commercially available laser cutters will support this, and most will support a special stamp mode.  I'll be covering how to do stamps with Epilog Laser drivers, but Universal Laser and GCC laser cutter (I've seen them sold under the LaserPro and Pinnacle brand names) drivers also have stamp modes, I'm just not familiar with how they implement their stamp modes.  Unfortunately laser setups that have to be driven directly by G-code like the Lasersaur and some of the A4 size laser cutters out there probably won't be able to make stamps with the methods I'm outlining here.

First off, you'll need a few supplies.  First and foremost is laserable rubber, which is specifically designed with laser based stamp production in mind.  It's available from a number of sources online and comes in a couple varieties , one of which is low odor rubber which is what I've been using.  Next you'll need the other components of the specific type of stamp you'll be making, called the mount.  If you just want a simple, easy to mount and use stamp, you'll probably want to pick up a self inking stamp.  These come in several sizes, are pre-inked in most cases, and simply have an adhesive strip you place your cut out engraved rubber on and you're done.  Most also have an indexing strip you can stamp and insert after mounting your rubber. Here's an example I made up:

The second option for mounting stamps are "artistic" stamp mounts, like the kind used for crafts that you find at local hobby stores.  These consist of a wood block (or an acrylic block), a foam rubber cushion that forms a bond between the block and the rubber (or some foam rubber with a sticky coating or simply a sticky film if you're using an acrylic block), and the rubber stamp itself.  If you've got some wood scraps or acrylic to use, all you really need is some cushion, making this style the cheapest stamp mount you can make.  It also gives you the most freedom since you can make them almost any size or shape and the results can still look very professional.  Hand stamps are similar in construction to wood block artistic stamps but have a handle and often an index strip on the side, or you could just print the mount if you have or know someone with a 3D printer using this design.  Here's a picture of the 2"x2" blocks I used for the CCCKC stamp above:

Artiscic stamp blocksI coated one with polyurethane because I planned on etching it with the laser later and the polyurethane coating protects the wood from the byproducts of the etching without masking.  Here's a small scrap of cushion as well:

stamp cushion

The cushion has adhesive coating on both sides and is used to mount the stamp to the block and distribute pressure when stamping.  I picked up all my sample stamp supplies from JMP because they had all the supplies I wanted in one place, but they're not the cheapest source out there.

Now you'll need some artwork. Ideally you'll want a nice crisp high resolution black and white raster image or some vector artwork to work with.  The easiest way to get a nice crisp black and white image from raster artwork that's well defined (already high contrast) but a little blurry around the edges and/or not quite black and white is to:

  • Desaturate the image (either by converting its color space to grayscale or using the desaturate operation in your image editor of choice) to remove color.
  • Adjust the brightness/contrast of the image and turn the contrast all the way up.  This will eliminate any intermediate shades and leave you with just a black and white image.  You may need to adjust the brightness to get the desired effect.

Gimp can handle both of these operations easily.  Here's a quick example showing what I did to clean up the original artwork for this stamp and how adjusting the brightness effects the final output:

Steps to prepare raster artwork for making stamps
When done, remember to save in a non-lossy format like PNG of GIF to prevent the re-introduction of compression artifacts.

If your raster artwork is too low resolution you can try the bitmap tracing operations in your favorite vector graphics suite (both Inkscape and CorelDRAW have this functionality) and clean up the results a bit manually.  There are plenty of resources online if you need additional help cleaning up or creating artwork.

Once you've got artwork and your supplies you'll need to follow the recommendations of your particular laser manufacturer to set up your artwork and configure the laser. You can find Epilog's tutorial here. You only need a single outline for a single stamp to define the "fence", but if you're making multiple stamps the fence needs to encompass all the stamps (if you don't do this it looks like only the first stamp is rastered).  The entire area inside the fence will be rastered so don't spread stamps out too much or you might waist material.  Here's my artwork prepped for cutting in CorelDRAW:

CCCKC logo in CorelDRAW

On my 35 watt Epilog Mini-18 I used raster settings of 10% speed and 100% power for the CCCKC stamp.  Under advanced options, select "Stamp" for raster type, and I checked the mirror option under the stamp settings because I didn't mirror my artwork beforehand (see above pic).  I stuck with the recommended settings for the shoulder and widening options.

The driver is doing a few interesting things for you in the background:

  • Creating a negative of the raster image within the defined vector outline (which is why it's important to define one even if you're just going to cut it out manually)
  • Flipping the image horizontally (if you checked the mirror option)
  • Expanding the area that will be raised 0n the final stamp based on your widening selection
  • Ramping up and down laser power at the edges of the raised sections based on the shoulder profile you selected

All these operations can be easily done in photo editing software if you're laser cutter supports raster mode but doesn't have a stamp mode for some reason, but I've yet to encounter a cutter where this is the case.

Once the raster etching is done, take a look at the result but don't touch anything yet.  If you feel the etching is too light, just tweak the settings and run the job again.  The second pass will etch even deeper into the material, but will only work if you haven't moved the stamp material around.  The stamp will be coated in dust that you'll have to clean up later before placing your stamp (and you'll likely want to clean up the laser cutter a bit too after making some stamps).

Once you've reached a depth you find appropriate you'll need to cut out the stamp.  You can simply do this manually or do a vector cut with the laser.  This was my first stamp, so I opted to cut it out by hand and play with vector cutting settings later.   Recommended settings for vector cutting imply that you don't want to cut it at full power (this may indicate that higher power settings char the material). With my 35 Watt Epilog, a speed setting of 5%, power setting of 20%, and a frequency setting of 500Hz cut about 2/3 of the way through the sheet after a single pass of raster etching but cut all the way through after I did 2 raster passes on later stamps.  Higher power settings cut a bit deeper but did induce a little charring, so it looks like I'll have to try a few more settings combinations to dial it in.  Here's the CCCKC stamp before cutting it out from the sheet:

Stamp before being cut from sheet of rubber

Once you've cut out the rubber you need to cut out the cushion.  I just used an X-Acto knife but it cuts easily with scissors as well.  The description on the cushion order page indicated that PVC was used in the cushion that I ordered, so it would be a bad idea to cut on the laser because of its chlorine content.  There are a number of other options for cushion, but it's likely that they have similarly incompatible chemistry (the acrylic stamp mounting films I looked at seemed to contain vinyl, which is another no-no).  Since you won't likely be cutting the cushion out on the laser, you'll probably want to cut the stamp and cushion out at the same time (you may even want to adhere the stamp to the cushion before you start cutting).

Rubber stamp and cushionAll you have to do now is mark your block and assemble it.  I engraved the stamp into the wood block rather than making a sticker (as most commercial stamps I've see do) or stamping the top, which is kinda difficult to do at that point.  Here's a pick of the stamp totally assembled after stamping:

Mounted stamp

Next time around I think I'll make the etching of the stamp and the block a bit deeper, but the results of my first stamp making attempt seem to be pretty functional.  Maybe I'll experiment with some acrylic mounts next...


Building Boxes and Enclosures with Laser Cut ABS

Wednesday, September 7th, 2011

Above is a picture of a recent project I did for a client that wanted a custom enclosure for some experiments with mice. It's constructed from laser cut ABS sheets and held together with screws, but it doesn't use the now somewhat ubiquitous T-slot construction used in many laser cut enclosures.  Because ABS isn't extremely brittle like acrylic and doesn't have a grain or laminate layers like wood, you can simply screw it together without significantly effecting structural integrity if you do it right.

(Safety Note: This should go without saying, but if you're cutting ABS, properly handle the fumes! You need a properly sized carbon filter on your exhaust and you need to have adequate air flow. Additionally the parts should be left to outgas in a well ventilated area for at least 24 hours after cutting!)

I first used the method I'll be outlining here to construct a "dark box" add on for a piece of lab equipment.  It had to fit very snugly inside an existing box, not let light through, and not provide climbing holds for the mice under test.  I didn't want to end up gluing everything together (I'm glad I didn't, I had to modify the setup for an additional experiment later), and T-slot and bracket based attachment methods were not ideal.

First off, in my enclosure design I've added tabs to ease alignment of all the connecting parts.  If done correctly, tabs will prevent you from assembling your enclosure incorrectly and allow you to quickly align edges of parts you're screwing together.  Tabs also allow you to insert screws into both of the parts you're joining perpendicularly, which a regular butt joint wouldn't allow you to do.  I use 1/2 inch #4 flat head sheet metal screws for 1/4" ABS.  I drill a 3/32" pilot hole is drilled into the parts that will be joined.  Pilot holes are a must, as you can drive a screw in to ABS with a little work, but you'll see stress lines and bulging, if not outright splitting of the plastic if you don't use an appropriately sized pilot hole. I place the pilot holes at design time and cut them into the part so I have a nice guide when it comes time to drill.  Here's an example of a part with tabs and pilot holes in place:

To make sure I hit the correct depth, I add some tape to the bit to let me know I've drilled far enough into the piece.

I use right angle clamps to hold the parts I'm joining in place while drilling.

Here's a close up of the tabs and pilot holes after they've been drilled:

Next I countersink the holes and install the #4 screws:

You can prep and screw a side together relatively quickly with a little practice.  Once you've got a few sides on your enclosure, you can rely less on clamping parts together and simply hold down the panel you're installing with  one hand while drilling with the other (assuming you've added tabs to your parts so they align properly and stay in place).

Here's some pics of the finished product:

I've also used black oxide coated screws with this method to make the final enclosure look a little cleaner as well.  Overall I like the look of this method over T-slot construction for some projects since you don't have to oversize some parts to accommodate the tabs and screw holes and the joints seem a little sturdier as well.