We've just launched our map. Add yourself by clicking here!

close

Arduino 3 Phase Motor Controller

This topic contains 9 replies, has 7 voices, and was last updated by  Klaus 3 months ago.

1
Ivan Jakesevic ivan82

Arduino 3 Phase Motor Controller

17/01/2018 at 23:56

DC current as input, so the motor can be powered by using solar panels or batteries.
Note that the Motor Driver HI/LO chips are missing.
Motor drivers should be placed between the Arduino output and the mosfet gate.
And there are no diodes to protect the Arduino output pins, and no resistors on the mosfet gate pins (these components should be added).

3 Phase Motor Controller


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);
}
Attachments:
9 replies
0 subscribers
0 saved
1 likes
sort on most likes
dedicated
18/01/2018 at 11:48
5

is this for arduino uno board (like in the pic) or were you using something else at home for testing?

starter
18/01/2018 at 14:21
4

I was using Arduino Micro Pro and ESP32 dev board. But you can use whatever Arduino board that you want.

warrior
22/01/2018 at 00:45
3

This project looks promissing, is it like a replacement for a 3-phase motor VFD?

dedicated
22/01/2018 at 01:46
3

@xxxolivierxxx
VFD?
Being new… What’s that?
Thanks DiB

warrior
22/01/2018 at 02:15
2

@dbougas Variable Frequency Driver, you normally need one of those when you are working with triphase motors

helper
24/01/2018 at 12:53
2

Is this supposed to be working?? Fire up a 3-phase-AC Motor with an arduino and solar panels? Would love to see the proof of concept.

new
18/05/2018 at 19:29
2

Hi…In my case No hardware yet but I’m learning programming to eventually run automotive alternators as 3-phase electric motors. These things are good for 1 KW or more and are being scrapped by the thousand every day. Motors in this power range are very useful in any DIY workshop with easy speed and direction control a nice bonus.

percentage calculator

new
23/05/2018 at 20:15
2

What if you are using a 3- phase AC motor?

helper
23/05/2018 at 20:51
2

@burchsung Do you think alternators can run continuesly, say some hours non-stop?

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.