Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano Temperature-Controlled Heating System with OLED Display

View and Edit Project In Cirkit DesignerImage of Arduino Nano Temperature-Controlled Heating System with OLED Display

Circuit Documentation

Summary

This circuit is designed to monitor temperature using an LM35 temperature sensor and display the temperature on a 0.96" OLED display. Additionally, it controls a heating element using an IRFZ44N MOSFET. The circuit is managed by an Arduino Nano microcontroller.

Component List

  1. Arduino Nano

    • Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
    • Pins: D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, GND, D13, 3V3, AREF, A0, A1, A2, A3, A4 (SDA), A5 (SCL), A6, A7, 5V, RST, VIN, RX0, TX1, 13, 11, 12
  2. 0.96" OLED Display

    • Description: A small OLED display module for displaying text and graphics.
    • Pins: GND, VDD, SCK, SDA
  3. Temperature Sensor (LM35)

    • Description: An analog temperature sensor that outputs a voltage proportional to the temperature.
    • Pins: +Vs, Vout, GND
  4. Temperature Sensor

    • Description: A digital temperature sensor with a single-wire interface.
    • Pins: Temp GND (Black), Temp VDD (Red), Temp DQ (Data Yellow)
  5. PTC

    • Description: A positive temperature coefficient thermistor used for overcurrent protection.
    • Pins: Neutral, Live
  6. IRFZ44N MOSFET

    • Description: A power MOSFET used for switching and amplifying electronic signals.
    • Pins: Gate, Drain, Source
  7. Resistor

    • Description: A 10k Ohm resistor used for current limiting.
    • Pins: pin1, pin2
    • Properties: Resistance = 10k Ohms

Wiring Details

Arduino Nano

0.96" OLED Display

Temperature Sensor (LM35)

Temperature Sensor

PTC

IRFZ44N MOSFET

Resistor

Code Documentation

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

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET    -1  // Reset pin not used
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int tempPin = A0;  // LM35 analog pin
int mosfetPin = 9; // MOSFET control pin
float temp;        // Variable to store temperature

void setup() {
  pinMode(mosfetPin, OUTPUT);
  Serial.begin(9600);

  // Initialize OLED display
  if (!display.begin(0x3C, true)) { // Default I2C address 0x3C
    Serial.println("OLED initialization failed!");
    while (true); // Stop if display isn't found
  }
  display.clearDisplay();
  display.display();
}

void loop() {
  int sensorValue = analogRead(tempPin);
  temp = sensorValue * (500.0 / 1023.0); // Convert to °C

  // Heating control
  bool heating = false;
  if (temp < 20) {
    digitalWrite(mosfetPin, HIGH); // Turn on heating
    heating = true;
  } else {
    digitalWrite(mosfetPin, LOW); // Turn off heating
    heating = false;
  }

  // Display data on OLED
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);

  display.setCursor(0, 0);
  display.print("Temp: ");
  display.print(temp);
  display.println(" C");

  display.setCursor(0, 10);
  display.print("Heating: ");
  display.println(heating ? "ON" : "OFF");

  display.display();

  delay(1000); // 1-second delay
}

This code initializes the OLED display and reads the temperature from the LM35 sensor. It controls the heating element using the IRFZ44N MOSFET based on the temperature reading. The temperature and heating status are displayed on the OLED screen.