-
Notifications
You must be signed in to change notification settings - Fork 5
Home
piWarmer is used at your own risk This is a Python script that controls an AC/DC relay attached to a Raspberry Pi with a space heater plugged in. There is an Adafruit GSM Board that receives text messages using a Ting SIM card connected to the Raspberry Pi. When the Pi receives a text message it will turn the AC/DC relay on or off accordingly, thus powering the heater on or off. An optional MQ2 Gas Sensor can be attached. If the MQ2 Gas Sensor triggers, the heater will turn off. A configuration file controls how long the heater can run, phone numbers that are allowed to control the heater and specifies if the optional MQ2 Gas Sensor is connected.
The following are a list of text messages that can be sent to the Pi that will control the heater (case insensitive):
SMS Message | Action |
---|---|
ON | Turn the Relay/Heater on |
OFF | Turn the Relay/Heater off |
STATUS | Return status of the Relay/Heater (on or off) |
SHUTDOWN | Shutdown the Pi |
Any Raspberry Pi or Pi Zero
AC/DC Control Relay Adafruit or IoTrelay.com
Ting SIM Card and Service Amazon or Adafruit
Space Heater of your choice
Optional - MQ2 Gas Sensor
Connect the AC/DC Control Relay GND to a GND pin
Connect the AC/DC Control Relay PWR to pin 18
Connect the TTL Serial Cable to the GSM Breakout board as follows:
- Red: Vio
- Green: RX
- White: TX
- Black: GRD
Plug the USB to TTL cable into the Raspberry Pi
Plug the heater into the AC/DC Control relay "Normally OFF" side.
Optional - Connect the MQ2 Gas Sensor to GRD and PWR on the Pi. Connect the MQ2 Gas Sensor Digital Out to Pin 23
- Burn the piWarmer image to an SD Card with a program like Win32Disk Imager
- Place the SD Card in the Raspberry Pi and boot it
- Edit the piWarmer.config file on the desktop
- Make sure that the GSM board is powered on with the SIM Card inserted
- Reboot
After rebooting, you should receive a confirmation text within a minute or so.
Install screen, ppp and elinks
sudo apt-get update
sudo apt-get install screen ppp elinks
Clone the github repository
git cone https://github.com/mdegrazia/piWarmer
Copy the piWarmer config file onto your desktop
cd piWarmer
cp piWarmer.config /home/pi/Desktop
edit the config file
nano /home/pi/Desktop/piWarmer.config
start piWarmer
sudo python piWarmer.py
Many issues may be resolved by simply rebooting the Raspberry Pi. This can be done by unplugging the power source.
Make sure the the GSM Breakout board is powered on. When powered on and connected to the Raspberry Pi, a blue LED light will be lit. If not, there is a small power button on the board. Turn the GSM board on by using this button. This board must be powered on before the Raspberry Pi is booted, or within 60 seconds of boot. Otherwise the program will not find it and will exit.
Check the piWarmer.log file on the Desktop for errors.