Introduction: IoT Command Center
I decided to make a device that was jam packed with sensors and buttons that can do whatever you want it to. It has temperature, humidity, gas, light, sound, motion, and vibration sensors. It also has a speaker and an LED stick for feedback. I 3D printed the enclosure and the clear LED stick. The LED stick can be set to give visual feedback of a sensor's readings. I currently have it set to display the temperature using different colors for different temperature ranges. My first Command Center is going to be used in a warehouse. My office is upstairs so when people need me, they have to walk up stairs or call me. 4 of the buttons are programmed to text different people in the warehouse with the message"Your assistance is needed in the warehouse." The other 2 buttons will probably be used to turn lights on and off at the other end of the warehouse. I also get a text if the warehouse gets too hot(The Thermostat is upstairs too) and if the device disconnects from the wifi. I can monitor the condition of the warehouse at all times from anywhere. The buttons on the device can also be triggered from a cell phone using Spark's tinker app.
Combine a Spark Core with IFTTT(If This Then That) and you can do anything. If This Then That is a service that allows you to perform a wide variety of conditional statements to do pretty much anything. You use it by creating recipes that put the internet to work for you. A Spark Core is an Arduino compatible wifi development board. The company has created an amazing software package and partnered up with IFTTT. This means that you can create IFTTT recipes that monitor variables on your Spark Core and do what ever you want. You can connect it to a WeMo switch. A WeMo switch is a wifi connected outlet. With a Spark Core, a WeMo switch and IFTTT, you can have the outlet turn on or off when a button is pressed or a sensor value has exceeded your set threshold.
Each of the seven sensors can trigger an event when they rise above or fall below a certain set value.
The six buttons on the front panel can be programmed to do anything. One button could text a friend or loved one that you are leaving the house. Another button could post the last picture you took on your phone to Facebook, Instagram or Twitter. You could program each of the buttons to a different WeMo outlet in your house. The possibilities are endless.
One of my favorite parts about using the Spark Core are the Tinker appand their Web IDE(Build). The Tinker App lets you see the status of your Spark Core's digital and analog pins wherever you are. The Spark Web IDE(Build) lets you flash a program to your device from anywhere in the world. That's pretty great. I find this particularly useful for the Spark Electron(Cellular Dev Board) that is coming out soon. You could put this IoT Command Center out in a field somewhere with a solar panel and never have to touch it again.
Another option to consider is using an IFTTT recipe with Pushbullet to send all of your devices notifications.
The IoT Command Center can receive external triggers as well as send them. For example, you can have other products and services trigger your device to play a melody or sound an alarm.
If you want to built something completely different of your own, you can still use this instructable with the provided source code and schematic to connect sensors and buttons to your next project.
Step 1: Bill of Materials
2. Perf board for soldering the Spark Core to. You could solder directly to the board if you wanted to. You also need some perf board to make a 3.3V power rail and a 5V power rail. I use power rails from a bread board so that I can still easily change or add sensors if needed.
3. Temperature/Humidity sensor - You can use a DHT11 or DHT22. I ended up using a DHT22 because it is more accurate. The DHT22 is also a bit larger than the DHT11.
4. Vibration Sensor.
6. Piezo Buzzer or Speaker.
7. Gas/Smoke sensor - MQ5 is good for natural gas. There are so many MQ sensors to choose. From Air Quality sensors to alcohol and smoke(MQ3), you can find one to fit your needs.
9. Eight 10K Resistors.
10. Power Button.
11. Three 4-40 screws.
12. Hot Glue.
Step 2: Build or 3D Print Your Enclosure
There are three files to print. The enclosure front panel, the base, and the LED tunnel. I designed the LED tunnel to fit one of these Adafruit Neopixels. I printed my enclosure with an Ultimaker 2 using Colorfabb Shining Silver for the enclosure and Taulman PLAtinum for the clear led tunnel. There are also enclosures you can buy. Then you can drill the holes and make the cutouts for the buttons and sensors. Also, if you don't have access to a 3D printer, you can use a service like 3D Hubs to get your enclosure printed for you.
Step 3: Create the Circuit
Use the circuit diagram to plan your circuit out. Prep all of the buttons and sensors using heat shrink tubing where necessary. Cut one end off of a usb cable and strip the black and red wire. We will not need the green and white wire because we can flash our code via wifi.
When the digital pins are set to high, they supply about 3.3V. Certain components and sensors require 5V logic to properly function. In my case, 3.3V was just fine, but if you want to use a component that requires 5V logic, you will need a Logic Level Shifter(SN74AHCT125N) or something similar(see last picture). There are Uni-Directional and Bi-Directional Level Shifters. A Uni-Directional Level Shifter will only shift from one voltage to another. For example, it will shift from voltage A logic to voltage B logic but it will not shift voltage B logic to voltage A logic. A Bi-Directional Level Shifter will shift from voltage A to voltage B and work the other way around. It will also shift voltage B to voltage A.
Step 4: Assemble Your Command Center
Use hot glue where needed to secure all of your sensors in place. Take care to not use too much hot glue at a time because you can warp your enclosure if it gets too hot. If you are using the hdx vibration sensor, be sure to place it somewhat vertical as my testing found that it had more responsive readings when it was positioned vertically.
Step 5: Tweak Your Code
Now that you have set up the circuit that you want, it's time to tweak your code. Just copy my code from the txt file into your Spark Build Web IDE. Click flash to upload the code to your Spark Core over wifi. I have broken the code down to publish events when each button is pressed. There is a Spark Variable for each sensor of the 7 sensors. You can create IFTTT recipes to monitor each of these variables and trigger a specific action when the value rises above or falls below a threshold of your choice. Use the tinker app to play around with sensor values to adjust your desired threshold. You can also create IFTTT recipes to listen for the button events and trigger your action when the buttons are pressed. If you are using a DHT11 temperature and humidity sensors instead of the DHT22 that I used, you will have change the 22 to an 11 in the code. You can also view your variable values at any time using Spark's Rest API.
I will be improving the code over the next few weeks and updating is here.
Step 6: Spark It Up!
It's time to bring it to life. Press the power button and pay attention to the LED on the Spark Core. Once it starts breathing Cyan you are successfully connect to the internet. Let's get to the various applications of a device like this.
Step 7: The Limit Is Your Imagination.
Here are some ideas that might inspire you to think of interesting things to do with your Command Center.
General Outlet Controller
You could map each button to a different outlet outlet in your house with a WeMo switched. One button could turn your living room lights on while another could switch on an AC unit. The possibilities are endless.
Pizza Delivery Button!
Imagine getting home to an empty refrigerator. Just press your Pizza Button and hop in the shower. Use an IFTTT recipe to email or text your favorite restaurant for a delivery. Call your local restaurants and ask them if they accept email or text orders. It's becoming more and more common. Ask them what the required format of the order is and then fill that into your IFTTT recipe.
Instagram, Facebook, Twitter,RSS Feed and Email Notifications
Have your Command Center play a melody and light up the LED stick a different color for each trigger.
Child Location Notification
A location based IFTTT recipe could flash the LED and play a melody when your child gets to school and when they leave. All you need to do is install IFTTT on their cell phone.
General Location Notifications
A location based IFTTT recipe could have the device let your loved ones at home know that you're on your way home from work.
You can use the vibration sensor to call, text, or send you an email when there is excessive vibration detected.
If attached to your washer or dryer, it could text you when it's done.
You can have the Spark Core turn on a WeMo switch connected to a dehumidifier when the humidity rises above a specified limit.
Use an IFTTT recipe to turn on some fans connected to WeMo switches.
Use an IFTTT recipe to turn on your sprinklers at the push of a button
Use it as an alarm clock and set it to sleep when a certain combination of buttons are pressed.
The Command Center can be set to call, text, or send you an email when there is motion detected.
An IFTTT recipe to text you when your device loses connect to the internet is a good idea.
The led tunnel on the top is currently programmed to display the temperature using different colors for different temperature ranges. You could change it to display any of the other sensor values with a color chart too.
I hope you can customize this project to fit your unique needs. Feel free to ask me any questions you might have. Post your ideas in a comment below and I'll add them to the list. Thank you.
***If you liked my project please CLICK Vote! ↗ Above ↗ Thank You***
First Prize in the
Runner Up in the
Participated in the
3D Printing Contest