Intro: SnackBot: the Internet Connected Candy Machine!
During the 2013 Bay Area Maker Faire, Electric Imp distributed an astonishing 40-plus pounds of M&Ms with our Internet connected SnackBot. Hundreds of attendees loved it, so we decided to share how we built it.
Our SnackBot is based around the Electric Imp, a hardware, software and cloud-based platform that makes it easy to connect just about anything to the Internet. If you are new to Electric Imp, you can check out our Instructables on Getting Started With the Electric Imp, which will guide you through the process of getting your imp online and running some basic code.
This project involves a bit of soldering (and desoldering), and should take you about 2-3 hours to complete!
Let's get started!
Step 1: Parts & Supplies
- 1 x Brookstone SnackManTM
- 1 x Electric Imp Card
- 1 x April Breakout Board
- 1 x NFET
- 1 x Diode
- 1 x 10KΩ (oh higher) resistor
You are also going to need some tools:
- Philips Screwdriver
- Soldering Iron
- Foam Tape (or other adhesive)
- An iPhone or Android Phone
Step 2: Disassembly
Disassemble the SnackMan:
- Remove the clear plastic dome by pressing the button on front of the SnackMan.
- Remove the top piece of plastic to expose gear cover and screw caps.
- Remove the gear cover, gear, screw caps, and screws.
- Push in on the button (the same button from #1) and pull up to remove the plastic cover.
- Once the plastic cover is removed, we have access to the electronics.
- Remove the screws attaching the circuit boards to the base.
- Unclip all the wires from the main board.
You should now have 5 pieces:
- The top cover + motor
- The rotary encoder (circular dial + board) from the front of the SnackMan
- The bottom of the SnackMan (with the power cable coming up from the base)
- The main board
- The IR board
You won't need to use the main board (4) or IR board (5), so they can be discarded (or kept for future projects if you like).
Step 3: Hacking the Switch
When the switch is in the Off state, the SnackBot will be off. In any other state, the SnackBot will be on. We don't need to worry about controlling the serving size, since that will be managed by our webpage.
Here's what we need to do:
- Snip the connector off the end of the cables.
- Pull the wires apart (this will make the next steps easier).
- Desolder all the wires except the 3rd from the top (it should be black).
- Solder the Red wire from the SnackMan's power source to the second from the top hole.
- The red wire from the power source, and the black wire we left should be next to one another.
Step 4: Adding the Imp and the Motor
- Bend the NFET's leads for the outside pins line up with GND and Pin9 (see image).
- Solder Pin S (source) to GND (on the imp).
- Solder Pin G (gate) to Pin9 (on the imp).
- Solder the negative (black) lead from the motor to Pin D (drain).
- Solder the 10kΩ resistor between Pin9 and GND.
- Solder the black wire from the power source (base) of the SnackMan to the imp's GND pin.
- Solder the extra wire coming out of the rotary encode to the imp's VIN pin.
- Solder the positive (red) lead from the motor to the imp's VIN pin.
- Solder your diode between the positive and negative leads of the SnackMan's motor (see image).
- The banded/striped end of the diode should be soldered to the motor's positive (red) lead.
Step 5: BlinkUp and Run Code
Get your imp online:
- Add batteries (or plug in the power cable).
- Turn the rotary encoder to any position other than the "Off" position.
- Insert an imp into the SD card slot on the April board.
- An LED inside the imp should start blinking.
- Follow the steps in our BlinkUp Instructables to get your imp online.
- If your imp didn't turn on, you likely have wiring issue. Go back and double check you soldered all things that needed to be soldered.
Test the hardware:
- Log into Electric Imp's web based IDE.
- Copy and paste the test code from our SnackBot repository into the Device window in the IDE.
- Hit Run.
- The motor should have turned on for 10 seconds, then turned off again. If it didn't, you have a problem and you should make sure the NFET is facing the correct direction.
- Copy and paste the SnackBot Agent code into the Agent window of the IDE.
- Copy and paste the SnackBot Device code into the Device window of the IDE.
- Hit Run.
Step 6: Reassemble Your SnackBot
Secure the SnackBot's Electronics:
- If desired, remove the red piece of plastic. This will make BlinkUp easier in the future.
- Reattach the rotary encode / power switch.
- Add foam tape to the base of the SnackBot assembly to hold the April breakout board in place.
- Firmly press the April breakout board (with the imp) into the foam tape you just put down.
- Add the plastic cover that goes over the electronics.
- Add the plastic button.
- Screw the plastic cover in place.
- Cover the screws with the screw caps.
- Add the gear / candy dispenser.
- Add the gear cover.
- Snap the clear plastic dome into place.
- Refer to Step 2 of the Instructables for reassembly.
Add Candy and Enjoy!