I live in Vancouver, Canada. Every year my family from Ottawa visits and brings me a 1000 piece jigsaw puzzle. My mother likes to select really challenging stuff, like a tiny field of out of focus purple flowers or a solid blue rectangle. They do the edges and then go home, leaving me with no useable dining table. If you’ve seen me at a Hackspace you’ve seen me cleaning – I like things tidy and finished. I can’t let an inanimate jigsaw puzzle beat me. The urge to finish it is stronger than me in some ways. I can’t let the obsession get the better of me so I found a workaround.
I thought to myself: Is there a way to solve all jigsaw puzzles forever? IF I can make a machine that solves one jigsaw puzzle THEN it should be the same as a machine that can solve any number of jigsaw puzzles. Then I can relax, because I’ve won forever.
How
So there’s two problems: make a machine that can do the job…and teach the machine to do the job.
Building the Machine
All jigsaw puzzles are solved in basically the same way. A CNC machine with a camera and a rotating suction nozzle should be mechanically able to do the job.
A CNC carving machine is like a 3D printer but it has a spinning router cutting tool instead of a plastic extrusion hot end tool. Where a 3D printer is additive, a CNC is usually subtractive. A pick and place machine often uses a air suction nozzle tool.
I tried to make my own a few times over a 6 month period. Several tries later, I was getting good enough to know that my best was still garbage. So I went online and found a CNC that would do the job right: an 1000mm X-Carve from Inventables. I added a hollow shaft stepper motor to it with a SMT nozzle, air pump, and solenoid normally-closed air release valve built in.
The CNC collet (orange) is moved by the X-Carve. The stepper motor (peach w/ stripes) turns the nozzle (bottom). The spring loaded nozzle head grabs pieces when the air pump is on and lets go when the pump is off and the release valve opens.
Next, I used Fusion 360 and calipers to make 3D models of the collet and all the mechanical parts. As often as possible, I prefer to buy a part if the online store has a dimension diagram or a 3D model. That way I can design my entire machine before I spend a penny and I can shop with confidence.
On the underside of the collet, I also put a Raspberry Pi and a camera. This way the robot can see the piece before and after it is picked up. The cable that comes with a Pi Cam is quite short for my taste, but I was able to model everything together.
Here’s an Instagram video I shot at the time:
While I waited for delivery, I printed my connector pieces:
Teaching the Machine
I know nothing about AI, despite my attempts to learn. But I’ve had a little experience with sensing light and color from building line following robots. It’s tricky stuff! Not only is the problem a challenge, I can’t put an estimate on how hard is the problem. Same goes for matching shapes. So I went with the next best solution, an intelligence already trained to solve puzzles: Twitch!
Twitch Plays a Jigsaw puzzle
Twitch is an online service where people (mostly) watch streaming video of each other play games. Some years ago, there was a special Twitch stream of the video game Pokemon. People watching could also talk in the on-screen IRC chat. The game was watching the chat, and if you typed certain words, the game would register them as a button press. Collectively, democratically, the audience played their way through and won the game.
From Twitch to Robot
On my PC, I used Eclipse Java IDE to write three classes: One to talk to the X-Carve, one to talk to the new air nozzle parts, and one to talk to Twitch. These three classes were contained in a master Jigsolve class, which glued the three together. This way I could test the parts separately and together.
From Robot to Twitch
The camera on the nozzle is part of a Raspberry Pi. I followed online tutorials to stream the camera feed to the LAN as an RTSP stream. On the PC, I had the VLC app display the video feed, and the Online Broadcast Studio (OBS) app sending the video to Twitch.
Things I learned and, like, stuff
Twitch user Mdp117 found a way to DDOS the robot by making the nozzle turn to angle seven kajillion. Thank you for testing!
Twitch user amazing3d was the first to connect two valid pieces.
The air release valve was a late addition. I thought turning off the air pump would be enough for it to let go of the part. That is why you don’t see it in the Fusion 360 models.
The lighting under the machine is bad. I made a ring light (see the photo below) that runs on the Raspberry Pi GPIO pins. It is dim and blue-ish. A strong strip of LEDs along the bottom of the gantry would do a better, more consistent job.
The SMT nozzle was small enough for electronic parts but TOO small for jigsaw pieces. I paid instagram user xyzaidan to make me some silicone nozzles. Worth every penny! Sadly it was so long ago I can’t go back through his IG history and find the images.
Finding two matching pieces was too hard, so, after some thought, I wrote a script to move the robot, take snapshots from the video feed, and save them to a Google map.
On assembly, the X-Carve gantry was obviously crooked. When one side would touch the end, the other was off by about 2cm. If they made cameras a permanent addition, they could compensate for not-square assembly and make even more perfect cuts. Inventables offered me a replacement gantry last June but they have yet to ship it.
Tell me more!
Until the jigsaw puzzle has been completed, you can find it online at Twitch.
For a list of all the parts we used to convert the X-Carve, including the STL files to print the adapters, please contact me through my forum.
ADVERTISEMENT