Introduction: Hello There Boxes
Developed by the Tech Instructors at Rev Hardware Accelerator as part of a IoT product development workshop, this project is a pair of connected devices that “wave” at each other. Pushing the button on one box triggers the flag on the other box to wave no matter where it is, as long as both devices are connected to wifi. The boxes don't even have to be on the same wifi network!
Step 1: What You’ll Need
Step 2: Setting Up the Particle Photons
Particle account and Photon setup
Create an account on particle.io and follow these instructions to connect both of your Photons to the internet. After following the instructions, the onboard LEDs should be “breathing” cyan-blue on both devices.
Flashing the firmware
We’re going to use Particle’s web development environment to push code to the wifi-connected Photons. Log in to the Particle website and navigate to the Particle IDE (this can be accessed by selecting “IDE” at the top right corner of the Particle homepage).
The following steps will guide you through getting the right code onto your devices.
- Create a new app and call it whatever you like. Keep in mind that you’re going to have two versions of this app—one for each of the two Photon devices.
- Copy and paste this code into the app.
- Create the second app, and paste in this code, which is slightly different from the code for the first box. If you're interested in exploring further, the code is straightforward and thoroughly commented.
- Now, we’ll flash the code to the boards. Navigate to the Devices tab in the Particle IDE and select the first board. A star will appear next to the selected board.
- Make sure your boards are plugged in and powered on (a breathing blue dot should appear to the right of their names in the web environment), then click Flash.
- If your first board's LED flashes magenta, then all went well. Now, do the same for the second board by selecting it in the Devices tab, clicking Flash, and looking for the flashing magenta light.
Step 3: Breadboarding
Connect the Photons, servos, and pushbuttons as shown in the diagram above. Connect power to the Photons and wait for their status lights to “breathe” blue. Try pushing one of the buttons—the servo on the opposite breadboard should rotate. If the status light is blinking instead of “breathing,” try unplugging the USB cable and plugging it back in. You can also try pressing the “reset” button on the Photon board.
Step 4: Preparing the Case
Method 1: Cardboard box
Use an X-Acto knife to cut holes in the cardboard boxes for the pushbuttons and servos. Use glue or tape to secure the components inside the box.
Method 2: Laser-cut wood box
Use this file to laser-cut ⅛” plywood into the parts for the case. This case can be held together with nuts and bolts or with rubber bands. Assemble the case and install the components. Most pushbuttons come with a surface-mounting screw, and some servos can be attached with small screws.
Step 5: Testing
Test your devices! They should work anywhere in the world, as long as they’re both connected to wifi.
Step 6: Going Further: App
Using Particle’s console, you can configure webhooks that will be triggered when a Photon sends an event. For our example, we configured our Particle account to send an event to a web server when one of our devices’ buttons are pushed. Our web server logs this data and displays a “waving history” in a web app that can be installed on a smartphone home screen. Particle also allows you to trigger events via their API, so we put a button in the app that allows users to send a “wave” without having to physically press the button on their box. We designed our web app with PHP and MySQL, but you could use almost any web framework to create something similar.
Step 7: Going Further: Custom Board
If you want to take the next step in making the transition from prototype to product, you’ll want the inside of your waver boxes to be as elegant and customized as the outside. Compared to a breadboard and jumper wires, a custom board will increase the robustness and decrease the profile of your electronics.
Option 1: Simple functionality
You can make sleek, permanent connections between the photon and the connected devices (servo and push button). We designed our PCB on the free student version of EAGLE and used the schematic and board footprint from the Particle EAGLE library. We added header pin footprints for easy output connections via jumper wires to the switch and servo. Using the EAGLE Gerber files, we milled our PCB from a single-sided copper board using our Othermill. Finally, we soldered the Photon (header pin version) and header pins to the PCB.
Option 2: Full Photon functionality
If you are interested in taking advantage of more Particle Photon features, you can add the corresponding traces and pins in your PCB. For example, you may want to take advantage of the Photon's RGB LED outputs, SETUP button, SMPS enable line and USB D+/D-. If you want to use the these functions, you will need to design your PCB using the non-header Photon footprint, since the required pins are on the bottom surface of the Photon.
Secure the entire device inside the waver box so there is no chance of parts detaching if the box is knocked over or dropped on the floor. We added two mounting holes to our EAGLE design for this purpose.
Step 8: Rev: Ithaca Startup Works Hardware Accelerator
The Rev Hardware Accelerator supports people who want to turn their product ideas into businesses. Our programs draw on the growing hardware ecosystem in our region, and the exciting resources for R&D and innovation available right here in Ithaca.
Learn more about our intensive 11-week program on our website.