Automatic Voltage Regulator for AC alternator

Can be used to replace old AVR regulator for AC 3 phase alternator.

Similar projects worth following
It is powered by 130V tap on one phase of the alternator. It will use phase regulation with triac, arduino, some diode bridges and three voltage measurement transformers 220/24V 2W. Not decided yet if i use PID or incr./decr. algorythm.

I needed to replace old voltage regulator for my old diesel generator, that i bought very cheap in a bad shape as something to play with. I tried to repair the old regulator, but after tens of loose contact repairs, bad component replacements i gave it. It was destroyed by mice, corrosion, vibrations and previous owner's attemts to repair it.

The new regulator will be as simple as possible and easier to diagnose, repair and adjust. I plan to add functions like throttle control, oil watch, etc., but only after correct voltage regulation.

  • 1 × arduino micro Why? because i can buy this more cheap from ebay than any other processor (only the IC) locally.
  • 1 × MOC3021P optotriac - no zero crossing detection, so it can switch on anytime
  • 1 × BTA16 800BW Discrete Semiconductors / Thyristors (DIACs, SIDACs, TRIACs, SCRs)
  • 1 × T6 220/24V 2W transformer for signallling lightbulb
  • 1 × KBPC2510 Discrete Semiconductors / Diode Arrays

View all 6 components

  • Project change

    Michael Skrepsky01/01/2017 at 14:14 0 comments

    I have sold the generator (with both old and new regulator), because it occupied too much space and i got bored with it. But i don't scrap the project, because i have old stationary diesel engine and i got 1kW single phase alternator without regulator, so i will change everything to suit that.

  • Mechanical/electrical construction finished

    Michael Skrepsky08/08/2015 at 21:28 0 comments

    It works!!! But it oscillates with about 1s period from 250V to 400V (phase to phase) or regulates only partially, reaching 500V. I need to make frequency compensation and protection, and replace temporary incremental algorythm with PID or something better. I will take a notebook to it and make it throw values through serial/USB. If it does not work, i would make basic ON/OFF regulation.

    Relay is now switched off by software. Will update schematic after finished.

    The temporary test code (that has fixed oscillation, but regulates poorly):

    // experimental AC alternator voltage controller
    // Uses AC Control V1.1
    #include <avr/io.h>
    #include <avr/interrupt.h>
    #define DETECT 2  //zero cross detect
    #define GATE 9    //triac gate
    #define PULSE 5   //trigger pulse width (counts)
    #define VOLTPIN A0//voltage measurement
    #define LEDPIN 13
    int i=450;
    int voltage = 0;  // variable to store the value coming from the sensor
    unsigned long oldtime;
    unsigned long time;
    void setup(){
      // set up pins
      pinMode(DETECT, INPUT);     //zero cross detect
      digitalWrite(DETECT, HIGH); //enable pull-up resistor
      pinMode(GATE, OUTPUT);      //triac gate control
      // set up Timer1 
      //(see ATMEGA 328 data sheet pg 134 for more details)
      OCR1A = 100;      //initialize the comparator
      TIMSK1 = 0x03;    //enable comparator A and overflow interrupts
      TCCR1A = 0x00;    //timer control registers set for
      TCCR1B = 0x00;    //normal operation, timer disabled
      // set up zero crossing interrupt
      attachInterrupt(0,zeroCrossingInterrupt, RISING);    
        //IRQ0 is pin 2. Call zeroCrossingInterrupt 
        //on rising signal
      // initialize serial communication at many bits per second:
    //Interrupt Service Routines
    void zeroCrossingInterrupt(){ //zero cross detect   
      TCCR1B=0x04; //start timer with divide by 256 input
      TCNT1 = 0;   //reset timer - count from zero
      // read the input on analog pin 0:
      voltage = analogRead(VOLTPIN); // synchronous voltage measurement to prevent ripple
      if (voltage > 640) i=i+5; // emergency voltage decrease (does not work)
      time = millis() - oldtime;
      oldtime = millis(); // period (frequency) measurement for future compensation of generator revs/min change
    ISR(TIMER1_COMPA_vect){ //comparator match
      digitalWrite(GATE,HIGH);  //set triac gate to high
      TCNT1 = 65536-PULSE;      //trigger pulse width
    ISR(TIMER1_OVF_vect){ //timer1 overflow
      digitalWrite(GATE,LOW); //turn off triac gate
      TCCR1B = 0x00;          //disable timer stopd unintended triggers
    void loop(){ // code
    if (voltage > 620) i=i+1; // decrease phase
    if (voltage < 580) i=i-1; // increase phase
    if (i > 600) i = 600; //limit
    if (i < 300) i = 300; //limit
    OCR1A = i;     //set the compare register phase desired.
    //if (i<300){i=550;}                      
      // print out the value you read:
      Serial.print(time); // write period of AC
      Serial.print("   ");
      Serial.print(i); // write phase
      Serial.print("   ");
      //Serial.println((10*voltage)/205); // 10*voltage in volts
      Serial.println(voltage); // voltage in ADC units - / 1024 * 5

  • baseplate

    Michael Skrepsky08/06/2015 at 21:03 0 comments

    baseplate completed, voltage transformers and connector installed.

View all 3 project logs

  • 1
    Step 1

    1) find 3 same voltage transformers

  • 2
    Step 2

    2) build the baseplate with connector

  • 3
    Step 3

    3) buy the components, prototype board, and solder it

View all 7 instructions

Enjoy this project?



asingejack wrote 02/23/2019 at 12:20 point

This an interesting project. I am currently working on something similar. I want to stabilize voltage and frequency of an alternator. I envisage to use Arduino uno r3 as a microcontroller. The aim of the project is to built a controller that is is able to quickly respond to load variation and system parameters changes. I am planning to use fuzzy logic as algorithm for the microcontroller. Would you please share with me, how you succeeded to implement yours? What are challenges you encountered? I am also available at

  Are you sure? yes | no

henriquedede wrote 01/28/2016 at 18:23 point

good project

  Are you sure? yes | no

ben.phenoptix wrote 08/07/2015 at 21:15 point

Looks like a solid start! Keep sharing please!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates