or roommate intrusion, there needs to be some way to let your cohabitators know that you are on the air.
My kids, like many others dream of becoming the next top Twitch streamer or YouTuber. After reading the Forbes article about the World's Highest Paid YouTube Stars who wouldn't!? So of course we built something really cool and geeky to solve this problem.
My young son's deepest grief in the world is when his recording or stream is interrupted by mom or dad shouting up the stairs to tell him to take out the trash or practice the piano. So UNCOOL! I bet MrMoon or The Diamond Minecart never had to deal with such indignities.
Enter the On Air light project. The idea is to put a sign somewhere that allows you to send out the message that you are on the air. I wanted to put the sign downstairs from the "studio." But running up and down the stairs to turn the light on and off just seems like silliness to a geek like me (and my son). So it needed to be remote controllable. I've been dying to play with the esp8266 WiFi chip so this is my perfect excuse.
At the heart of the sign is Adafruit's Huzaah breakout board for the esp8266. For those that aren't paging through and memorizing spec sheets for fun, the esp8266 is an inexpensive WiFi chip married to a micro-controller. Adafruit bundled it up with a breakout board and some excellent instructions on how to write code for it just like an Arduino board with a WiFi shield. But this is MUCH cheaper and smaller.
Here's the theory of operation:
- Use Adafruit's IoT service to set and store the state of the light
- The Huzzah uses the REST API to request the latest state of the light's feed on boot
- The Huzzah subscribes to the light's IoT feed as an MQTT client and waits for state changes
- When it gets an "On" message it brings 4 pins attached to red LEDs high
- When it gets an "Off" message it brings 4 pins low
Now on to the build
The build uses the following parts (Adafruit wishlist):- Adafruit Huzzah
- 4 - Adafruit Super Bright Red LEDs - (this is pack of 25. Only 4 are needed)
- 9v Power Suply
- Panel Mount 2.1mm power jack
- Console Cable (to program the esp8266)
- Right Angle Male Headers
- 4 - 100 Ohm resistors (get an assorted pack)
- Bunch of of wires - some female jumper wires (to reduce soldering)
- A display box
- Stick-on letters
- Piece of Baking Parchment
I won't write a play-by-play of the build, but here are the high points that should get an Arduino hobbiest going.
Prepare your Internet of Things account
- Setup an Adafruit account and then sign into https://io.adafruit.com to setup your IO account.
- Create a feed called "onair" following this tutorial
- Create a dashboard with a toggle switch widget that switches from "On" to "Off". Try this out a few times and learn how the dashboard works and the feed updates.
Assemble the hardware
- I used right angle headers for my build as it keeps the Huzzah board flat against the back of the case. It's a little trickier soldering, but I'd recommend it.
- Attach the Huzzah to your computer following the instructions from Adafruit.
- Try out the LUA commands in the tutorial to ensure it can connect to your WiFi.
- Follow the instructions further to configure it to work with the Arduino IDE
- Install the Adafruit IO MQTT and IO REST API libraries into the Arduino IDE per the instructions from Adafruit. The sketch uses the REST API to fetch the state of the feed when the Huzzzah first boots up or if it loses connection and the MQTT library to listen for updates.
- Get the code I used from github. You can see that I borrowed heavily from the Adafruit examples included with the libraries.
- Set your SSID and password in the code
- Set you IO username and AIO key in the code.
- Compile and upload the code to the board (press and hold the GPIO button while pressing the reset button once, then release the GPIO button to put it in bootloader mode before uploading)
- Watch the serial console (CTR+SHIFT+M) to see it boot up, connect to WiFi, connect the the MQTT stream, and fetch the last state of the light.
- Test switching the light mode with the dashboard. The on board LED of the Huzzah should turn on/off with the state of the feed. You can't see it yet, but the pins 5,12,13,&14 also are turning high/low so LEDs attached to them will turn on.
- Assemble the electronics. You can use the Fritzing diagram below as a guide. We'll be using the 9v power supply rather than the battery, but you get the idea. I recommend breadboarding it before assembling it into the display case.
For my build, I twisted the ends of all four resistors together and soldered them into a female jumper. This allowed me to wire all the LEDs into ground easily. I used female jumpers to go from the IO pins to the LEDs. It made a nice fit, was solderless, and was flexible to allow me to hot glue the assembly into the display box. I also avoided using the pins (TX,RX,V+,GND on the right) that hook up to the console cable in case debugging or programming is needed later.
Assemble the Display Box
- Discard the white foam in the display box
- Cut a piece of parchment to fit over the back of the glass and tape it into place. This will diffuse the LEDs and hide the electronics
- Draw a circle on the back of the display box inside the nut from the panel mount power jack. Cut out this circle and mount the jack in the lower back of the box.
- Place "ON AIR" letters on the front of the glass
- Using hot glue, mount the Huzzah and LEDs inside the back of the case. You can adjust the angle of the LEDs to get the right level of light and diffusion.
I got a little carried away with the hot glue |
Find a visible place for your new indicator lamp and plug it in!
Because I miss the html blink tags, I'm going to leave this right here.
No comments:
Post a Comment