Shapeoko and Pick and Place – Part 2

This is part 2 in the development of a pick-and-place machine for electronics assembly.  Part 1 is available here.

The new head

head2The new head is much more simplistic than the old version.  This version uses a stepper motor with a hollow shaft instead of a tube with a GT2 pulley on it.

In the CAD model to the left you can see the Shapeoko spindle mount plate in black.  The main mount for the head is shown in a semi-transparent grey with the stepper motor and mounts for two cameras.

At the bottom you can see an adapter that converts the stepper motor shaft into a tapered fitting for the pick and place tip.  The blue disk in the center is a magnet that holds the taper and head assembly.  This allows the machine to be able to adjust the tip depending on the part being placed.

head2photoHere you can see what everything looks like on the machine today:

We also mounted an upward going Z-axis limit switch that’s screwed in to the spindle mounting plate.  This will kill the power to the motor drivers if we accidentally command the machine to kill itself.

The brass fitting in the vacuum line allows the motor to turn the nozzle continuously without turning the plastic tubing going to the vacuum.

The new feeder

The new feeder swaps out the solenoid and pawl for a thin, pancake stepper motor.  The stepper motor advances the paper tape of parts with precision control.  This model also includes a small reel in front to collect the clear film that keeps the parts in there little holes.  This is driven by a small DC hobby motor, but we’ve also made it to where a second stepper motor could replace this DC motor if it doesn’t work in this design.


I just got the circuit boards for the control board in earlier this week, so I’ll make those up tomorrow.  But for now you can see a video about the construction and initial testing on the new feeder:


Shapeoko and Pick and Place – Part 1

The Project

This is the first in a series of posts about our journey adapting a Shapeoko 2 into a pick-and-place machine for surface mount electronic parts.

The skeleton

We started with the “mechanical kit” from  We also got their NEMA 17 stepper motors, stepper motor cable, GT2 belting, and GT2 pulleys.  With shipping this comes to about $440.

When the box arrived it was obvious that it was not treated well on its journey:


That hole there, that was the escape hatch that all of the stepper motors used.  After filing a lost articles claim with the shipper, I notified the folks at and they put replacement steppers in the mail that same day.  Hats off to the gang!
During assembly I broke a tap in the makerslide.  I was going to EDM it out, but the machine was being used to make money.  Also, I was a little concerned about damaging the threads that were already there, so I ended up dissolving the tap with some alum.  I got the idea from here.  The called it flocculant at the pool supply store.  I used the Baquacil product shown here.

I put the makerslide in a stand and then suspended it on a hot plate with an automatic magnetic stirrer.  You want to get the tap to where it has bubbles coming off of it.  Add alum until you can’t get any more to dissolve in the water.  It took several hours to dissolve to where the tap fell out.


At the end the slide was a little discolored where it was exposed to the alum, but the threads were undamaged.

I have a video on YouTube showing the bubbles and the steel turning into black dust particles:

The head

First PnP Head DesignThe first head on the Shapeoko worked pretty well.  It’s shown here to the left.  The vacuum tube comes in and connects to a tubing adapter, twist adapter, then another adapter that connects to a hollow aluminum tube.  This tube had a GT2 pulley on it.  The stepper motor connected to the left of the base had a GT2 belt that would turn the pulley on the vacuum tube and orient the picked up part along the A-axis.

The aluminum rod goes between two switches.  A wide washer on the aluminum rod can trigger the switches.  The height of the buttons on the switches is different, but close.  When the part gets placed the first button triggers.  The second button is just slightly higher and is used as a limit switch killing power to the Z-axis stepper driver if something bad happens.

There is also a webcam shown, a Logitech C920.

To the right you can see several, rather large countersunk holes.  These were sized to fit dispensing tubes for solder paste.

The CAD model probably makes it easier to see what’s going on.  In the center there’s a teal colored washer with a thick diameter.  This presses up on the switch buttons as the tip of the vacuum needle touches the circuit board.  The three plungers shown wouldn’t be used together.  The idea was just to have a hole to accommodate the various sizes of dispensers from multiple manufacturers.


Below is a wider angle shot of the setup.  At the bottom you can see the four stepper drivers that control each of the axes.  We did get this setup working with LinuxCNC and OpenPnP.  The stepper controllers were driven by the parallel port on the PC shown at the back-right of the table behind the Shapeoko.


Unfortunately we were not able to get the proprietary nvidia driver working with the real time kernel in our LinuxCNC distro and this was slowing down our vision processing.  So we started looking for a way to move away from LinuxCNC.  We also were using a solder-less breadboard for the electronics that are controlling our vacuum, blower, and the solenoids that direct the air and wanted to get away from needing the breadboard or building a circuit board to replace it.

We considered getting a GRBL controller since a lot of folks are using this with OpenPnP but decided to get a Smoothieboard instead.  The big points that made us go the smoothie route were:

  1. One board that can control all of our stepper motors
  2. The same board can control our vacuum, blower, and fans (onboard mosfets with screw terminals)

So, we tore apart the PnP that we spent so much time wiring together to come up with iteration 2.

What about part feeders?

The last bit of parts we need for our next version of our feeder are scheduled to arrive with FedEx on Thursday, so we’re really excited about that.  However, for this first version of the PnP we tried to use a solenoid based solution for our feeders:


The control board at the top-left drives a hobby, DC motor that was used to pull up the tape on the reel.  It also controlled the voltage to the solenoid.  The solenoid was connected to a pawl that grabbed the teeth on the ratchet behind the sprocket that fed the tape.  A second ratchet is shown here in this picture on top of the sprocket.

This feeder was functional, but the solenoid was not strong enough to consistently advance the reel.  Adding in gearing would have made this solution too slow for production use.  Larger solenoids would not have fit in the narrow spacing that we wanted to keep for the feeder.  It was cool to watch though with the pawl acting as a hand grabbing and pulling the ratchet.  Another downside was that the solenoid doesn’t allow for precision control of how far the tape gets advanced each time.

The CAD rendering below shows the assembly a little better.  The pawl (purple in the CAD) is basically a hook that gets stuck in the angled teeth of the ratchet shown in green.  When the solenoid fires it pulls the ratchet and the sprocket that moves the tape forward.feeder

Stay tuned and I’ll bring you up to date on our second version of the head and feeders.

Part 2 of this series is available here.

Sourcing electronic parts from China: life after Digi-Key and Mouser

Most of the parts that go into our products we buy from either Digi-Key our Mouser.  We always check Arrow because often their prices are way better than anyone else.  For some industrial/electromechanical things we go to Allied.  We also search with Octopart to find components.

However, when things start moving into production it’s really hard to ignore the prices on parts directly from Chinese distributors.  For example, we’ve found that connectors from 4Ucon are sometime 1/10th to 1/12th the cost of similar connectors from Samtec.  We’ve also had luck getting things like pogo pins from UXcell.

The websites are not as professional as those from Digi-Key and Mouser, but that’s easy enough to get over.  And while things like integrated circuits can be spoofed, for things like connectors the risk is pretty low.

The minimum order quantity and lead time are things you don’t want to overlook, but with DHL shipping we usually get the parts here in about 2 days.

So what great sites have you found for getting parts?

Photographing electronics

I will admit that I’m not a seasoned photographer, so take everything I say with a grain of salt.  It could be all wrong…

When we started the web site, none of us were very good photographers.  We started out using a Canon Ti, but this was only because it was what we had around the shop.  We thought anything SLR would be good enough to take product shots, but it turns out that there is more than that to photography.  We’ve learned a lot in a little amount of time…

These days we have a Canon T3i, which was recently discontinued in favor of the new Canon T5.  I can’t speak directly to the T5, so what follows is about the T3i.  Compared to the original Ti, the T3i is so much more productive.  The Ti did not allow you to preview shots in the LCD screen before snapping the picture.  With the T3i you can see the image in the LCD screen, go 10x on the zoom, and know that your shot is going to be in focus.  You can also do “auto-bracketing”, which tells the camera to take multiple shots with slightly different settings so that you’re more likely to get one with the right lighting.

Like most folks we thought that megapixel count was everything when we started.  We were way off.  For our first lens we got a Canon 50mm prime lens, and it is razor sharp.  There is also a cheaper alternative that you might want to consider as well.  We never use the lens that came with the camera anymore.  I highly recommend this lens because you’re pretty much guaranteed excellent shots with it.  I have taken picture of my kids with it and you can see detailed reflections in their eyes when you zoom in.  The only down side is that it’s not a zoom lens, so you will have to walk closer or farther away from your subject to get everything in frame.  The quality is unbelievable and you’ll never use the lens that came with the camera again (maybe you’ll be smart and just get the camera body and a good separate lens).

Once you have the camera and the right lens, the next trick is learning how to take the right shots.  For crisp pictures you need a tripod and to lock the camera in ISO 100.  Just push the ISO button and select “100” instead of “auto”.  This will help eliminate any graininess from your shots and let you zoom in and still have detail.  Then, you’ll want to put your camera in “aperture priority” mode.  This is “Av” on your mode selection dial.  With such a low ISO setting the camera will have to hold the shutter open for a few seconds, typically.  This is why you need the tripod: bumps = blurs.

Now you’re almost ready.  Most of the time you’ll want to have all of your product in focus at the same time.  To do this, you’ll have to use a large f-stop.  The 50mm prime lens can do f/1.2 but this will put a only a tiny section of the shot in focus with other sections are left out of focus: a photography technique called bokeh.  This is cool if you want to bring attention to a specific section of your shot, but probably not the best choice for a product photo.  So turn the dial next to the shutter button to change the f-stop to f/8 or even more.  f/22 will put a lot of the shot in focus, but as you go higher in f value the shutter will have to stay open even longer.  Again, a tripod is a must.  There is no harm in going as high as you can with the f-stop.

Put the camera on a 2 second timer (or get a kit with a wireless shutter control) to make sure that you don’t accidentally budge the camera while the shutter is open.  Then, take your shot.  If you want something a little brighter you can adjust the exposure by holding the Av button down while turning the dial next to the shutter button.  This is similar to adding “fill light” in tools like Google Picasa.  This will extend the time the shutter has to stay open, too.

With these techniques I think you’ll be able to take some great product shots, but sometimes you will want to be able to take extreme closeups or get shots of small items.  You can get a macro lens to do this, or you could use inexpensive extension tubes.  These just snap in between the camera and the lens to put the lens a little farther away.  The more space between the lens and the camera, the more magnified your shot will be.

Here’s an example of a shot of a penny with all three extension tubes used at the same time.  Click on these pics to see them close up!


penny close

The first shot shows how wide the field of view is.  WordPress has a 2MB limit on the files I can add in, so I added a second shot.  The second shot shows a cropped down portion of the full image but maintains the full detail of the original shot.

Of course there are some downsides to using extension tubes instead of a real macro lens.  I don’t have a real macro lens (though if you buy me one, I’ll take real good care of it!) but my understanding is that the macro lens will allow you to focus from close up all the way to infinity.  With extension tubes there is only a small band where the shot will be in focus, so you’ll have to adjust the distance from your camera to your subject to get within that “band of focus”

Anyhow, I will say that we learned a lot about technique going through this process but I think our pictures have really improved and it has helped to show off the attention to detail we have for our products.

Surface mount electronics at home

Most of the coolest electronics parts are only available in surface mount (SMT) packages these days.  What is a modern maker to do?

I guess some folks start out with breakout boards and try to keep using their breadboards with SMT parts.  At some point, however, you’ll be ready for the next step.  And that involves designing your own circuit board and building your project.

When I was in college I used EAGLE for my electronics projects.  Even when I worked at Boeing we used EAGLE in our group, even though it wasn’t Boeing’s preferred package.  However, now I use KiCad and while it took a little getting used to, I love it.  Some of the features are way better than EAGLE and KiCad is free so how cool is that?

After your design is done you will want to have your boards fabricated, and I would recommend OSHPark.  Perfect…purple…prompt.  The cost is excellent for the quality and the delivery times keep getting shorter.  Awesome!

