Building a claw machine from scratch

Building a claw machine from scratch

In April 2021, I watched a video where the host builds a claw machine, like the ones we see in malls, using only cardboard, a few pipes and syringes as a hydraulic system and I thought: I gotta make one of these.

I had no idea how to do it and didn't even know how to begin, but since I've always liked electronics and was trying to learn more about Arduino, I decided to build it using an electronic system with Arduino.

I started by using a pre-made claw intended to be used in a mechanical arm project, a servo motor and started testing out ideas. My plan was to learn about how each of the mechanisms work and then put it all together. A few days later, I had written an extremely simple program that closed the claw and then opened it again. I had learnt a small part and then the next step would be creating the control system: how to capture the user's intention using a controller, pass this information to the Arduino and then process it.

For starters I decided to use an analogical controller component (much like the ones used in video game controllers). Days later, I had a simple program that captured that information, but it didn't do anything yet because there was nothing to be moved by it - that part was coming later.

The next step was to develop the main button's action, so I bought a simple button, created a third program that received the action of pressing the button, and then combined the three programs into one.

To this point, my software:

  • Received the user's intention to move the claw (front - back - left - right);

  • Received the user's intention to activate the claw using a button;

  • Closed and opened the claw as a response to the above intention

Now the next steps would be to create the actual system for the X and Y axis and think of a way to get the claw to descend a few centimeters to reach the prizes before it closes.

For the axis, I decided to use the same approach of the video I saw: using PVC pipes with diameters of 3" and 1.5" (the thinner one inside the bigger), creating a trail.

Weeks later, I had a satisfying configuration for the X and Y axis, and the movement of these axis was made using stepper motors and belts.

Having that done, I started thinking on how to create the Z axis, which would be responsible for making the claw descend before closing. The mechanism I ended up using was simple: fixing a spool in the shaft of a stepper motor, and attaching the claw to this spool using a sewing thread. This way, when the stepper motor moved in one direction, the thread would unwind from the spool, and when it moved in the opposite direction, the thread would wind up again, pulling the claw up. Once this was ready, I attached this mechanism to the X-Y mechanism and the principle for the claw machine was ready.

Once I had all this done, I've run into a small "big" problem: from the beginning, I thought this project to be a real world sized replica of the machines that they use in malls, and these machines are huge and heavy. After my mechanism was ready, I realized that I should have opted for portability. Where I would store and how would I transport this machine after it was finished, after all?

Now, I had to downsize the machine a lot. But the solution was not as simple as downsizing the structure: the materials and single components I've used for the structure were big, so if I would just downsize the total size of the machine, the actual area inside it would be too small. I had to think of a different solution, some way to miniaturize everything on it.

I've spent the next months searching for inspiration in similar projects, thinking, redesigning the initial idea. Meanwhile, I was learning the basics of 3D printing with a homemade printer, until I found out that I could use the same basic structure of those printers for my machine, and that's what I did: I redesigned the machine in order to be able to mount it using 20x20 aluminum profiles, which are light, not too thick and simplify the mounting process a lot.

Now I had a miniaturized structure, already had the program developed and just needed to adapt some variables on it to match the miniaturized structure.

As I was progressing, I made some minor modifications like using endstop switches instead of controlling the "stop" of the axis on the code (the same way made in 3D printers), using an Arduino Mega instead of the Uno because I needed much more I/O ports, and using an arcade stick instead of the analogical controller component I used in the beginning.

Taking advantage of the recent learning I had about 3D printing, I've also decided to model a few custom parts, including a smaller, lighter claw. A few more months passed until I had a satisfying result.

At this time, I already had a clearer idea of how the project was going to look when it was finished and what I would need to do to finish it. The next step was to get a few plywood sheets to use as the top and bottom lid and the base when the prizes would lay and, before closing it with acrylic plates, add sounds and lighting to the machine.

The lighting was simple: just a single RGB LED strip at the back of the structure.

As for the sound effects and music, I decided to use one of my favorite Nintendo Switch indie games as the theme: Space Dave. So I reached the great guys at Choice Provisions, who created the game, and they agreed to send me the music and SFX used in the game so I could use it on the machine. I also created and printed a few stickers using the game art. For those who want to know the game, here is a trailer of it.

Then came the final moments of the project: actually "close" the machine with the acrylic plates and proceed to the first real world tests. The tests (most of them, to be honest) were great and finally, after all this time, the machine was finished!

This was all the process I went through to have my own claw machine and, though it took a lot more time then I wanted to, it was great to learn and create something a little different from what I do on a daily basis, improve my knowledge on Arduino/C, electronics and even start on modeling 3D parts. I really hope it inspires you in some way and thank you so much for reading!

For those of you who want to see more videos/photos of the process, I kept posting it on my Instagram and you can see it on this link.

PS. all the code for this project is open source and is available in my GitHub repository.