ESP32 SSR Heater Control — Esp32 Devkit C V4 simulation

ESP32 controlling SSR and heater with AC power supply

An interactive Esp32 Devkit C V4 circuit simulation you can run free in your browser on Velxio, by wijeramanugegoda4.

Components

Sketch code

#define SSR_PIN 13

String command = "";

void setup() {
  Serial.begin(115200);

  pinMode(SSR_PIN, OUTPUT);

  // Start with the AC load disconnected
  digitalWrite(SSR_PIN, LOW);

  Serial.println("ESP32 SSR Control");
  Serial.println("Type 'cut' to disconnect AC");
  Serial.println("Type 'reconnect' to restore AC");
}

void loop() {
  if (Serial.available()) {
    command = Serial.readStringUntil('\n');
    command.trim();
    command.toLowerCase();

    if (command == "cut") {
      digitalWrite(SSR_PIN, LOW);
      Serial.println("AC disconnected");
    }
    else if (command == "reconnect") {
      digitalWrite(SSR_PIN, HIGH);
      Serial.println("AC reconnected");
    }
    else {
      Serial.println("Invalid command");
      Serial.println("Type cut or reconnect");
    }
  }
}

More projects by wijeramanugegoda4