This blog post will detail how the Pi Claw works and what its currently running on.
The Claw Itself
Let's start with the claw itself.
Originally the machine was a standard small claw machine designed to go more in Pubs, Cinemas etc instead of arcades due to its small size.
Along with re-decorating it I took out the original controller board and replaced it with a custom controller which has the following:
- 2 dual H-Bridges setup to drive the three motors (X,Y & Z).
- Darlington Transistors to drive the electromagnet in the claw & the light bulbs in the front panel buttons
- Connectors that lead to the claw mech (Stop switches, motors and magnet), One for the front panel buttons, lights & coin mech and another to lead to the top.
- Power routing for the 12,24 & 48 V Rails.
Currently for the web enabled pi only the claw mech is in use as the front panel is still being developed.
To stream I'm using a old computer running Ubuntu, it's just about enough to stream at a stable rate using OBS at a reasonable resolution. Connected to it is a PS3 Eye / Eyetoy 3 to provide the video along with a pygame window at the side to show details.
The stream is then streamed to Twitch where the stream is embedded into the website. Why twitch? I originally went to use youtube but had a couple of issues where the video would require re-embedding each time the stream went up or down.
But doesn't this mean the python code is running on the laptop?!
Yes the code is running on the laptop. BUT it still uses the Raspberry Pi.
Thanks to @Ben_nuttall's GPIO Zero you can have it setup where the python code runs on a computer and controls the GPIO on the Pi remotely!
However I can also run it independently for when I'm at jams using the front panel buttons.
The python script checks the database every 5 seconds and if there's a new record added it will then move for the times set in the database, records are added using the form on the website.
The website's just a basic bootstrap template with the twitch stream and an iFrame embedded. The iFrame is another page on the site where users can drag two sliders with the time the claw should move in each direction and then adds it to the database. That's pretty much it.
I want to play!
If you want to play head over to https://piclaw.xyz and submit your guesses when it's up. The machine will be running over the next week from around 11AM to 9PM depending on a few factors (including if my internet is up).
Subscribe to @Ryanteck
Get the latest posts delivered right to your inbox