Introduction: Smile Activated Marshmallow Launcher
You want to encourage guests, colleagues, friends and family to be happy? You need a Smile Activated Marshmallow Launcher. The Raspberry Pi powered "SAML" detects a smile and then launches a marshmallow at it - happiness pays off!
Step 1: Components, Software and Tools
To create your SAML you'll need:
Components
- Raspberry Pi Model 3 - https://thepihut.com/collections/raspberry-pi/pro...
- MotoZero motor controller - https://thepihut.com/products/motozero
- Micro Metal Gearmotor - https://thepihut.com/products/micro-metal-gearmot...
- 4xAA Battery Holder - https://thepihut.com/products/adafruit-4-x-aa-bat...
- Webcam
- Monitor
- Wifi Dongle
- Keyboard
- Mouse
- USB and Power Cables for Raspberry Pi
- Wire
- 4 AA Batteries
- Toy Catapult
- Coat Hanger
- String
- Safety Pin
- Solder
- Duct Tape
- Marshmallows!
Software
- Raspbian - https://www.raspberrypi.org/downloads/raspbian/
- Open CV - Open Source Computer Vision - https://opencv.org/
- Smile Detection Software - download from .zip file below
Tools
- Soldering Iron
- Small Screwdriver
- Wire Stripper
- Wire Cutter
- Scissors
- Pliers
Ready? OK - next step...
Step 2: Installing the Software
OK so you have collected the components. Start by focusing on the Raspberry Pi. Connect the power supply, keyboard and mouse, internet (wifi dongle or ethernet), monitor and USB camera. Switch on the power and when you're online, download Raspbian.
Next you'll need to download Open CV, a computer vision library, and then the smile detection software in the .zip file below. There is a great Instructable at https://www.instructables.com/id/Smile-Detection-W... which will take you through this. We modified the smile detection software by inserting instructions from the MotoZero motor controller manual so that rather than printing a message on the screen, the Raspberry Pi instead activates the motor via the GPIO pins and the MotoZero motor controller (we'll come on to how to set them up later). The modified Smile Detection software includes the instruction for the motor to run for half a second when a smile is detected.
Attachments
Step 3: Assembling the Hardware
You've already put together the Raspberry Pi, and installed the software, so now it's time to get creative with the launcher. For us this meant adapting a broken old catapult that the children had lying around. There is plenty of leeway for other launchers, but the firing controller works like this.
Start with the MotoZero motor controller. Follow the instructions to solder the components together. Then attach to the GPIO pins on the Raspberry Pi. Then Insert 4 AA batteries into the battery holder and connect to the power pins of the MotoZero. Be careful to use the correct polarity. Then connect the Micro Metal Gearmotor to the MotoZero terminals for motor 1.
Next you need to figure out how to use the 0.5 second rotation of the Gearmotor to trigger the launcher. For us this involved taping the motor to the side of the catapult, taping some string with a trimmed safety pin at the other end to the axle of the Gearmotor, and feeding this through a retainer made by bending a coat hanger so that we could hold the arm of the catapult down and release it by rotating the motor and winding the string around the axle.
There will be much tidier ways to do this.
Next align the catapult with the webcam so that the marshmallow is fired towards the smiling face.
Finally, arm the catapult and load with a marshmallow!
Step 4: Activation!
Hardware all set up? The next stage is to run the Smile Detection Python Programme.
Start by opening a terminal window. If you have installed the software on your desktop you will need the following commands:
cd desktop
cd smile_detection
sudo smile_detection_Rosemodification.py
This should open the correct folder and then run the software. A window will open showing the webcam view, and once your smile is recognised - the motor will run, triggering the catapult.
Enjoy!