Auto Heater: Because Manual Heating Is for Cavemen! 🔥

by pharoh in Circuits > Raspberry Pi

45 Views, 0 Favorites, 0 Comments

Auto Heater: Because Manual Heating Is for Cavemen! 🔥

IMG_0895.jpg
WIN_20250303_18_38_08_Pro.jpg
Screenshot 2025-03-03 183446.png

Are you tired of waiting for your room to heat up like a frozen turkey in a microwave? Well, worry no more! Presenting the Auto Heater 3000, a device so smart it could probably pass a kindergarten IQ test. It reads the temperature and activates a servo to control a heater when things get chilly—or in this case, when it doesn't meet your royal warmth standards.

Before we get started, let me tell you, I first built this digitally on Wowki (a microcontroller simulation platform, because why risk real-life failure when you can fail virtually first?). Once it worked without setting my imaginary house on fire, I took the plunge and built it for real. Spoiler alert: It works!

Oh, and a fun fact about me: I’m chronically sick kid, and when it gets too cold at night, I’m definitely not awake enough to turn on the heater manually. So, automation isn’t just cool—it’s survival! 💀🔥

Supplies

Microcontroller (Raspberry Pi Pico, ESP8266, etc.) – Your obedient electronic minion

DHT Sensor (DHT22 preferred) – Because we need temperature data, not blind guesses

Servo Motor (or a relay but I'm too scared of electricity)– The hand of automation!

OLED Display (Adafruit SSD1306) – To flex your temperature readings

Jump Wires – The spaghetti that holds it all together

Power Supply (5V) – Because magic needs electricity

Breadboard (Optional) – For that sweet prototyping experience

Screenshot 2025-03-03 213639.png

Load up Wowi.com and select Pi Pico

Screenshot 2025-03-03 213815.png

Select the Pi Pico Starter template

Screenshot 2025-03-03 214504.png

Click the plus button and add the following components

ssd1306

Servo

DHT22

Wiring It Up Like a Pro 🎛️

Screenshot 2025-03-03 214656.png


Pin Connections:


All VCC/V+ pins to VBus

All ground pins to anywhere on the board where it says GND.0+n



DHT Sensor(SDA)

GP28

Servo Motor(PWM)

GP2

OLED Display

SDA (GP0), SCL (GP1)

Connect everything as neatly as a secret agent defusing a bomb, or as chaotically as your earphone wires in your pocket. Your choice.




Code Like a Legend 💻

Here’s where the magic happens! We use the DHT sensor library to read the temperature and an OLED screen library to display it. If the temperature drops below a certain point (set by you, the master of warmth), the servo activates the heater.


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>
#include <Servo.h>

#define DHTPIN 28
#define DHTTYPE DHT22
#define SERVO_PIN 2
#define OLED_RESET -1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);
DHT dht(DHTPIN, DHTTYPE);
Servo heaterServo;

void setup() {
Serial.begin(9600);
dht.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
heaterServo.attach(SERVO_PIN);
display.clearDisplay();
display.display();
}

void loop() {
float temp = dht.readTemperature();
if (isnan(temp)) {
Serial.println("Failed to read DHT sensor!");
return;
}

display.clearDisplay();
display.setCursor(0, 10);
display.setTextSize(2);
display.setTextColor(SSD1306_WHITE);
display.print("Temp: ");
display.print(temp);
display.print(" C");
display.display();

if (temp < 30) { // Adjust this threshold
heaterServo.write(90); // Heater ON
} else {
heaterServo.write(0); // Heater OFF
}
delay(2000);
}

Try It Out

Screenshot 2025-03-03 215418.png

Test it out by pressing play


PS if you don't want to do all that use my code https://wokwi.com/projects/424455583048128513

Wire It Up IRL

IMG_0899.jpg

Now wire it up exactly as you did in the simulator

Flash the Code Using Arduino IDE

Screenshot 2025-03-03 220030.png



Here's a tutorial in case you are having some trouble

Tip download all libraries mentioned in the code

https://www.youtube.com/watch?v=RQRQvjIBbUo

Testing & Troubleshooting 🛠️

Doesn’t turn on? Check if you wired it like a normal person and not like an angry octopus.

Temperature isn’t reading? Make sure the DHT sensor is properly connected and powered.

Servo isn’t moving? Give it a pep talk (or check its power and connections).

Tape It Up

IMG_0895.jpg

Attach the servo to the switch, ensuring that when it gets too cold, it will turn on your heater, and switch it off when it gets too hot

Sit Back and Enjoy! ☕🔥

IMG_0896.jpg

Congratulations! You have successfully created an automatic heater system that probably works better than your landlord’s heating system.

Now, bask in the warmth of automation and flex your project to your friends. Bonus points if you name it something ridiculous like "Heat-O-Matic 9000."

Happy coding and stay warm! 😆🔥