Advertisement
Intermediate Time: 2–3 weeks Electrical Engineering

Automatic Transfer Switch (ATS)

Build an automatic transfer switch that switches between mains and generator power within seconds during outages.

ATSGeneratorMains SupplyContactorRelayPower Backup
DifficultyIntermediate
Duration2–3 weeks
Components10 items
Steps7 steps

Introduction

Build an automatic transfer switch that switches between mains and generator power within seconds during outages. This comprehensive guide covers everything from design through implementation, testing, and deployment.

Theory & Background

An ATS monitors the main supply continuously. When mains voltage falls below threshold (typically <180V or >270V) for more than 3 seconds, the ATS: (1) opens the mains contactor, (2) sends auto-start signal to the generator, (3) waits for generator to reach stable voltage and frequency, (4) closes the generator contactor. On mains restoration, the reverse sequence executes with a time delay to confirm supply stability.

Advertisement

Components & Requirements

10 components required for this project.

#ComponentPurposeQty
1Arduino UnoATS control logicx1
22-Pole 40A ContactorMains and generator switching (interlocked)x2
3ZMPT101B Voltage SensorMains and generator voltage monitoringx2
45V 5A Relay Module (4-channel)Contactor coil control and generator signalsx1
5LCD 16×2 with I2CStatus and timer displayx1
6MOFSET Driver Module (IRF540N)Driving contactor coils from Arduinox2
724V DC Power SupplyControl circuit power (isolated)x1
8Buzzer 5VAlarm for mains failure and transferx1
9DIN Rail Enclosure (8-module)Professional panel mountingx1
10Mechanical Interlock KitPrevent simultaneous mains+generator connectionx1

Step-by-Step Implementation

Follow these 7 steps carefully.

1
Understanding ATS Operation Principle

An ATS monitors the main supply continuously. When mains voltage falls below threshold (typically <180V or >270V) for more than 3 seconds, the ATS: (1) opens the mains contactor, (2) sends auto-start signal to the generator, (3) waits for generator to reach stable voltage and frequency, (4) closes the generator contactor. On mains restoration, the reverse sequence executes with a time delay to confirm supply stability.

2
Electrical Interlock Design

The most critical safety feature is the mechanical and electrical interlock preventing both contactors from closing simultaneously — connecting mains and generator together would be catastrophic. Mechanical interlock: use a physical interlock kit between the two contactors (they mechanically prevent each other from closing). Electrical interlock: wire each contactor's NC (normally closed) auxiliary contact in series with the other contactor's coil circuit.

3
Voltage and Frequency Monitoring

Sample mains and generator voltages using two ZMPT101B sensors on Arduino analog inputs. Calculate RMS voltage using the Emonlib approach or direct zero-crossing timing. Set trip thresholds: undervoltage < 180V, overvoltage > 270V, for Indian 230V supply. Also monitor frequency by timing between zero-crossings: 1/(2 × time_between_ZC). Alert if frequency deviates beyond 48–52 Hz.

4
Generator Auto-Start Interface

Most generators with electric start have a remote start interface: connecting two pins triggers auto-crank. Wire a relay output from Arduino to this interface. On mains failure detection, activate the relay for 3–5 seconds (crank time) then release. Monitor generator voltage sensor — if generator reaches >200V within 30 seconds, declare generator ready. If not, retry crank up to 3 times before raising a fault alarm.

5
Transfer Sequence Programming

Implement a state machine: MAINS_NORMAL → MAINS_FAULT_DETECTED (3s delay) → GENERATOR_STARTING (30s timeout) → GENERATOR_STABLE (2s confirm) → TRANSFERRED_TO_GENERATOR → [mains restored] → MAINS_RESTORED_DETECTED (10s stability confirm) → RETRANSFER_TO_MAINS → MAINS_NORMAL. All transitions must be logged with timestamp and reason.

6
Load Shedding Logic (Optional)

For large generators where not all loads can run simultaneously, implement load shedding. Define load priority levels 1–4 in code. On generator mode, energize only priority-1 and priority-2 loads initially. If generator is running at <80% capacity for 5 minutes, add priority-3 loads. This prevents generator overload during cold start when torque capacity is limited.

7
Testing Procedures

Test by manually cutting mains power with a switch while monitoring LCD and measuring voltages with a multimeter. Verify: transfer time < 10 seconds (generator start + stable + transfer), mechanical interlock prevents simultaneous closure, voltage thresholds trigger correctly, generator auto-start cranks and starts, retransfer occurs with proper delay after mains restoration, and all events are logged.

Code & Implementation

Core code for ats_controller.ino:

ats_controller.ino C/C++
// ATS State Machine Controller enum ATSState { MAINS_OK, MAINS_FAULT, GEN_STARTING, GEN_STABLE, ON_GENERATOR, RETRANSFER }; ATSState state = MAINS_OK; unsigned long stateTimer = 0; int genStartAttempts = 0;  #define MAINS_CONTACTOR   7 #define GEN_CONTACTOR     8 #define GEN_START_RELAY   9 #define BUZZER_PIN        6  float readVoltage(int pin) {      return analogRead(pin) * (230.0 / 512.0); }  void loop() {   float mainsV = readVoltage(A0);   float genV   = readVoltage(A1);   unsigned long now = millis();    switch(state) {     case MAINS_OK:       if (mainsV < 180 || mainsV > 270) {         if (now - stateTimer > 3000) { state = MAINS_FAULT; stateTimer = now; tone(BUZZER_PIN, 1000, 500); }       } else { stateTimer = now; }       break;      case MAINS_FAULT:       digitalWrite(MAINS_CONTACTOR, LOW);          digitalWrite(GEN_START_RELAY, HIGH);         state = GEN_STARTING; stateTimer = now; genStartAttempts++;       break;      case GEN_STARTING:       if (genV > 200) { state = GEN_STABLE; stateTimer = now; digitalWrite(GEN_START_RELAY, LOW); }       else if (now - stateTimer > 30000) {         if (genStartAttempts < 3) { state = MAINS_FAULT; }          else {  }       }       break;      case GEN_STABLE:       if (now - stateTimer > 2000) { digitalWrite(GEN_CONTACTOR, HIGH); state = ON_GENERATOR; }       break;      case ON_GENERATOR:       if (mainsV > 200 && mainsV < 260) {         if (now - stateTimer > 10000) { state = RETRANSFER; stateTimer = now; }       } else { stateTimer = now; }       break;      case RETRANSFER:       digitalWrite(GEN_CONTACTOR, LOW);       delay(500);       digitalWrite(MAINS_CONTACTOR, HIGH);       genStartAttempts = 0;       state = MAINS_OK; stateTimer = now;       break;   } }

Testing & Troubleshooting

Test Automatic Transfer Switch (ATS) by verifying each subsystem individually before full integration.

!
Troubleshooting Tips

Verify power voltages, check ground connections, use serial monitor for debug.

Real-World Applications

*Residential home power backup
*Hospital emergency power
*Data center backup power
*Telecom tower site backup
*Industrial process continuity
*Commercial retail loss prevention
*Water pumping station backup
*Rural microgrid management

Extensions & Next Steps

  • Add synchronization for closed-transition transfer to eliminate even momentary outage
  • Implement 3-source ATS: mains, solar inverter, and generator
  • Add GSM module to send SMS alerts on mains failure and restoration
  • Log all transfer events to SD card with voltage and frequency records
  • Add load monitoring to auto-shed non-critical loads on generator to prevent overload

Interactive Playground

Coming Soon

An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.

Frequently Asked Questions

What is the typical transfer time for an ATS?
Transfer time is the interval from mains failure detection to generator power delivery to loads. It consists of: fault detection delay (1–5 seconds — to avoid nuisance trips from momentary dips), generator crank and warm-up (10–30 seconds for diesel/petrol generators, 3–10 seconds for gas generators), and contactor switching (0.1–0.5 seconds). Total: 15–60 seconds. Critical systems requiring < 0.5 second transfer use UPS as a bridge.
What causes nuisance tripping in an ATS system?
Nuisance tripping occurs when ATS transfers to generator due to momentary voltage dips from heavy load startup (motor inrush currents, welding equipment), utility switching transients, or lightning-induced voltage spikes. Prevention: implement a 2–5 second confirmation delay before declaring mains failed, set voltage thresholds with hysteresis (trip below 180V, reset above 195V), and add a surge filter on the voltage sensing circuit.
Can I connect the generator and mains simultaneously?
Absolutely not. Connecting mains and generator simultaneously without synchronization will result in massive fault currents, potentially destroying both the generator alternator and the utility transformer. The phase angle difference between unsynchronized sources causes near-short-circuit currents. This is why the mechanical and electrical interlock in the ATS design is the most critical safety feature.
How do I size the ATS contactors for my generator?
Size contactors based on generator rated current: for a 5kVA generator at 230V single-phase, rated current = 5000/230 = 21.7A. Use 25A or 32A contactors (next standard size up, with 25% safety margin). For three-phase generators, calculate per-phase current = kVA / (1.732 × 400V). Always use AC-3 duty-rated contactors designed for inductive load switching, not AC-1 rated for resistive loads.
What is the difference between open transition and closed transition ATS?
Open transition (make-before-break): the supply is momentarily interrupted during transfer — loads experience a brief power outage of 0.1–2 seconds. This is standard for residential and commercial ATS. Closed transition: both sources are briefly connected simultaneously (requires synchronization of voltage, frequency, and phase angle) for seamless transfer with zero interruption. Closed transition requires much more sophisticated control and is used for critical hospital/data center systems.
Advertisement