I've converted another £1.99 timer switch, this time to a remote reading/setting thermostat.
We have Guinea Pigs who's cage lives in the garden! Winter is moving in so I purchased a 100w ceramic heat bulb and holder and decided to make a thermostat to control it.
I needed a display and keyboard which I already have on my mobile phone so I use Bluetoth to send and receive information.
When the temperature drops below the value stored in the Arduino EEPROM (in my case 65 F) the relay closes and powers the heater.
When the temperature rises above the preset, the heater switches off.
Step 1: Components
Arduino Uno,Pro Mini or Nano
DS18B20 Waterproof Digital Sensor Thermal Probe
5v Power Supply
HC-05 Bluetooth transeiver
5v Mains relay
Cermic heater & holder
See my GSM operated switch for more details on the components
Step 2: Putting It Together
I stripped everything out of the timer - be careful not to lose the terminal cover plate and spring when dismantling !
The Arduino connections are listed in the program.
I decided to put the HC-05 on top of the unit so that the BT connection light is visible.
The relay is driven from pin 6 of the Arduino.
The temperature sensor on pin 2 must have a pull up resistor connected to 5v. A 4.7K is suggested, however due to the lack of one, I used a 10K without problems.
Step 3: The Program & Bluetooth Bit
The sensor code is from
// OneWire DS18S20, DS18B20, DS1822 Temperature Example
// // http://www.pjrc.com/teensy/td_libs_OneWire.html // // The DallasTemperature library can do all this work for you! // http://www.pjrc.com/teensy/td_libs_OneWire.html
The Bluetooth info comes from this excellent Instructable
On power up EEPROM location is read and used as the the thermostat setting. An unused EEPROM will give a value of 255!
When a BT connection is established (using Bluetooth Terminal HC-05 or similar from the Play Store), sending 's' (or any alpha character) the Arduino will send the current temperature and thermostat setting to an Android device.
Sending a numeric value, will set the thermostat switch temperature and store the value in the EEPROM (location 0).
The code is not the tidiest, but it should be pretty self explanatory.