Where the quest for engineering perfection violently collides with the need to finish before the sun runs out of fuel

26th July 2013


I’ve been working like crazy to meet my self-imposed Friday deadline for completion of the auto-leveling lightbar.  Actually, I told that engineer that I mentioned previously that I’d have something to show him on Friday (today).  So now my fake-deadline is a real deadline, 4 hours to go.


I’ve made a tremendous amount of progress.  Will it be finished in time?  Keep checking-in to find out.  I’ve taken a lot of pictures and video along the way, and there’s good information to share, but it’s going to take me a couple of days to get everything posted.  My video here is a blatant rip-off of the one that I mentioned previously, but I’ve tried to route the wires cleanly and show everything in a way that will hopefully make it a little more clear.  Different Arduino’s often have their pins in different places, so be careful about counting pins and assuming that it will match yours.  The servo is pulsing because it is drawing its power from the Arduino and it’s drawing too much.  Powering it from a separate power supply makes that issue go away, but I wanted to show the wiring in its simplest possible form.  In my previous post, I listed the wiring connections and program.

26th July 2013


The flashlights were dismantled to get to their LED arrays.  The trick is to only snip once, then peel the rim away with a series of movements can-opener style.  The entire rim should come off in one jagged piece.  One of the flashlights actually had a glass lens in it, the other *identical* flashlight had a plastic Lens.  Here’s a picture of the contents of the flashlight.  The part that I’m calling the “Retainer” also ensures contact between the circuit board on the back of the LED array and the body of the flashlight.timageThe task that I was most concerned about was programming the Arduino to track the gyro.  When I found a YouTube video that showed it being done, I thought I had it made.  Even the sketch (Arduino-speak for program) was posted.  It will be running in minutes!    or maybe not…

 My first clue that it wasn’t going to be quite that easy were all of the comments under the video saying things like “I can’t get it to work”, or “Yeah, I tried that and it still won’t work.  The author had patched his code several times, but it didn’t seem to help.  I imported the libraries that he said were needed, but I was still getting these weird “Function not defined” errors.  Every time I made one error go away, another cropped up.  It was whack-a-mole with Arduino libraries.  Around 1am I decided to sleep on it.  The next morning, 5 minutes after waking up, I thought “I wonder why the ‘Servo’ library isn’t loaded, seems like it might be handy for controlling servos…”  Sure enough, it instantly worked.  That video has been up for over 3 months and “fixed” by the author several times and it’s still not quite right.  In the world of open-source time savings or losses scale tremendously.  This video has over a thousand hits, even if only 200 people tried to reproduce it and wasted an hour figuring it out (took me two), that’s 200 hours of labor down the drain.  Even worse, how many people just gave up?  The wiring connections were also not listed, and are not clearly visible in the video.  I found conflicting information from various sources.  Here are the correct connections:


Pins XDA, XCL, ADO and INT on the MPU6050 are not used. The servo’s signal wire is connected to Pin9, and the +5v and GND are connected to the same on the UNO. 

Here’s the sketch that is referenced in that other video.


Here is the working sketch with the missing library added:

#include <Servo.h>

#include <Wire.h>

#include <I2Cdev.h>

#include <MPU6050.h>

MPU6050 mpu;

int16_t ax, ay, az;

int16_t gx, gy, gz;

Servo myservo;

int val;

int prevVal;

void setup() 




    Serial.println(“Initialize MPU”);


    Serial.println(mpu.testConnection() ? “Connected” : “Connection failed”);



void loop() 


    mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

    val = map(ay, -17000, 17000, 0, 179);

    if (val != prevVal)



        prevVal = val;




24th July 2013


Unsticking Stickers and finding replacement lights

I removed the paper decals from the truck using one of my favorite tricks.  First, you slowly and gently peel the sticker off, starting from a corner.  If it starts to tear away from the paper backing, move to a different corner and continue.  Once you’ve removed as much as you can, apply some WD40 to the remainder.  I drip it on using a small bottle with a syringe tip (intended for refilling inkjet cartridges).  It doesn’t take much, let it sit for 5 minutes and wick through the label.  Then using a combination of your fingernail and paper-towels, scrape and wipe away the glue and paper.  Once the labels are gone, you still have WD40 to contend with.  No problem, Windex takes it right off.  The process is very similar to how Australia used Cane Toads to eliminate the Cane Beetle and then got rid of the Cane Toads with….  Actually, I forget how they got rid of the Cane Toads, but I’m sure that it worked out ok.

