🛠 Commander une charge 230 V avec un relais de sortie

Arduino Opta (micro PLC, STM32H747) · debutant · Schéma : IMG-opta-plc-debutant-3-opta-sortie-relais.svg — sortie OUTPUT1 de l'Opta en contact NO commandant un contacteur de moteur 230 V protégé par un fusible externe avec le schéma de puissance

Objectives

Control a power load via the Opta's 4 relay outputs. Each relay is a NO (SPST) contact rated 10 A / 250 VAC (up to 400 VAC), with a 6 ms operate time, 3 ms bounce time, and a mechanical life of 10 million cycles. The critical point: there is no internal protection against short circuits, so an external fuse is mandatory.

Hardware

Complete code

// opta_sortie_relais.ino — cycle de test sur OUTPUT1 (RELAY1, broche D0)

const int CHARGE = RELAY1; // OUTPUT1 : contact NO 10 A / 250 VAC

void setup {
  Serial.begin(9600);
  pinMode(CHARGE, OUTPUT);
  digitalWrite(CHARGE, LOW); // defaut securise : contact ouvert
}

void loop {
  digitalWrite(CHARGE, HIGH); // fermeture du contact
  Serial.println("CHARGE ON");
  delay(2000);
  digitalWrite(CHARGE, LOW);  // ouverture
  Serial.println("CHARGE OFF");
  delay(2000);
}

Expected verification

You will hear the relay click every 2 seconds, and the load will turn on/off. The serial monitor reports the state. The contact at rest (default) must be open: this is the safe mode.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials