🛠 Commander une charge 230 V avec un relais de sortie
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
- Arduino Opta powered by 24 VDC (USB-C cannot power the relays)
- A load: 230 V bulb, test resistor, or contactor coil
- Fuse holder + appropriately rated fuse in series with the load (mandatory)
- Suitable power wire, tester
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
- No external fuse: The Opta has NO internal relay protection; a short circuit will destroy the contact. Size the fuse according to the load.
- Relay overload: 10 A max resistive, and only 10,000 cycles at this level; for a motor or inductive load (AC15 500 VA), use a contactor and limit the switching frequency.
- Forgetting the minimum load: Below 300 mW (5 V / 5 mA), the contact may become sulfated and fail to conduct current.
- Connecting 230 V to an input terminal: Check the terminal three times. OUTPUT1..4 = relays, I1..I8 = inputs only.
Other tutorials for this board
- Premier sketch : faire clignoter une LED sur Arduino Opta
- Lire une entrée numérique 24 V (capteur de proximité)
- Server Modbus TCP : exposer les relais sur Ethernet
- Lire un capteur analogique 0–10 V sur les entrées Opta
- Remonter des données machine en MQTT via Ethernet
- Exploiter le double cœur : M7 pour le PLC, M4 en coprocesseur
Code examples for this board
relais_securise.inoArduinoentrees_numeriques.inoArduinoanalogique_0_10v.inoArduinomodbus_tcp_esclave.inoArduinomodbus_rtu_maitre.inoArduinomqtt_telemetrie.inoArduino