Screw Sorting Machine

54,594

196

35

About: After a degree in micro-engineering in Switzerland, I moved to Russia to discover new landscapes

One day in the lab (FabLab Moscow), I saw my colleague busy sorting a full box of screws, nuts, rings and other hardware. Stopping next to him, I watched for a second and said: "It would be a perfect job for a machine." After a quick look on google I saw that different ingenious mechanical systems already existed but they couldn't solve our problem because in our box is a broad variety of parts. Doing something purely mechanical would be quite complicate. The other good reason to go to a more "robotic" system was because this would require all the technical fields I love: machine vision, robotic arms and electromechanical actuators!

This machine picks the screws and place them in different boxes. It consists in a robotic arm which handles an electromagnet, a translucent worktable above lights and a camera on the top. After spreading some screws and nuts on the worktable, the lights are turned on and a picture is taken. An algorithm detects the part shapes and returns their positions. Finally the arm with the electromagnet places the parts one by one in the desired boxes.

This project is still in development but now I obtain decent results that I want to share with you.

Step 1: Tools and Material

Tools

  • Laser cutter
  • Angle grinder
  • Hacksaw
  • Screwdriver
  • Clamps (the more the better)
  • Hot glue gun

Material

  • Plywood 3mm (1 m2)
  • Plywood 6mm (300 x 200 mm)
  • White translucent plastic 4mm (500 x 250 mm)
  • Computer (I am trying to move to raspberry pi)
  • Webcam (Logitech HD T20p, anyone should work)
  • Arduino with 4 PWM output / analogWrite (three servos and the electromagnet coil) (I use the ProTrinket 5V)
  • Prototyping board
  • Electronic wire (2m)
  • Switching transistor (any transistor that can drive a 2W coil) (I have S8050)
  • Diode (Schottky is better)
  • 2 resistors (100Ω, 330Ω)
  • Power supply 5V, 2A
  • Servo micro (width 13 length 29 mm)
  • 2 servos standard (width 20 length 38 mm)
  • Wood glue
  • 4 metallic corner with screws (optional)
  • Wooden rod (30 x 20 x 2400)
  • Hot glue
  • Enamelled copper wire (0.2, 0.3 mm diameter, 5m)(old transformer?)
  • Soft iron (16 x 25 x4 mm)
  • 3 light bulbs with socket
  • Connector strip (230V, 6 elements)
  • Electric wire with socket (230V) (2 m)
  • Bearing 625ZZ (inside diameter 5mm, outside diameter 16 mm, height 5mm)
  • Bearing 608ZZ (inside diameter 8mm, outside diameter 22 mm, height 7mm)
  • Bearing rb-lyn-317 (inside diameter 3mm, outside diameter 8 mm, height 4mm)
  • Timing belt GT2 (2mm pitch, 6mm wide, 650 mm)
  • Screw M5 x 35
  • Screw M8 x 40
  • 8 screws M3 x 15
  • 4 screws M4 x 60
  • 6 wood screws 2 x 8 mm
  • Screw M3 x 10
  • Relay board module (directly controllable by controller)

Step 2: Make the Light Box

The light box has four main parts and some braces. Download these parts and glue them together except the translucent plastic. I started with the wooden half disc and the curved wall. You need to keep the wall tighten around the disc during the drying. I used clamps to secure the half disc and the curved wall basis. Then some tape maintains the wall around the half disc. Second, I glued a rim to withstand the translucent worktable. Finally the flat wall is added with wooden (inside) and metallic (outside) right edges.

Once the box completed, you just have to add the lightbulbs and connect the wire and socket with the connector strip. Cut the 230V wire where it is convenient for you and insert the relay module. I enclosed the relay (230V!) in a wooden box for security reasons.

Step 3: Make the Robot Arm

Download the parts and cut them. To secure the belt on the servomotor I used pieces of paperclips. I nailed the two part belts on the servomotor and added some glue to be sure that nothing moves.

For the linear vertical guidance, the plunger has to be sanded to avoid any blockage. It has to slide smoothly. Once assembled, the height can be adjusted by cutting the guidance at the desired length. However, keep it as long as possible to prevent over-center lock. The plunger is simply glued to the arm box.

The bearings are enclosed inside the pulleys. One pulley is made of two layers of plywood. These two layers are not necessarily touching each other so instead of gluing them together, glue them to their respective arm plate. The top and down arm plates are maintained by four M3 x 15 screw and nuts. The first axis (big one) is simply the M8 x 40 screw and the second (small one) the M5 x 35 screw. Use nuts as spacers and lockers for the arm parts.

Step 4: Make the Electromagnet

An electromagnet is simply a soft iron core with enameled wire coper around it. The soft iron core guides the magnetic field at the desired place. The current in the enameled wire coper creates this magnetic field (it is proportional). Also the more turns you make the more magnetic field you have. I designed a U-shaped iron to concentrate the magnetic field near the the caught screws and increase the prehension force.