With boards in hand it’s time to start making!  We cut our own stencils in-house with a Silhouette Cameo.  With the Cameo and the gerber2graphtec code on GitHub you’ll be able to make your own stencils in no time.  We use 4mil Mylar as our standard for stencils.

The solder paste can be a little pricy, but if you don’t need much you can get a small tube of solder paste from Digi-Key.  Squeeze out a blob, smear with an old hotel key-card, and you’re ready to lay those tiny parts down.  To move the parts around by hand we use a set of vacuum tweezers.  The tips for the SMT parts are a bit pricy, so we just took the tip off of a mechanical pencil and use it as a tip.  Also, I highly recommend you watch the following for some awesome assembly tips:

After the parts are down, it’s time to put them in a convection toaster oven and get the paste to reflow.  Try to follow the reflow profile provided by the solder paste manufacturer.  You can monitor the temperature with a non-contact thermometer or with an Arduino and one of our RTD shields.

In minutes you’ll have your board made!  With just a few readily available tools, which really aren’t too expensive, you too can make professional circuit boards at home!

If you do decide to go this route, I would recommend getting a SMT hot air rework station as well.  Some of those SMD parts are expensive and if you need to do any rework, the hot air station will quickly pay for itself.  We use the Kendal rework station linked to above and it works great.  We don’t make much use of the soldering iron though so you might want to look for a station without the attached iron.

So?  What are you waiting for?  Go make something with surface mount parts!

Learning to solder electronics old-school style and PCB cleaning

Building electronics is awesome!  A big part of the building process involves soldering.  Most of the work that we do now uses surface mount components, we try to use surface mount parts everywhere we can, but the some components are still through hole parts.

Yesterday I watched this awesome, retro video series by Pace on proper soldering techniques.  If you’re starting out in electronics it’s definitely worth a watch.

These days when I have to hand solder I use the water soluble, lead-free variety from American Iron and Metal (AIM).  I usually use the 0.020″ diameter version but I also have a spool of the 0.032″ version for (slightly) larger work.

Some folks prefer and recommend no-clean solder, but I don’t like it because I find it very hard to clean the residues off of the circuit boards and even though you don’t technically “have to” clean the residues off of your circuit boards, who wants tacky red-brown goo all over their latest creation???  I went through a lot of laboratory grade isopropyl alcohol (IPA) back when we were mainly using no-clean solders.  I’d clean it with the IPA, douse it with deionized water, then shoot it with compressed air.  I’d have to go through the cycle several times and the boards usually ended up looking chalky or still be sticky after cleaning.

Yes, you must clean off the water soluble flux left behind from the AIM solder mentioned above, but the great thing is that it’s water soluble: it just comes off with water.  To aid in the process we have an ultrasonic cleaner that we use to clean our boards before we quality test them.  The heater built into the cleaner aids in dissolving the residues.  It’s not perfect though.  We still end up using an old toothbrush at the end to make sure everything got cleaned.  Some folks warn about cleaning electronics with ultrasonics, so read about it before you try it and decide for yourself.  Our technique involves leaving the boards in the ultrasonic bath with just the heater turned on (no ultrasonics) for about an hour.  Then, we’ll rub them with the toothbrush and run through an ultrasonic cycle.  I should also mention that we use type II deionized water in the cleaner.

The smell of the AIM solder is a little funkier than other solders, but I think water soluble is definitely the way to go.  And my iron of choice is the Weller WES51.

RTD Sensors and Thermal Mass

Our RTD shield for Arduino is super precise.  Almost too much so.

Some of our customers have asked questions and had concerns when the RTD shield they purchased from us shows +/- 2 degree fluctuations when exposed to ambient air.  It seems that people have been conditioned with slow moving temperature sensors that take ages to update.

If you think about it though, it should really not come as a surprise that there actually are large temperature gradients everywhere.  For example, when you exhale the temperature of your breath is (often) at a much different temperature than the ambient temperature.  This heat doesn’t instantly disappear into the environment.  Breath is just one example though: body heat, air conditioning, fans, clouds, and so on all affect the temperature.  They all radiate out and make the temperature change over large distances. These temperature differentials are actually physically present all around us.

