Space Heater Thermostat (External)
by ScottieDigital in Circuits > Arduino
358 Views, 0 Favorites, 0 Comments
Space Heater Thermostat (External)
I had originally got this idea from having a mushroom grow room and building a controller. Then I was jealous that it had a better environment than me. And I had thought about how many times I had woken up in late night sweating balllz! Like the devil came in the room! And of course if you have a way to check that it could be like 80-90F. Many time I tapped the heater and nothing I had to actually HIT IT or it to turn off. SO yeah this experience will many times be the same no matter a brand. Typically they can never be trusted. Which is why it's always better to have an EXTERNAL sensor. Then now by doing soo you are saving ENERGY and of course $!. So I am pretty sure that no matter the cost of this project it will pay for itself the first MONTH being used! Also now using this device you "keep" the built in thermostat ALL THE WAY UP. Because now WE control it! (Meaning the dial on Heater itself) THIS PROJECT ASSURES YOU A PEACE OF MIND THAT A SAFETY MEASURE IS IN CONTROL!
Supplies
2000W Electrical Space Heater (Run on MED it can handle HIGH but switch is the weakest Dial ALL WAY UP)
Arduino (I used Nano type)
OLED .96" display
Temperature Sensor DHT22 I changed out the one in picture.
120VAC to 5VDC 1A power supply
6" USB Micro cable
5V Relay 20A 120VAC W/ (transistor,resistor,diode)
Power Switch
Computer Power Port IEC
AC OUTLET NEMA Snap-In
Computer Power cable
Extension cable for use MUST be minimum of 14AWG.
LED w/220VAC cap and diode
Hardware for OLED and computer power coming in.
3D printer
Soldering iron/ solder
Electrical tape & Liquid tape
Super Glue
Cable Zip Tie
3D Printing
Soldering & Assembly
Yes as you can see here I soldered everything up before hand and ran it for a test run for awhile.
Of course you can skip this step to save time.
It is much easier to solder everything in place when you have everything needed.
Noting really difficult here. I do skip harvesting the power supply but you can look at my other projects and check that out too.
Holding the USB cable in place is just Super Glue! Also on sensor I didn't want to screw into my case.
Yes I did want it there! I change on the fly OFTEN!
Then when finished you can I did do but you don't have too is put a cable tie at the end of wire coming in.
*PLEASE NOTE*
The "ground" or "green" wire is being used for the relay triggered power.
This idea for wiring came to by that you are limmited to length in data wiring. While you aren't by AC.
AND that most power supplies don't need a ground anyway it's good to put that wire to a better USE!
Code
/*
Heater Controller
02/27/2023
ScottieDigital
*/
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "DHT.h"
#define DHTPIN 2 // Sensor Pin
#define DHTTYPE DHT22 // DHT22 AM2302 Type
#define RELAY_PIN 4 // Relay Pin diode not needed
Adafruit_SSD1306 display(128,64,&Wire,-1);
DHT dht(DHTPIN, DHTTYPE);
const int16_t DISPLAY_ADDRESS = 0x3C;
String stat,stat1 = "On",stat2 = "Off"; // Status of Relay
void setup(){
Wire.begin();
dht.begin();
pinMode(RELAY_PIN, OUTPUT);
display.begin(SSD1306_SWITCHCAPVCC,DISPLAY_ADDRESS);
// no initial screen. Data gives bad readout
}
void loop(){
float temp = dht.readTemperature();
float TempF = (temp*1.8)+32; // convert C to F
float hum = dht.readHumidity();
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(0,0);
display.print("Thermostat");
display.setCursor(0,16);
display.print("T:");
display.print(TempF); // use temp if C
display.print((char)247);
display.print("F"); // use C if
display.setCursor(0,32);
display.print("H:");
display.print(hum);
display.print(" %");
display.setCursor(0,48);
display.print("Status:");
display.print(stat);
display.display();
// No inital defualt status don't try!
// My defualt temps 70.80 & 74.60
if(TempF <= 72.50){
stat = stat1;
digitalWrite(RELAY_PIN,HIGH);
}else if(TempF >= 75.50){
stat = stat2;
digitalWrite(RELAY_PIN,LOW);
}
delay(2000); // time to read sensor
}
Enjoy It!