Cut a U-shape into a piece of soft iron (height: 25mm, width: 15mm, iron cross-section: 5 x 4mm). It is very important to remove the sharp edges before winding the wire around the U-shaped iron. Be careful to keep the same winding direction (particularly when you jump to the other side, you need to change the direction of rotation from your point of view but you keep the same direction from the U-shaped iron point of view)(https://en.wikipedia.org/wiki/Right-hand_rule) Before branching the coil to the circuit, check the coil resistance with a multimeter and calculate the current with the Ohm's law (U=RI). I have more than 200 turns on my coil. I suggest you to wind until you have only 2 mm of space inside the U-shape.

A wooden holder has been made and the U-shaped iron has been secured with hot glue. Two slits allow to secure the wire on both ends. Finally two pins are nailed on the wooden holder. They make the junction between the enameled cooper wire and the electronic wire. To prevent any damage of the coil, I added a layer of hot glue all around the coil. On the last picture you can observe a wooden part who closes the U-shaped iron. Its function is to prevent any screws to get stuck inside the U-shaped iron.

The enameled wire coper has been taken from a broken transformer. If you do so, check that the wire is not broken or has no short circuits in the used portion. Remove the tape on the ferromagnetic core. With a cutter, detach one by one all the iron slices. Then remove the tape on the coil and finally unwind the enameled wire cooper. The secondary winding (the big diameter coil) has been used (transformer input 230V, output 5V-1A).

Step 5: Make the Circuit

On a prototyping board, I built the schematic above. A bipolar transistor (S8050) has been used for switching the electromagnet coil. Check that your transistor can handle the current calculated in the previous step. A MOSFET is probably more suitable in this situation but I took what I had on hand (and I wanted a low on-resistance). Adjust the two resistors to your transistor.

In the schematic above, VCC and GND icon are connected to the + and - of my power supply. The servomotors have three wires: Signal, VCC and GND. Only the signal wire is connected to the controller, the others are connected on the power supply. The controller is powered by the programmer cable.

Step 6: The Code

Last but not least: The code. You will find it here: https://github.com/adrienrosselet/optical-screw-s...

There is one program for the controller (arduino type) and another who runs on the computer (hopefully soon on raspberry). The code on the controller is responsible for trajectory planning and the one on the computer makes the image processing and sends the resulted position to the controller. The image processing is based on OpenCV.

The computer's program

The program takes an image with the webcam and the lights, detects the translucent worktable center and radius and corrects the eventual image rotation. From these values, the program calculates the robot position (We know the robot position according to the plate). The program uses the blob detector function of OpenCV to detect the screws and bolts. The different types of blobs are filtered with the available parameters (area, color, circularity, convexity, inertia) in order to select the desired component. The result of blob detector is the position (in pixels) of the selected blobs. Then a function transforms these pixel positions into millimeter positions in the arm coordinate system (orthogonal). Another function calculate the required position of each arm join in order to have the electromagnet at the desired position. The result consist in three angles which are finally send to the controller.

The controller's program

This program receives the join angles and moves the arm parts to reach these angles. It first calculates the top speed of each join in order to perform the move during the same time interval. Then it checks if these top speeds are ever reached, in this case the move will follow three phases: acceleration, constant speed and deceleration. If the top speed is not reached, the move will follow only two phases: acceleration and deceleration. The moments at which it has to pass from one phase to another are also calculated. Finally the move is executed: At regular intervals, the new actual angles are calculated and sent. If it is time to pass to the nest phase, the execution continues to the next phase.

Step 7: The Final Touches

The frame

A frame was added to hold the camera. I chose to make it with wood because it is cheap, easy to work with, easy to find, environmentally friendly, pleasant to shape and it stays in the style I began with. Make an image test with the camera to decide what height is needed. Also be sure to make it rigid and fixed because I noticed that the resulted position is very sensitive to any camera moves (at least before I added the worktable auto-detection function). The camera has to be situated at the worktable center and, in my case, 520 mm from the translucent white surface.

The boxes

As you can see in the picture, the movable storage boxes are on the flat part of the worktable. You can make as many boxes as needed but with my actual setup the space is quite limited. Nevertheless I have ideas to improve this point (cf. future improvements).

Future Improvements

  • For the moment the timing belt is closed with a wooden part but this solution limits the area that the arm can reach. I need to add more space between the big servo and the arm axis or make a smaller closing system.
  • The boxes are along the flat worktable edge, if I put it along the half circle edge, I would have much more space to add boxes and sort many component types.
  • Now the blob detection filter is enough for sorting the parts but as I want to increase the number of boxes, I will need the increase the selectivity. For this reason, I will try different recognition methods.
  • Now the servomotors I use do not have enough range to reach all the half disc worktable. I need to change the servos or change the reduction factor between the different pulleys.
  • Some issues occurs quite often so improving the reliability is the priority. For that I need to classify the type of issues and concentrate on the more likely. This is already what I did with the small piece of wood which closes the U-shaped iron and the auto detection center algorithm but now the issues become more complicate to solve.
  • Make a PCB for the controller and the electronic circuit.
  • Migrate the code to Raspberry pi to have a stand alone station
Organization Contest

Second Prize in the
Organization Contest

Share

    Recommendations

    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019

    35 Discussions

    0
    None
    JohnW539

    14 days ago on Step 7

    Really cool project! I am going to look at making something like this. I love robots - and I hate sorting hardware. :)

    0
    None
    reddragonzz

    2 months ago

    Cool i love this idea & am interested to see how the project develops. I already have a robotic arm so maybe i could make it into this idea. Keep up the good work - love it!

    1 reply
    0
    None
    AdrienRreddragonzz

    Reply 4 weeks ago

    Thank you. If you make your own, let me know.

    1
    None
    CHARLESCRANFORD

    2 months ago

    WOW! The only thing that would make it better, was if it would give you the fasteners that you needed, when you requested them. Sort of like a "reverse" of what it does. Great job.

    1 reply
    0
    None
    AdrienRCHARLESCRANFORD

    Reply 4 weeks ago

    Thank you. Asking to fill boxes with a specific list should be easy to implement. For exemple I could say: make boxes with 5 nuts M3, 10 screws M3*10 and 2 screws M3*15. It should be few lines of code but what if the requested component is not available? It would be great if a notification pop up.

    0
    None
    AdrienRbhagyeshwari

    Answer 4 weeks ago

    I don't have equations, just find the good range for the "area" and "inertia" parameters.

    0
    None
    mlduffy

    2 months ago

    Great job!- I've been wondering when someone was going to make something like this. One of my favorite stories about Cal Ripken (one of our American Baseball legends) is that when he was a mis-behaving child, his dad emptied a big jar of mixed screws, etc. onto a table and gave Cal instructions of how he wanted them sorted. When Cal was finished his dad swept them all back into the jar, mixed them up again, then dumped them back onto the table, giving him different instructions on how he wanted them sorted. The idea was that it was half punishment, half a test to make sure his child knew how to follow directions.

    I always wondered if there would be an efficient way to sort miscellaneous hardware much like a Coinstar machine...

    1 reply
    0
    None
    AdrienRmlduffy

    Reply 4 weeks ago

    Thank you. Yes there are some highly efficient machines for the industry. There are also some 100% mechanical smart systems on youtube. I just wanted to have a very polyvalent machine and also write some code.

    0
    None
    Georgejb75

    7 weeks ago

    This is an amazing project, Well done. I must also say that I'm quite envious of your humongous workshop/lab. I have to work from a small workbench/desk in the corner of my living room.

    1 reply
    0
    None
    AdrienRGeorgejb75

    Reply 4 weeks ago

    Thank you. I understand you, I did not had access to a fablab / makerspace / hackerspace all along my life (it is quite new).

    0
    None
    pgs070947

    7 weeks ago

    Interesting.
    The sort of job I used to do on a sunny afternoon armed with a strip of aluminum with holes drilled in and scale down the side, plus plenty of empty coleslaw tubs.
    First sort by type e.g. machine or wood-screw etc, then sort by diameter, then sort by material, then sort by head, pan, cheese-head, Philips, Pozidrive, Torx, socket, slotted and so on.
    Then remember not to get in the mess in the first place - no chance. Food ingredient sorting machines are some of the smartest. They seem to rely on camera recognition and compressed air to sort.

    1 reply
    0
    None
    AdrienRpgs070947

    Reply 4 weeks ago

    Yes, there are some industrial machines with a rotary drum and a super fast camera. The screws (or anything) are expulsed by aire stream and flaps. I have seen also such a system for wast sorting.

    0
    None
    Sylvaind9

    7 weeks ago

    Would me interesting to make sorting a new function on a multi purpose 3D machine with swapable function head (i.e. 3D printer, lathe, water jet cutter, laser cutter and screw sorter! )

    1 reply
    0
    None
    GreggV1

    Question 7 weeks ago on Step 7

    Does it differeniate between flat head , round head , hex head , carriage bolts . This is great but it will not work on stainless steel . I on occasion get 5 Gallon bucket of mixed brand new hardware that I sort , this machine would do the first sort by category for me . Thank you

    1 answer
    0
    None
    AdrienRGreggV1

    Answer 4 weeks ago

    It actually does not differentiate each type but I hope it will soon. Effectively it doesn't work with stainless steel. If you need it, use a vacuum gripper instead of electromagnet. You are welcome.