Introduction: Motion-Activated PumpkinBot
This is a Halloween-themed variation of the classic "vibrobot" project, with a slight twist: it's motion-activated instead of just having a simple on/off switch. It uses a passive infrared (PIR) sensor to detect motion and turn on the robot's LED eyes and motor. Leave the robot sitting on your front porch, and it will jump to life when unsuspecting trick-or-treaters approach!
Whether you refer to them as vibrobots, brushbots, or bristlebots, these simple robots are incredibly popular and a great way to get kids with no previous experience interested in robotics and electronics. I designed this one with teaching a class at a local makerspace in mind, so the project is intended to be kid-friendly (with adult supervision for the use of some tools).
PS - OK, so I'm publishing this a little late for trick or treating (but just in time for the Halloween contest deadlines).
Step 1: Materials
Below is a complete list of materials you'll need to complete the project. Since not everyone has access to a soldering iron, I wrote these directions so you can build the robot without soldering. If you do want to solder, you'll need to substitute or eliminate a few parts (see notes). Most of my circuit parts are from SparkFun, but you can substitute an electronics vendor of your choice.
- (1) PIR sensor*
- (1) DC motor
- (1) mini breadboard (substitute mini perf board if you are soldering)
- (1) 3xAA battery holder
- (3) AA batteries
- (4) M-F jumper wires (not necessary if you are soldering, but you'll still need regular hookup wire)
- (1) N-channel MOSFET
- (2) 10mm "jumbo" LEDs (you can pick a different color)
- (1) rectifier diode
- (1) 10kΩ resistor
- (2) 100Ω resistor**
- (2) Short jumper wires***
- (1) Trick-or-treat pumpkin bucket. Available at Target, craft stores, seasonal Halloween stores etc.
- (3) Toothbrushes, preferably with slanted bristles
- (1) Cork. Used wine corks work well. If you need a bunch, they are also available at craft stores or on Amazon.
- Miniglue gun (you need to glue things inside the pumpkin)
- Xacto knife
- Power drill
- 7/8" spade bit or hole saw
- 11/32" or 3/8" drill bit
* I used this Adafruit sensor because I already had one, and didn't want to pay for a new one from SparkFun. The two sensors work slightly differently - the Adafruit sensor goes high when it detects motion, and the SparkFun sensor goes low when it detects motion. The circuit as I have it presented in this project is designed to work with the Adafruit sensor. To get the SparkFun sensor to work, you'd either need to use a P-channel MOSFET instead of N-channel, or an inverter with the N-channel MOSFET. The Adafruit sensor also stays "high" for a few seconds when it is triggered, which means the robot will run for a couple seconds each time it detects motion. I haven't tested the SparkFun sensor, so can't guarantee that it would work the same way.
** SparkFun does not carry individually 100Ω resistors. If you don't have a well-stocked electronics bench, you might want to invest in a resistor kit, which has a bunch of different values, and is much more economical than buying individual resistors anyway (if you do this, you won't need to buy the individual 10kΩ resistor).
*** Again, if you don't have a well-stocked electronics bench - you can't really buy just two jumper wires. You can go for a jumper wire kit which has wires pre-cut to various lengths, or some spools of 22 AWG solid-core hookup wire and a pair of wire strippers and cut your own.
Step 2: Prototype the Circuit
It's a good idea to prototype the circuit on the breadboard before you permanently attach the whole thing inside the pumpkin. This will give you an idea of how it works, and you can make sure you have all the connections correct. Working inside the pumpkin is a little cramped, so you want to get any issues sorted out beforehand.
If you know how to read a circuit diagram, you can follow the schematic above (and if you don't, SparkFun has a nice guide on how to read a schematic). If not, follow the breadboard diagrams (made with Fritzing, and the Fritzing file is attached to this step). Space gets a little cramped on the mini breadboard, so pay close attention to each connection you make. It's also a good idea to make sure the battery pack is OFF as you put things together.
Once you've assembled everything, turn the battery pack on. The LEDs should light up and your motor should spin for a few seconds before stopping. The PIR sensor always turns "on" for a short period of time when it first powers up. Give it a couple more seconds, then wave your hand in front of the PIR sensor. This should trigger the LEDs and motor again.
If you want to learn more about how the circuit works, here's some recommended reading about some of the components:
- Adafruit has a nice tutorial on PIR sensors. When the sensor detects motion, it outputs a logical HIGH signal (5V). When it doesn't detect motion, it outputs a LOW signal (0V).
- Here's an introduction to LEDs, tiny lights found in tons of electronic projects.
- Here's introduction to resistors, which help limit the amount of current flowing through the LEDs so they don't burn out; and an explanation of what that 10k resistor is doing in there (in this case it's a pull-down resistor, not pull-up, but the concept is the same).
- MOSFETs are a little more complicated (if anyone finds a good kid-friendly resource, please let me know). Essentially they act like an electronically controlled valve that determines whether or not current can flow through the LEDs and motor. The output from the PIR sensor triggers the gate pin of the MOSFET. When the gate receives a HIGH voltage, the MOSFET turns on, allowing current to flow. When the gate receives a LOW voltage, the MOSFET shuts off, turning off the LEDs and motor.
Step 3: Drill Holes in the Pumpkin
Adult supervision recommended for this step!
Now you need to drill holes in the pumpkin for the LED eyes, motion sensor nose, and the motor (which goes in the back). Use the spade bit or hole saw to drill holes for the PIR sensor and motor, and the regular drill bit to drill holes for the eyes. Use an Xacto knife to clean up any burs around the edges of the holes.
After drilling, make sure each of the components fit in the respective holes. The LEDs and motor fit snugly, the PIR sensor was a little loose so I had to hold it in place for the photo.
Note: the biggest drill bit I had was 11/32". The resulting hole was a pretty tight squeeze for the LEDs. I had to push them through and deform the surrounding plastic a bit, but it wasn't a big problem. If you have a 3/8" drill bit, that might work better.
Step 4: Glue Parts to the Pumpkin
Adult supervision recommended for this step!
This is where that mini glue gun comes in handy. You don't want a bunch of goopy glue showing all over your pumpkin's face, so you need to securely glue the parts from the inside of the pumpkin. While young kids should be supervised when using a hot glue gun, they might actually have an easier time with this part since they have smaller hands. Try not to let the hot nozzle of the glue gun press up against plastic or rubber pieces, like the LED casing or the insulation on the PIR sensor's wires.
Make sure you use a good amount of glue and let it dry before moving to the next step. Since the motor is on the back of the robot and won't be visible, you can apply glue on the inside and the outside for extra strength.
Step 5: Attach Cork to Motor
While holding the motor from inside the pumpkin (so you don't push it through the wall), press the cork onto the motor's shaft. Then, take the cork off, put a tiny dab of hot glue in the hole you just made, and press it back onto the shaft. Be careful not to use too much glue or press the cork all the way up against the body of the motor - this could prevent the motor from spinning.
It's important to make sure the cork is off-center, as this will create the vibrations that make the robot move.
Step 6: Assemble the Circuit Inside the Pumpkin
Now for the tough part: you need to assemble the circuit inside the robot. Again, kids with smaller hands might have an easier time than adults here. It might take some fiddling to find a method that works for you, but here are the steps I followed:
- Glue the M-F jumper wires to the LED leads (plug the LED leads into the female ends of the wires). Make sure you get the polarity right - red wire to the long lead, black wire to the short one.
- If you're soldering, solder regular hookup wire to the LEDs instead.
- Peel the paper backing off the bottom of the breadboard, and stick it to the top of the battery pack (the side with the on/off switch).
- Pull the leads from the LEDs, motor, and PIR sensor out of the pumpkin and plug them into the breadboard (refer back to Step 3 for the circuit diagram).
- If you are not soldering, turn the battery pack on briefly to make sure the circuit works again. Once you're confident that everything is good, use hot glue to hold the components in place.
- Use a dab of hot glue to secure the battery pack to the bottom of the inside of the pumpkin. This connection is sturdy enough for when the robot is moving around, but you'll be able to peel it off when you need to replace the batteries eventually.
Step 7: Glue Toothbrush Heads to the Bottom of the Robot
Adult supervision recommended for this step!
Use scissors or wire cutters to cut the heads off your three toothbrushes. If you can't cut through the neck of the toothbrush all the way, score it first, then bend it back and forth a few times to break it off.
Glue the three toothbrush heads onto the bottom of the pumpkin to form a stable tripod. The exact location of the toothbrushes, the direction they're facing, and even the type of bristles (straight or slanted, hard or soft etc) can have a big impact on how the robot moves, so be prepared to tinker with this a bit.
Step 8: Test Your Robot!
Now you're ready to test your robot! Put the robot down on a flat, smooth surface (the toothbrushes will get caught on carpet). Turn it on, then quickly move out of the field of view of the PIR sensor. The robot should buzz around for a second as the PIR sensor "wakes up," then shut off. Then, if you (or anything else that gives off body heat, like your dog) walk in front of it, it should start moving again.
Keep a close eye on your robot's parts to make sure nothing falls apart. All that vibrating around can cause things to come loose. If it stops working suddenly, check your circuit connections - odds are a wire came loose. Use glue as necessary to make repairs. You can also try adjusting the positions of the toothbrushes, and the robot's center of mass by moving the heavy battery pack around, to see how this affects the robot's movement. Once you're happy, hide the robot somewhere where it will be able to scare unsuspecting passers-by!
If you have any questions, feedback, or suggestions about this project, please leave a comment below. Happy (belated) Halloween!
We have a be nice policy.
Please be positive and constructive.