Introduction: 220V Motor With ESP32 and WEG Contactor

About: Do you like technology? Follow my channel on Youtube and my Blog. In them I put videos every week of microcontrollers, arduinos, networks, among other subjects.

As my videos almost always involve small engines, today I decided to do something different. We’ll work with a bigger motor: 220 volts AC 6a! The motor we’ll be working with today is one that I removed from a Whirlpool. To activate this power motor, we will need a contactor and an ESP32 LoRa. In this case, we’ll use a WEG contactor. I really like this brand a lot. I’ll teach about contactors and their relevant characteristics. Also, I’ll discuss triggering a contactor to activate and deactivate an AC motor.

Step 1: Demonstration

· One ESP WiFi LoRa 32

· One CWM25 WEG contactor

· One single-phase 1 / 2CV motor (or other compatible load)

· One dual relay module

· One USB cable for ESP

· Connection wires



Step 2: What Is a Contactor?

A contactor is a switching device. It is very similar to a relay in its operation.

They are mainly applied in high power load wiring.

They can be used in AC or DC circuits. They allow three-phase control applications.

They allow the control of the remote commutation, as well as the relays, and the isolation of the control circuit of the controlled (power) circuit.

Step 3: Operation

To exemplify the operation of a contactor, we will show the internal parts of one that we have available here.


Internally, the contactor has a core of ferromagnetic material, divided into two parts. These include the lower portion (fixed in the housing) and the upper portion (fixed in the movable contacts).

The fixed contacts are attached to the housing.

The two portions are held and spaced apart by a spacer spring.

A coil (attached to the housing, and encloses the lower portion of the core) is responsible for moving the upper portion of the core by producing a magnetic field when driven by a current.

By attracting the upper portion of the core, the movable contacts are also moved relative to fixed contacts, and the opening or closing of the contacts.

Step 4: Disassembled Contactor

Step 5: Electric Scheme

Step 6: Source Code

#Includes and #Defines and global variables

//Bibliotecas para utilização do display oLED
#include // Necessário apenas para o Arduino 1.6.5 e posterior #include "SSD1306.h" // o mesmo que #include "SSD1306Wire.h" //Os pinos do OLED estão conectados ao ESP32 pelos seguintes GPIO's: //OLED_SDA -- GPIO4 //OLED_SCL -- GPIO15 //OLED_RST -- GPIO16 #define SDA 4 #define SCL 15 #define RST 16 //RST deve ser ajustado por software SSD1306 display(0x3c, SDA, SCL, RST); //Instanciando e ajustando os pinos do objeto "display" boolean ESTADO = false;

Setup ()

void setup() {
pinMode(23, OUTPUT); // Inicia o display display.init(); //Vira a tela verticalmente display.flipScreenVertically(); display.clear(); //ajusta o alinhamento para a esquerda display.setTextAlignment(TEXT_ALIGN_LEFT); //ajusta a fonte para Arial 16 display.setFont(ArialMT_Plain_16); }


void loop() {
//Limpa o buffer do display display.clear(); //de acordo com o valor da variável ESTADO //escreve "LIGADO"ou "DESLIGADO" no buffer if (ESTADO) { display.drawString(0, 0, "DESLIGADO"); } else { display.drawString(0, 0, "LIGADO"); } //mostra no display o ESTADO display.display(); //ajusta o pino 23 de acordo com o valor de ESTADO digitalWrite(23, ESTADO); //Aguarda o 3s antes da inversão delay(3000); //inverte o estado da variável ESTADO ESTADO = !ESTADO; }

Step 7: Ranking

An important parameter in choosing a contactor is its rating.

This follows the standard of the International Electrotechnical Commission (IEC), or simply IEC.

The standard that defines the classification of the contactors is IEC 60497-4.

The classification is based on the type of load to be controlled and under which conditions the switching can / should be performed, including braking and reverse direction.

Step 8: AC Classification - Summary

AC-1: Loads with a power factor greater than or equal to 0.95. This is basically for resistive loads.

AC-2: Starting, braking, or impulse starting of collector-ring motors. Starting currents of these systems are approximately 2.5 times the nominal current.

AC-3: Used in the drive of cage motors. Starting currents are from 5 to 7 times the nominal current, and with voltage up to 20% of the main voltage appearing at the terminals when the engine is still running.

(Cage motors in the most common applications.)

AC-4: Used when driving cage motors or rings. Starting currents are 5 to 7 times the rated current. By interrupting the current, the voltage can reach the main voltage.

(crane-overhead motors, lathes ...)

AC-5a: Electric discharge lamps

AC-5b: Incandescent lamps

AC-6a: Transformers

AC-6b: Capacitor Bank

AC-7a: Low inductive loads on household appliances

AC-7b: Engines for household applications

AC-8a and b: Hermetic compressors with manual and automatic reset, respectively

Step 9: DC Classification - Summary

DC-1: All DC circuits with time constant L / R less than or equal to 1ms. (More resistive and less inductive circuits)

DC-3: Startup, braking, and pulse-drive of shunt motors, with time constant (L / R) less than or equal to 2ms. The drive current is 2.5 times the nominal motor voltage. In the opening, it must support a current equal to the drive and a voltage equal to that of the network.

DC-5: Startup, braking, and pulse-drive of series motors, with time constant (L / R) less than or equal to 7.5ms.

DC-6: Incandescent and LED lamps.

Step 10: Choice of Contactor

When choosing a contactor for a particular function, it is important to take into consideration:

- Your rating

- Its voltage and current of operation, as well as its limits.

- The drive voltage of the contactor (24V, 127V, 220V, etc)

- The amount of keys available.

- The normal state of the keys (normal open or normal closed)


Step 11: Other Accessories

This circuit serves only as an example of application. For added safety and stability of the circuit, some accessories may be relevant. Two that can be very useful are:

Surge Suppressors: prevents the surge created by the contactor drive coil from propagating through the power transmission line.

Thermal relay: detects motor overload or a missing phase. It works by using a bimetallic pair that heats up with increasing current. If the current is above the value, the circuit will be interrupted and a reset will be necessary.

Step 12: Files

Download the files