Project tutorial
Universal Power Variator

Universal Power Variator © GPL3+

This project is a continuous variator of supplied power for power tools, lights or heating. Works universally for AC or DC power supplies.

  • 1,589 views
  • 0 comments
  • 14 respects

Components and supplies

male main power plug
×1
female main power plug
×1
600V CoolMos C7 Gold
×2
A000066 iso both
Arduino UNO & Genuino UNO
×1

About this project

This project is a continuous variator of supplied power for 220V/110V power tools, lights or heating. It works for AC as well as for DC power supply, that is why it is named Universal. Compared to existing built-in speed variator if the power tool has one, our solution using 600V CoolMos C7 makes less EMI and noise. Moreover, it works for controlling AC or DC power supply with the same hardware. It is useful because of you can add new functionaliies to low-end electrical equipment.

To vary the supplied power, two 600V CoolMos C7 are tied back-to-back, then together are put in series with the load. The pack of two CoolMos C7 controls the supplied power by controlling the supplied current. The pack in turn is controlled by an Arduino which PWM modulates the supply current passing through the two CoolMos C7.

The circuit and components are not galvanic isolated. Using a Wireless shield this power variator can be remotely controlled.

One use case is to vary the speed of low-end power tools such as drills, saws, and which don't have speed variation. Many times, we would need the tool to run at lower speed to avoid damaging the part we are working on, or sometimes just to reduce the noise for neighbors.

Another use case is to fine tune the electrical heater's temperature, and automatically switch it on/off depending on the ambient temperature.

Another use case is to control a fan's speed and stop it as a function of ambient temperature.

Code

Varying DC power supplyArduino
This code periodically and endlessly increase then decrease the supplied DC power. When used on AC power, only half of the cycle is passed, consequently the max power is only half of the max of supplied power.
int G1 = 9;           // the PWM pin connected to gate of CoolMos-1
int G2 = 6;           // the PWM pin connected to gate of CoolMos-2
int S = 7;            // the digital out of '0' connected to the Driver Source of both CoolMos-1,2
int brightness = 0;   // how much power on the load (e.g. lamp)
int increase = 5;     // how many points to increase the power by

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9/6/7 to be an output:
  pinMode(G1, OUTPUT);
  pinMode(G2, OUTPUT);
  pinMode(S, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  G2 = 0;
  S=0;
  
  // set the brightness of pin 9:
  analogWrite(G1, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + increase;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness <= 0 || brightness >= 255) {
    increase = -increase;
  }
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}
Varying AC power supplyArduino
This code cycles the supplied power between minimum and maximum with one incrementation or decrementation per second
int G1 = 9;           // the PWM pin D9 connected to gate of CoolMos-1
int G2 = 6;           // the PWM pin D6 connected to gate of CoolMos-2
int S = 7;            // D7 with '0'level is connected to the Driver Source of both CoolMos-1,2
int LINE = 0; // Analog input A0 is used to sense zero crossing
int brightness = 0;   // how much power on the load (e.g. lamp)
int increase = 5;     // how many points to increase the power by
int ac = 0;           // 0: negative half-cycle;  1: positive half-cycle
float v=0;
int cmd = 1;          // current command to turn on or off the power. 1: turn-on; 0: turn-off.
int newcmd = 1;       // new command to turn on or off the power. 1: turn-on; 0: turn-off.

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9/6/7 to be an output:
  pinMode(G1, OUTPUT);
  pinMode(G2, OUTPUT);
  pinMode(S, OUTPUT);
  pinMode(LINE, INPUT);

  G1 = 0;
  G2 = 0;
  S=0;

}

void turnOff() {
    G1 = 0;
    G2 = 0;
    S=0;  
}

void turnOnNextCycle() {
  // wait for zerocrossing
  if (ac=0) { // currently in negative cycle
    while (v<0.5) {
      v = analogRead(LINE)*5.0/1024.0;
      if (v<0.5) continue;  // no crossing
      delay(1); // 1ms
      v = analogRead(LINE)*5.0/1024.0;
      if (v<0.5) continue;  // no crossing
      break; 
    }
    ac = 1; // zero crossed, now in positive cycle
  } else { // currently in positive cycle
    while (v>=0.5) {
      v = analogRead(LINE)*5.0/1024.0;
      if (v>=0.5) continue;  // no crossing
      delay(1); // 1ms
      v = analogRead(LINE)*5.0/1024.0;
      if (v>=0.5) continue;  // no crossing
      break; 
    }    
    ac = 0; // zero crossed, now in negative cycle
  }

  if (ac == 1) {
    // pulse on G1
    analogWrite(G1, brightness);
    G2 = 0;
  } else {
    // pulse on G2
    analogWrite(G2, brightness);
    G1 = 0;    
  }
}
// the loop routine runs over and over again forever:
void loop() {
  int cntAcCycles = 0;
  if (newcmd != cmd) { // command has changed. Initialization.
    G1 = 0;
    G2 = 0;
    S=0;
    ac = 0;           // 0: negative half-cycle;  1: positive half-cycle
    v=0;
  }
  if (cmd == 1) {
    turnOnNextCycle();
    // change the brightness every second: 50 cycles per second for 50Hz
    if (++cntAcCycles > 50) {
      cntAcCycles = 0;
      brightness = brightness + increase;
      // reverse the direction of the fading at the ends of the fade:
      if (brightness <= 0 || brightness >= 255) {
        increase = -increase;
      }  
    }
  } else if (cmd == 0) {
    turnOff();
  } 

}

Schematics

How to switch DC ON
Principle for switching DC ON
How to switch dc on oyzcvrliqg
coolMos pinout
The pin-out is referenced in electronics schematics
Coolmos pinout unwtjdevsy
schematics of power variator
overall schematics of the project
Schematics of power variator 5fqnrwqmrb
How to switch AC ON - positive half-cycle
principle of conduction during AC positive half-cycle
How to switch ac on positive llcwniy8ua
How to switch AC ON - negative half-cycle
principle of conduction during AC negative half-cycle
How to switch ac on neg nskpv2uv02
zero crossing detection
principle of zero crossing detection on AC
Zero crossing detection emwmpxy1h9

Comments

Similar projects you might like

Home Automation with Self-learning 433 Power Switches

Project tutorial by WJ4IoT

  • 2,094 views
  • 0 comments
  • 11 respects

Low Power RF Beacon for Remote Sensing & Communication

Project tutorial by Shahariar

  • 2,142 views
  • 1 comment
  • 16 respects

Take Control Over Lego Power Functions

Project tutorial by Patrick Müller

  • 45,136 views
  • 3 comments
  • 66 respects

Windows IOT - Automate your power outlets

Project tutorial by Syed Sanoor

  • 22,136 views
  • 13 comments
  • 48 respects

DIY Universal CNC Machine

Project tutorial by Arduino “having11” Guy

  • 18,043 views
  • 5 comments
  • 74 respects

Arduino Power

Project tutorial by craic

  • 9,331 views
  • 6 comments
  • 37 respects
Add projectSign up / Login