Harbor Freight has been giving away these cheap little LED flashlights for a couple of years now.  They are incredibly bright and I’ve got at least a dozen of them.  I’ve decided that they would make excellent functional lights for our self-leveling light-bar.  I used snips to remove the old fake lights from the truck.  Normally I would use a razor saw to get a smoother cut, but the plastic on this truck is flimsy and would likely crack if subjected to sawing.  Snips work great in these situations, and I will be able to smooth the rollbar using those drum-sanding wheels on my Dremel.  Here’s a picture.image

Tagged: Flashlightrollbararduinolightbarwd40stickerremoveremovalsnipsservogyro

23rd July 2013


Auto-Leveling Lightbar

Last week I had an interesting discussion with an engineer that I know.  He posed the question “How would you design an automatically-leveling lightbar for an offroad vehicle?”  For those who aren’t familiar with them, light bars are frequently mounted on Jeeps and other burly vehicles, usually on the front grill or over the cab.  I answered that I’d probably use an Arduino to control a servo system that keeps the lights pointed correctly despite the vehicle’s changing pitch angle.  A low-cost solid-state gyro mounted to the vehicle would provide the necessary position feedback.  Last night, while looking at my long-neglected Arduino collecting dust on my desk, I decided to see if I could make it work.  To make it interesting, I’ve decided to see if I could have it finished by this Friday (Today is Tuesday).  I installed the Arduino software on my laptop and with my Arduino gleefully blinking at me (running various blinking LED tutorials), I started digging around online to see what was available to interface a gyro.  I was pleased to see that Arduino has a module to do exactly what I want, it’s the GY-521 MPU-6050 3-axis gyroscope accelerometer.  Even better, it’s only $10 and I can get it overnight using Amazon Prime for $4.  I also ordered a cheap sub-micro servo since all of my servos are full-size.

This morning I headed to my local Walmart to check out the RC car selection.


 I figured that a pickup truck would be best since the payload could sit in the bed allowing easy access.  I picked the biggest one that they had to give myself a little more room for mounting everything.  Here’s the truck, now I just have to wait for my gyro & servo delivery to get here.

Tagged: sevoarduinoRCgyrogyroscopegy-521mpu-6050lightbaroffroad

18th July 2013


ATC Done!!*  Actually, it’s been done for 3wks, don’t tell anyone.

It’s been 110F in my shop which has sapped my will to blog.  After spending just 15 or 20 minutes in that heat, I want to collapse in a sweaty heap rather than document my efforts.  I have been working on many things and taking pictures as I go, so I’ll try to get caught up in the next few weeks.  The final steps on the ATC were wiring & adjusting the feedback sensors, building & installing the mount for the spindle orient assembly, and writing a macro to control the changer.  The macro was the part that I dreaded the most, but it wasn’t bad.  It probably took me a day and a half to look over a bunch of Mach3 macros to learn the syntax and put something together.  Some Mach3 functions can be called with more than one command and some have become obsolete over the years, so there was a little more trial and error than I expected, but the final script is short and simple.  Everything works based on feedback rather than timing.  Each step in the process waits for the sensor from the previous step to signal that it has moved to the expected position before starting its step.  Here’s the video of the whole thing working under computer control.  In the next few days I’ll fill in the blanks on a lot of what has gone into this.

12th June 2013

Post with 1 note

Dyeing Shapeways Plastics

I’ve been obsessively refreshing the UPS package tracker to see if it was actually going to take 6 days to get a small box from New York to Arizona.

It did.

Apparently Shapeways has negotiated a level of UPS service that takes longer for domestic shipping than some of my mail shipments from Shengzhou, China.  Impressive.

The parts finally got here yesterday afternoon and they look great.  These are the mounts for the reed switches that are going to monitor the positions of my air cylinders.  I had designed the slot for the sensors to be .015” oversize, but the sensors were a fairly firm press-fit to get into place.  They displaced a bit of partially fused powder in the process.  If removed and re-installed, the fit was a lot easier, but still not the loose fit that would be expected considering that loose tolerance.  They were a not-unpleasant parchment color, pretty similar to “natural” (not white) nylon, but a shade or two darker, almost “toasted”.  Since the rendering that I posted earlier showed them in red and it looked nice, I decided to try dying them red.  I picked up some “scarlet” Rit dye at my local Hobby Lobby.

I mixed about one cup of water and 1/2 cup of vinegar in an old pickle jar.  I added dye powder until the mixture was very dark, almost black, then I dropped in my parts.  I put in all six of the “Elasto Plastic” reed switch mounts as well as a “White Strong Flexible” Arduino Lego mount that I sell in my Shapeways store:


The water was room-temperature and after a few minutes, none of the parts had picked up more than a slight pink tint.  I moved the pickle jar to the microwave and nuked it for 99 seconds which was probably a little too long since it started to boil slightly.  When I removed the jar, the parts had already darkened considerably, I removed them from the dye a minute or two later.  The Arduino mount picked up the “right” amount of color, although the shade wasn’t what I was hoping for.  It’s darker than it appears in the photo, the flash is washing it out.  The reed switch mounts came out much too dark, like burgundy.  I rinsed them all in cold water, then set them outside in a 110deg cool breeze to dry.


Here’s a picture of the Reed Switches installed in the mounts.


And here’s the final product installed on the machine.  You can see from the LED indicator on the sensor that the switch is active.  This means that the piston (hidden inside the cylinder) is at its farthest right position (under the sensor).


9th June 2013


In Denial about the metric system

Sometimes when people don’t like something, they pretend that it doesn’t exist, occasionally they delude themselves to the point of insanity.  The leader of a certain Middle Eastern country who claims that there is not 1 gay person among their 75,000,000 people is one example, Port Plastics claiming that they don’t sell plastic in metric thicknesses is another.
I called them a while ago looking for 5mm acrylic, I was told that they only carry inch sizes, so I’d have to choose between 3/16” or 1/4” material.  I chose 3/16” since it should only be .009” under what I wanted.  When I picked it up and measured it, it was actually .177” (4.5mm) rather than .188” (3/16”), it even had a big sticker on it that said 4.5mm!  When I pointed it out to the helpful employee, she said that she had never noticed before, despite working there for YEARS!  All plastic suppliers do this, of the five local distributors that I called, all five claimed to exclusively carry inch-thicknesses.  One even went so far as to tell me that they stocked 1/4” material in two sizes, .236” (6mm) and .216” (5.5mm) but that neither was metric.  Home Depot does the same, the clerks claim that they only sell fractional inch sizes, but their luan material which is marked as 1/4” is actually .204” (5.2mm) and rings up as 5.2mm at the register.  Crazy, right?
I was reminded of this as I modified the plumbing for my air cylinders.  Everything is connected with 1/8” air line, this is a trick that I learned from my friend Dave DeCaussin (founder of FADAL).  By running small air lines, you ensure that your air cylinders don’t actuate too violently.  Regulators and restrictors are available to accomplish the same thing, but they cost money and add complexity.  Simply running smaller lines is essentially free.  Actually, it’s better than free because it’s much cheaper too.  Anyway, I’m happy with the speeds of all of my air cylinders except one.  The cylinder for the power drawbar has a very large diameter so it’s very slow to fill.  Not only is it slow, but it slows you down twice, both when engaging and disengaging.  By switching the air line from 1/8” to 5/32” the airflow doubles, speeding things up considerably.  All of the ports on my manifold take 1/8” tubing, so I had the bright idea of double up two of them with T-fittings to increase the flow.  It worked great, but required quite a few air fittings.  The valves are made by SMC and the catalog shows that the individual ports on the manifold itself are replaceable.  Standard sizes are 1/8”, 4mm and 6mm.  As soon as I saw the mixed units, my spidey senses should have started tingling, but they didn’t.  The fact that no air fittings are sold to bridge between metric and inch tubing had dulled my senses.  They wanted me to believe that each existed in a separate universe, and I DID believe it.  A few days ago I spotted something that referred to an air line as 3.2mm~1/8”?!  Sure enough, my calculator confirms that 1/8” = 3.175mm or 3.2mm.  5/32” = 3.969mm or 4mm.  So, once again, they’re lying.  It wouldn’t be a problem if they referred to 4mm line as 4mm~5/32”, but they don’t, they pretend that two completely independent and non-compatible systems exist.  How else can you explain an SMC manifold that has 1/8”, 4mm and 6mm ports as the only options?  Once I figured this out, I realized that I could replace one pair of ports on my manifold with 4mm (5/32”) ports and eliminate 4 pieces of tubing, 2 T-fittings and 2 tube reducers, plus free up one solenoid for future use.  All-in-all I went from 12 joints to 2 eliminating 10 potential sources of leakage.
And so, in the same way that I feed my 4yr old pastrami and tell him that it’s Stegosaurus to make it more palatable to him, distributors lie to customers and employees alike to help the metric nutrients go down easier.

Tagged: denfordcncsmcpneumaticair fittingtubingatcautomatic tool changermetricinchfittings

31st May 2013


Rapid Prototyping Some Sexy Reed Switch Mounts

The air cylinders each have magnets embedded in the pistons so that their positions can be sensed externally and the toolchanger can behave accordingly.  This prevents an air cylinder from activating before the previous one has done its thing.  The air cylinders are made by Bimba and are very nice, but I’ve got to say that I’m not very impressed with their cylinder-mounted sensors.  They are large and clunky, expensive and massively overbuilt.  Here’s a picture of two of the sensors on my VMC8 mill, they’re almost as big as the air cylinder that they’re attached to.  Also notice the steel strap that attaches them to the cylinder.  It could probably hold 50 pounds, the sensors, clunky as they are, weigh ounces.  These sensors cost $80/ea plus shipping from McMaster, my machine is going to need (6), so we’d be looking at $480 plus shipping just for the sensors.  Not going to happen.

As much as I dislike those sensors, Bimba makes another style that is intended exclusively for their extruded-body cylinders and it’s very elegant.  They’re available on eBay direct from Bimba for only $7 delivered, they have built-in LED’s so you can see if they are active or not and they’re very small and light.  Here’s a picture of one installed on a very small air cylinder that I’m using for my spindle orientation.  It’s the black thing in the picture that says “Bimba” and it’s about an inch long.imageYesterday I got an email from Shapeways announcing a new flexible rubber-like material called “Elasto Plastic”.  I quickly designed a mount that can attach this style of sensor to a round-bodied air cylinder using two aircraft ties to hold it in place.  According to Shapeways, this new material is “grippy” so it should stay in-place just fine especially since there’s no load on it.  I rendered it in red so that it shows up, but the real ones will be an off-white.  There are a few features that I’ll point out, the center section is cut-away so that the LED on the sensor itself will be visible.  The sides are sharply truncated so that the aircraft ties can be easily snipped without scratching the cylinder if they ever need to be removed or re-positioned.  There is a hole at the front so that the setscrew that is part of the sensor can be used to “lock” it into the mount longitudinally.  This style of mount could be produced commercially for pennies, even having them rapid-prototyped is going to cost me less than $30 delivered for the 6 that I need.  Add that to the $42 for the sensors and I’m in business for $72 total.  Besides saving $408 compared to Bimba’s recommended sensor, these look better, are much smaller, and have LED feedback.  Assuming that they work as expected I’ll be in good shape.  Incidentally, when ordering multiples of something from Shapeways you should always combine multiple items into one assembly.  There is typically a per-part setup fee, in this material it’s $1.95.  If I ordered one part 6 times I’d be paying $12 just in setup fees.  Combine them into an assembly and you only pay the fee once.  I got an email from Shapeways this morning confirming that my parts are already in production.  Less than 24 hours between Shapeways announcing a new material, me designing a part to take advantage of its unique properties and the part going into production.  I love living in the future.imageI didn’t draw the aircraft ties, you’ll just have to use your imagination until the real parts arrive in about two weeks.

30th May 2013


The automatic tool changer and power drawbar are now complete.  I’ve mounted the air-valves and I’m manually running the machine through a complete toolchange cycle.  I still need to mount some feedback switches and do some programming so that it will run under computer control.

28th May 2013


Picture Frame, Sacrificial Base or Through Holes?

Deciding how you are going to hold your work for CNC machining is one of the most important steps in the whole process, probably THE most important step.  When machining on a manual mill, you can remove the part from the vise, change the orientation at-will, even change your mind about machining strategies mid-job.  Not so on the CNC, you’ll want to have thought things through ahead of time so that you waste the minimum amount of material and can finish the part in the fewest setups.  If you change your mind about the fixturing, it’s likely that your toolpaths will need to be changed too, so it pays to think about it in-advance.  Despite the importance of fixturing, it’s one of those topics that seems to have little information published about it.  Most of my jobs are very short runs, I’m making one or very few of something, for that reason I’m usually working with the milling vise.  If I were making 100 of something, custom fixturing would make more sense, but I’m not and so I don’t.  The three basic methods:

The Picture Frame:

You start with material that is the right thickness, or a little thicker.  The material is larger in length and width than the part being machined.  Once the part is profiled, it can be removed leaving behind an oversize ring of material still in the vise.

Sacrificial Base.:

You start with material that is pretty close to being the correct length and width, but is thicker by about 1/8”.  You can profile the whole part, then flip it upside down and shave off the back.

Through holes:

You start with a material which can be very close to final dimensions (but doesn’t need to be).  The piece has holes through it which allow it to be bolted to a mount beneath which is held in the vise.  The mount can be sacrificial or not.  The holes that are being used for mounting can be integral to the part, or they could have been added purely for the sake or fixturing.

In the next installments we’ll explore each of these methods in a lot more detail.  Look at the prop-rod in the entries below, which fixturing method would you use?  How large of a difference in cutting time and material waste would you expect to see between the different methods?