The lights are off, the doors and windows are locked, and you leave the home for a while. Then you remember that you forgot to check the stove. This hack aims to solve this very problem by using SMS for stove monitoring and control so that homeowners can ensure their piece of mind wherever and whenever they want.
While working on the project, I wanted to make this hack usable and replicatable for the average user. Given that almost all of us have experienced this problem some times, simplicity and reliability is a big bonus. That's why I opted to use temperature sensors for monitoring and servos for control; it's easily accessible and dirt cheap to buy. Keeping the UI in mind, the interface is simply through the Short Message Service (SMS), the reason being that the user would want to put their mind at rest simply and quickly.
This tutorial will detail how to set up the Raspberry Pi Zero W, and look at various ways to implement sensing and control technology for a variety of stove types.
How does this work?The backbone of the project will rely upon the Raspberry Pi for IO sensing and control, with the Hologram Nova modem providing the SMS capabilities for communication with the user. The general user flow will be as such:
- User texts Hologram Nova, for a status update
- Nova recieves message, processes it, and sends a command to the Raspberry Pi
- Pi checks the stove status with a temperature sensor and returns it to the Nova
- The Nova sends the status back to the user's phone number
- User can decide to manually control the stove by sending command SMS
- Nova recieves command, relays it to the Raspberry Pi
- Pi shuts off the stove through a servo motor (dial control)
Before we can build the final project, we need to ensure we have the components ready. You will need the following:
- Raspberry Pi/Pi Zero (model doesn't matter as long as you can use the corresponding IO pins) with header pins
- DHT temperature sensor (DHT11 or DHT22 doesn't matter, it's just a difference in measurement accuracy)
- Analog to Digital converter (ADS1115)
- Micro servo motor
- Micro USB power supply (to power the Pi)
- Micro SD card (recommended min 8 gigabytes) to flash the Raspbian OS
A lot of the components were included in my cellular contest kit (thanks Hologram!), but these are fairly mundane items you can find almost anywhere on Aliexpress, Amazon, Ebay, or Adafruit.
Step 2: Pi setupTo start, you need to set up the Pi so that it can actually operate.
- Download the OS you would like to use on your Pi, or stick to the original if it came on your SD card. Simply download the Raspbian OS here. Desktop or lite doesn't matter.
- Since we'll be using IO on our board, go ahead and solder header pins on your Pi, if it hasn't been already.
- Insert your SD card and follow the instructions on the Pi website to flash the image (OS) to your SD card. I used Etcher as it really simplified the process.
- Insert the SD card into the Pi and connect it to a display and power. The Pi should boot up.
- Open the command terminal, and type
sudo apt-get update
curl -L hologram.io/python-install | bash
curl -L hologram.io/python-update | bash
sudo apt-get install -y build-essential python-dev
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo python setup.py install
cd ~
git clone https://github.com/metachris/RPIO.git --branch v2 --single-branch
cd RPIO
sudo python setup.py install
sudo reboot
In summary, this updates Raspbian, installs the Hologram SDK, installs git, and installs the Adafruit DHT(temperature sensor) library, installs the RPIO library (servo motor control), and reboots the Pi to apply changes.
Step 2B: VNC Setup (Optional if you aren't using a Pi Zero or if you have a usb hub)- If you happen to be a poor soul that has a Pi Zero / Pi Zero W and no USB hub (like me), we can use VNC to control the Pi to leave open a port for the modem!
- As we'll be using the Pi's only micro-usb port for the Hologram Nova, we'll need to control it another way by setting up VNC.
- Open the command terminal and type:
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer
- Go to desktop and select Menu > Preferences > Raspberry Pi Configuration > Interfaces and set VNC to Enabled.
- Hover over your WiFi icon on the bottom right and note the Pi's IP address
- Reboot the Pi
- Now, on the device you wish to take control of the Pi with, install VNC viewer
- Run VNC viewer and enter your Pi's IP address and hit enter
- If it's set as default, enter pi as the username and raspberry as the password
We can now control the Pi remotely and open the micro USB port to the Nova.
Step 3: Hologram setupOur end goal is to be able to control and monitor a stove remotely, but for that to happen we need an activated SIM card for SMS communication, as well as the Hologram Nova modem for 2G/3G signal.
Essentially, we need to:
- Activate the sim. Select the developer data plan. Choose the zone coverage according to your location.
- On the side panel of the dashboard, click devices. Then click your sim from the device menu
- Click on configuration, and click Configure a Phone Number. Write this down, we'll use it later.
- Insert the nano SIM cutout in the Hologram Nova and attach the antenna and case, as shown here. Either antenna is ok for our purposes.
So now that all the setup has been done, we can start wiring our Pi to everything else.
- Plug the assembled Hologram into the Pi's USB port. Use a USB to micro-USB adapter if using the Pi Zero W
- Connect the DHT temperature sensor to the Pi using jumper cables. The (+) pin should be linked to 5v, (-) to GROUND, and (signal) to pin 7 on the Pi.
- Connect the micro servo motor to the Pi using jumper cables. The (+) should be linked to 5v, (-) to GROUND, and (signal) to pin 11 on the Pi.
Note: The pin #'s I'm referring to are the board pins numbers, not the BCM GPIO pin number.
Here's more info on Pi pinouts.
Now that everything's all wired up, you just have to add the code! On your Pi, type in the following commands on the terminal:
cd ~
git clone https://github.com/JonathanXu1/Hologram-Stovehacks.git
cd Hologram-Stovehacks
sudo python main.py
The Pi should now be running an infinite loop, listening for any incoming texts and responding to user commands.
The user starts the interaction by texting their Holgram SIM number (the one we wrote down earlier, remember?) with the keyword "status update". Any combination of these words will be accepted. You can change them if you'd like.
If the user sends the keyword, the Pi checks the temperature registered on the DHT sensor. If the temperature surpasses the specified degree, the Hologram registers the stove as on. Optimally, this sensor should be mounted somewhere above the stove. You can customize this temperature change sensitivity by modifying the mintemp variable.
The Hologram texts back the temperature, along with the prompt asking whether to turn off the stove. If the user types 'yes', the Pi sends a signal to a servo motor, which will move a custom stove knob, turning off the stove. You can check out the STL for the knob here, but it is still in the works.
Step 6: 3D Printing and installationWe now have control of the servo through SMS, but still need to fully automate the turning of our stove knob. This requires a specially designed and 3D printed knob to fit our servo motor. I tried my best to visualize and test this model, but as I don't have a 3D printer, I could not prototype or verify it. Hopefully I can create and improve upon my model.
Link: Tinkercad
Step 7: Finally gain peace of mind!To start using this hack, text your hologram number with the message: "status".
Future changesThere's much to improve for the future, such as implementations of gas or infrared sensors for a much more accurate and reliable reading on stove status. However, due to my hardware restrictions, I'm only able to sense stove status with a temperature sensor for now. I'm also thinking of individual stove element monitoring capabilities, as this design certainly can control multiple servos. For the future, the Pi should be able to communicate wirelessly to each stove knob, which would be connected to separate ESP8266 WiFi modules and battery.
This concludes my first tutorial. Hope you've enjoyed reading this and learned a bit today. There's still much to optimize, so please let me know if there's anything to fix.
Comments