Important news about HackSpace

We have some important news to share about HackSpace: Issue 81 was the last issue of HackSpace as a standalone magazine, and HackSpace has become part of The MagPi, the official Raspberry Pi magazine. Starting with issue 145, We’ll be adding pages to The MagPi to make room for the stories and tutorials you’ve come to expect from HackSpace.

Can We Hack It? A Candy Grabber

By Les Pounder. Posted

In the 1980s the arcades were where all the action was. The latest games would forcibly remove 10p coins from our pockets as we went for the highest scores. But one game was a little different; it involved a metal claw controlled by the player as they hunted for a teddy bear, watch, or some novelty toy.

The claw game was great fun, but those claws were weak, and most times the teddy bear dropped back into the pile. So when we found a cheap version on eBay that offered the same fun game, but without the need for 10ps, we had to take one apart!

Made of a solid plastic frame, the chassis is robust and can be worked with hand tools and, with care, small power tools. The red and black plastics are the most robust, while the clear plastic used as windows to prizes in the candy grabber is strong but will crack if not handled gently. The unit is held together with cross-head machine screws which bite into mounting pillars in the plastic.

ELECTRONICS

Powered by 3 × D cell batteries, the candy grabber runs at 4.5 V throughout. This was tested at the motors and joystick controls. Rather than use batteries, the game can be modified to run from a 5 V power source – either a USB battery or a USB adapter.

It should work just as well with a 5 V supply, but a DC buck converter can be used to drop the voltage down to 4.5 V with no loss of functionality.

The grabber unit moves along a gantry system via two DC motors giving us two directions of movement, and there are limit switches along these axes, enabling the unit to stop the motors before the end is reached.

To control the height of the grabber, another DC motor is used to wind a chain with the grabber hand at the bottom. When we press the joystick down, the grabber opens, and when we press up, it closes.

The controls are simple switch inputs connected to a custom single-sided board. They operate at 4.5 V, which means that they can be directly used with 5 V boards such as Arduino. But for Raspberry Pi and other 3.3 V boards, a converter board will be required.

The controls for the game are simple switches operating at 4.5V, these could be hacked to work with an Arduino or Raspberry Pi

To start the game, a token is inserted into the slot which has a small microswitch which will trigger the game to start – signalling power to the motors, and playing a rather 'vociferous' version of carnival music. Music is provided by the same circuit board and is contained in a chip-on-board (COB) which is covered in epoxy and not available to hack.

A small speaker secured to the bottom of the chassis is easy to work with and can be used with add-on boards for the Raspberry Pi to play real music.

When a player drops their prize into the chute, there is a light sensor and LED. When the prize blocks the light from the LED to the sensor, a winning jingle is played.

HACKABILITY

There is so much space inside the chassis! Enough for a full Raspberry Pi and related extras. The first hack that we would do with this board is to replace the D cell batteries for a USB power supply and buck converter.

The second hack would be to put a Raspberry Pi Zero W inside along with some L298D motor controllers and use the Anvil Python web framework (anvil.works) to build a web interface to control the grabber and play the game from our phone.

It would be great to add a few extras to this unit; for example, an Arduino could be used to power a handful of NeoPixels which would light up the game when in use.
With so much space on offer, there really is no limit to what you can do with this game!

As it comes, this is a great game to play with friends, and we can see it being used at parties in the holiday season. But the ease with which this game can be hacked with off-the-shelf components means that we can have our own internet-enabled candy grabber game and let our friends play the game from their smartphone.

The simplicity of the build does not detract from how clever it is. Limit switches, motors, and gears all work well to provide a little arcade fun at home.

Web Control

We mentioned Anvil in the teardown as it is a rather clever piece of kit. Anvil is a framework that enables a user to design an application and front end for a Python project hosted directly on the web.

Everything that makes up the app is in Python. It has a special library for the Raspberry Pi that enables remote control of the GPIO pins. So we can directly control the pins from a smartphone, and in turn, control the motors of the candy grabber.

We can also get data from the Raspberry Pi and display it in our app. So if we are building a temperature sensor, we can send that data back to the app and create a graph using the data, in real-time. Anvil’s basic tier is free and is plenty for budding IoT makers to get their teeth into.


Candy Grabber - £18.99 - from Ebay


http://bigl.es

From HackSpace magazine store

Subscribe to our newsletter