- 1 x Particle Photon
- 1 x HC-SR04 Sonic Distance Sensor
- 1 x LED strip
- Scrap Cardboard and Paper
- Hot Glue Gun
- AWS Elastic Beanstalk
- 5/9/2018 - Picked up Particle Photon dev board from mailbox.
- 5/15/2018 - Begin embedded code prototyping. Everything works quite reliably except for the home WiFi network, apparently.
- 5/16/2018 - Began working on cloud app and Particle webhook integration.
- 6/3/2018 - Assembled the prototype box.
- 6/5/2018 - Pushed testing code to repo. Just need to mount everything in the boss' doorway and then we're officially hardware complete!
- 6/12/2018 - Worked on getting Elastic Beanstalk to behave and actually run the web app.
- 6/20/2018 - Added video of build process.
- 6/30/2018 - Finished documentation.
Cut 6 pieces of cardboard to make a box. For my build I decided to cut the side pieces a little short so that a bit of light would shine out onto the wall once the box was mounted in place.
Print a template to use for the sign's text. Align it with the center of your front piece of cardboard, as you'll be using it as a guide for you sign's text.
Using a thumbtack or a nail, punch holes along the edge of your guide's letters. No need to punch all the way through the cardboard; we'll be connecting the dots later with a razor blade later.
Using a razor blade and a steady hand, connect the holes you punched earlier. Be extra careful on the curved spots as it's easy for the blade to catch and tear the cardboard in those areas.
After cutting out our letters, remove them. You don't need them anymore after this. (Optional: Save the center pieces for the A and O letters and attach them to our light filter later on for a more professional look.)
Assemble all of the box except for the back piece. We'll be attaching components to that in the next step and still need to install lights before we complete the box. For my build I used a hot glue gun for speed as I lack clamps to hold my pieces in shape otherwise.
Using a mixture of friction, glue/tape, and a bit of ingenuity... mount the electronics. For my build I cut two small holes for the ultrasonic sensor and then glued it into place. The Particle Photon's header pins were simply punched through the cardboard back and then connected to the ultrasonic sensor (and later the LEDs) via female jumper wires.
Install the LED strip. There are many ways to do this, but I opted to use the strip's own tendency to unwind against the inside of the box to keep it in place. I also left its 4-wire connector (V+, GND (Blue), GND (Red), GND (Green)) hanging outside of the box so that I could change which of the strip's LEDs were being powered down the line.
Lastly glue the back of the box onto the remaining sign enclosure. You're now hardware-complete!Programming
- First clone the project repository from GitHub. It contains all of the code you will need for both the Particle Photon itself as well as the Python Flask app running on AWS Elastic Beanstalk.
- Connect your Particle Photon to your WiFi network using the Getting Started guide on the Particle website.
- Utilizing the Particle Web IDE located at build.particle.io, create a new project and paste the contents of on-air-sign.ino into the editor. Note that you may need to add the HC-SR04 library to your project in order for it to compile properly.
- Once the code has flashed successfully, verify that data is being sent to the Particle platform by checking out the console. We're looking for data labeled "distance-inch" which is sent whenever there is a significant change in the distance sensor reading. (E.g. door open / closed.) Heartbeat pings are also sent about every two minutes to ensure that the sign is still alive and working.
- Before we can create our Particle webhook to pipe sensor data somewhere useful, we first need to spin up our Python Flask microservice on AWS Elastic Beanstalk. Amazon has its own in-depth instructions which rely on utilizing their command line interface (CLI), but this process is messy and confusing and shouldn't be bothered with. Instead, we're going to simply put our code into an archive and utilize the simple Upload and Deploy option. For convenience's sake, I've included a ready-to-go archive in the project repository. Once this has successfully deployed you should be able to open the URL listed on the overview screen and receive a JSON with values. At this point all values will be null as we haven't yet connected the Particle platform with Elastic Beanstalk.
- To connect the remaining dots, we need to create a webhook. From the Particle console, navigate to the Integrations tab. Create a new one of the webhook type. Use the following values to finish completing your webhook:
Event Name: distance-inch
URL: <URL from Elastic Beanstalk>
Request Type: POST
Request Format: JSON
Device: Any / <Or your board name>
- Then click on the Advanced Settings dropdown menu and check No for enforce SSL. Seeing how this data is being openly broadcast to the worldwide web, we can simplify our life and not worry about encryption for the sake of this project. Finish creating your webhook by clicking on the Create Webhook button.
- You're now done! Install your on-air sign with the distance sensor pointed at the door you wish to track and ensure that everything works properly. If the lights fail to turn on when the door is closed– or if they never turn off when the door is opened– you may need to tweak the distance threshold, which is found on line 15 of the Particle Photon firmware code.
- Use the following shell command to receive a JSON blob from your Elastic Beanstalk microservice to get info about the door's current and recent status changes.
curl http://particleonair-env.bacsrq6wm7.us-east-1.elasticbeanstalk.com | python -m json.tool
- Data is served up in JSON format to simplify future integration into an Alexa Skill, but the Flask code could just as easily be refactored to instead serve up some pretty HTML and/or a static image of an open or closed door.