However, folks usually see these swings as errors or noise.  They call in to question the performance of the shield and ask if other settings could make the results more “accurate”.  The first thing to do is to prove that the electronics on the shield are über-stable.  We don’t want our customers to just take our word for it.  Luckily, the shield can be easily validated by using a fixed resistor in place of an RTD sensor.  Wire one end of the resistor to the + terminal(s) and the other end of the resistor to the terminal(s) and then take readings with the shield.  The RTD is just a temperature controlled resistor.  Using a fixed resistor eliminates almost all of the temperature dependance (sure, most resistors have a little thermal dependance: like 200ppm, but this is good enough to validate the shield).  A Pt-100 RTD sensor measures 100-ohms at 0 degrees Celsius.  So using a fixed resistor around this value or a little more is a good choice as this is the most popular type of RTD sensor.  Using this setup our customers are able to validate the precision of the shield as reported here.  In fact, this approach is how we test the shields after production.

Some applications require the ability to quickly measure temperature changes.  However, many don’t, and I typically give the following list of suggestions:

  • Average the data coming from the RTD shield
  • Increase the thermal mass of the RTD sensor
  • Add a small capacitor to the screw terminals of the RTD shield

Averaging the RTD readings is pretty self-explanatory.  Collect a bunch of data and compute the mean of the data, or even better do something like what’s in the smoothing example to quickly find the average of a circular buffer of data.

Another approach is to increase the system’s thermal mass.  The idea here is analogous to inertia.  Something with a lot of thermal mass doesn’t change temperature easily.  Something with little thermal mass changes temperature very easily.  Ambient air has very little thermal mass: you can blow on the RTD sensor and see the change.  If you take an RTD sensor and immerse it in a liquid, then the liquid will add thermal mass and make it harder to change the temperature readings: if you blow at the liquid it probably won’t affect the RTD readings.  You could also shield the sensor from stray breezes by using a box or use thermal insulation around your sensor.

Adding a little capacitance is effectively the hardware approach to taking an average.  The capacitor makes it a little more difficult for the RTD sensor to change the signals on the inputs of the RTD shield’s analog-to-digital converter.  I would suppose that the capacitor to use could be calculated by determining the desired RC time constant, but I’ve never actually used this approach.  It’s pretty easy to just average values.

So maybe it’s time to trash all of those slow moving thermometers you have and buy one of our awesome RTD shields?

First project with the BeagleBone Black

The Old Milling Machine


The next product we’re going to launch is a stepper motor controller.  We are going to use a few of them on a 3-axis table-top gantry mill that I built as part of the machine shop class at Washington University in St Louis way back in, gosh 2003 was it?  All of the other kids were making stainless-steel shot glasses, and I was making parts for a CNC mill…

The mill is pretty much done mechanically, but I never added the electronics to the system: the stepper motors yes, but nothing beyond the motors.  I’m going to try to run Machinekit as a way to get LinuxCNC running on the BeagleBone Black.  I also got a Logitech C920 and hope to play with OpenCV to add machine vision to the LinuxCNC system: a big task, but what fun!

First Steps

The BeagleBone Black (BBB) looks really cool in terms of specs, but I needed a bunch of accessories to really get started.  Here’s what I ended up getting:

I tried to connect the 10 port hub to the BBB and then the Logitech

mouse and keyboard receiver to the 10 port hub, but the BBB didn’t see the mouse or keyboard when I did this.  And yes, I did plug them in before turning the power on.  The mouse and keyboard did work when plugged in directly to the BBB.  So I tried another USB hub that I got from DigiKey and voilà, it worked.

I went with the 10 port hub because it said it could supply 3 amps, wow!  The DigiKey USB hub has no power supplied to the peripherals, so I’m hoping that the power from the BBB’s 5V barrel jack is enough to keep the camera going without issue.  I suppose I could cut the red wire on the 10 port hub as described here, but I’m only going to go that route if the C920 has issues.

It was cool to see the BBB boot up as I haven’t had time or a project to use it on since I bought it almost a year ago.


If you have an interest in this project, you might want to check out the following video demonstrating the BBB and OpenCV with the C920: