You'll need the following parts to build this project:
- Adafruit Metro (Arduino Uno) - This project is built to work on an Arduino Uno compatible such as the Adafruit Metro 328P. It might work with other Arduinos that are compatible with the ultimate GPS or FONA 808 shields.
- GPS receiver, pick one of the options below:
- Ultimate GPS shield - This shield will let you save your trick or treating path to the SD card and view it later with Google Maps. This is a simple option that doesn't require any cell or internet service to use with the hardware. You will need a microSD card too.
- FONA 808 shield - This shield will let you log your trick or treating path to Adafruit IO using a GSM cellular phone network. You'll need to have a 2G GSM SIM card and data service, access to Adafruit IO, a passive GPS antenna, a cellular network antenna, and a small LiPo battery.
- Shield stacking headers - Not required but will make it a little easier to connect to digital outputs on the shield. If you don't use stacking headers then just solder wires directly to the shield.
- Momentary button with integrated LED - This will be the main interface to the hardware. The LED will tell you if the GPS receiver has a fix and the button is used to mark a location as having good candy.
- 330 ohm resistor - This limits the current through the LED. In most cases you can use any value from around 200 ohms to 500 ohms (but make sure to use one or else you could burn out the LED).
- Candy container - Use an inexpensive plastic container that you can drill a small hole through to mount the button & LED.
- Power source - You'll need a small battery power source to power the Arduino when you're trick or treating. I recommend a 9V battery supply as it's small and will run the hardware for at least a few hours--long enough for your trick or treating run. If you're building the FONA808 version you can actually power everything from the LiPo battery required by the FONA (just move the switch on the shield from the CHRG to RUN position).
- Wire and soldering tools - You'll need some wire and soldering tools to connect the button & LED to the Arduino, and assemble the shield. For the button you might consider picking up these arcade button quick connects.
Start by assembling your GPS or FONA808 shield and running through its guide to make sure it works:
Then wire the button & LED to the Arduino as shown below. Note the shield isn't shown in the diagram below, but you'll want to connect the shield to the Arduino and then wire to the shield as shown.
Also note the diagram shows the LED and button as separate components, however if you're using one of the illuminated buttons recommended in this guide it will have the LED integrated inside of it. There are 4 terminals on the back of this button. The terminal marked with a + sign is the anode (positive / longer leg) of the LED and is connected to digital pin #6. The terminal marked with a - sign is the cathode (negative / shorter leg) of the LED and is connected to the 330 ohm resistor down to ground. The other two terminals are the momentary button and one should be connected to digital pin #5 and the other to ground.
Here's an example of the hardware using the GPS shield:
And here's an example using the FONA808 shield:
Note that you can tightly zip tie the wires to one of the unused mounting holes on the shield as a form of strain relief. This will help protect the solder joints from taking too much force as the hardware bounces around inside the candy container.
Putting everything together is easy once you've wired up the components. Just drill a hole in the candy container so the button can be mounted in a convenient to reach location.
For the button recommended in this guide you'll want to drill a ~5/8" hole in the container (a stepped 'christmas tree' drill bit works great for drilling clean holes in plastic):
Mount the button in the container:
Connect the button as shown in the diagram above. Remember the + lead is the anode of the LED and connects to digital pin #6, and the - lead is the cathode which connects through a resistor to ground:
And place the hardware inside the candy container:
That's it, you're ready to load the software for the project!
Note you might consider protecting the Arduino with a case or small cardboard box.