VFD for single phase IM square wave 90 deg shift

Good Day to all Gurus,

I found this neat and short sketch Arduino 3 Phase Motor Controller - Dave Hakkens for 3-phase-motor. Unfortunately the site is temporarily close and the author is no where to find.

void setPhase(unsigned char ph);
void advancePhase(char dir);

const unsigned char AHPin = 12;
const unsigned char ALPin = 6;
const unsigned char BHPin = 11;
const unsigned char BLPin = 5;
const unsigned char CHPin = 10;
const unsigned char CLPin = 4;
const unsigned char delayPin = A0;

char currentPhase = 0;
char motorDirection = 1;
unsigned long previousDelay = 0;

const unsigned char phaseStates[6]{
B011000,
B010010,
B000110,
B100100,
B100001,
B001001
};

void setPhase(unsigned char ph){
unsigned char phase = phaseStates[ph];
digitalWrite(AHPin, (phase & B100000) >> 5);
digitalWrite(ALPin, (phase & B010000) >> 4);
digitalWrite(BHPin, (phase & B001000) >> 3);
digitalWrite(BLPin, (phase & B000100) >> 2);
digitalWrite(CHPin, (phase & B000010) >> 1);
digitalWrite(CLPin, phase & B000001);
}

void advancePhase(char dir){
currentPhase += dir;
if(currentPhase > 5){
currentPhase = 0;
}else if(currentPhase < 0){
currentPhase = 5;
}
}

void setup(){
pinMode(AHPin, OUTPUT);
pinMode(ALPin, OUTPUT);
pinMode(BHPin, OUTPUT);
pinMode(BLPin, OUTPUT);
pinMode(CHPin, OUTPUT);
pinMode(CLPin, OUTPUT);
pinMode(delayPin, INPUT);
}

void loop(){
long delay = map(analogRead(delayPin), 0, 1024, 0, 100000);
if(micros() - previousDelay <= delay) { return; }
previousDelay += delay;

advancePhase(motorDirection);
setPhase(currentPhase);

}

I tested the sketch using UNO ATMEGA328 and it works perfectly fine.

I managed to change the binary pattern and the frequency range to suit my Single Phase VFD intention.

My question now is I cant find which function to edit to change the phasing from 120 to 90 deg.

I appreciate very much If you guys can assist me in pointing/editing the right function to change the 120 to 90 deg.

Thanks and keep safe ...

Joey

You can't have a 'phase difference' with a single phase. Did you mean a two-phase VFD?!?

To switch from 3-phase to 2-phase, switch from 6 phase states to 4 phase states. Then cycle through the 4 phase states.

Hi johnwasser,

Sorry for not elaborating on the detail of my intention.
My goal is to drive a Single phase PSC motor by 2 phase VFD but 90 deg phase shift only instead of 120.
It will be Common, Start and Run (capacitor removed). So I need two squarewave outputs 90 deg apart.
I can reuse the sketch given provided I can change the phase difference to 90 deg.

I appreciate it very much if anybody here can tell me which routine (function) to edit to change the 120 to 90 deg.

Thanks and keep safe...

Joey

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.