buttonstate1 = digitalRead(1); //read condition of N/O button and connect it with PIN 3
if (buttonstate1 == HIGH){
digitalWrite(5,HIGH); //RELAY CENTRAL
digitalWrite(6,HIGH); //RELAY STAR
digitalWrite(7,LOW); //RELAY TRIANGLE
}
buttonstate2 = digitalRead(0); //read condition of N/C button and connect it with PIN 4
if (buttonstate2 == LOW){
digitalWrite(5,LOW); //RELAY CENTRAL
digitalWrite(6,LOW); //RELAY STAR
digitalWrite(7,LOW); //RELAY TRIANGLE
}
}
HOW TO COMPILE BUTTONS with OUTPUTS(releys)???? please help me to finish that
Firstly, please put your code into code tags.
Secondly, a y/d start is not a good way to start a three phase motor for a number of reasons:
You will get two current spikes almost as high as the single one in direct start
The motor will have a starting torque of 1/3 of the direct start torque meaning that that starting time is prolonged resulting in increased heat up.
Y/D start IS appropriate when starting devices with large inertia such as rotational converters and tooling machinery where there is large inertia but no load on start.
The best way to do a Y/D start is designing a state machine as the one in the attached state diagram. This can then easily be coded using my state machine library
#include <SM.h>
SM ydStart(off);
enum {onBtn = 2, offBtn, cRelay, wRelay, dRelay};//declare I/O pins
void setup(){
for(int pin = cRelay; pin<=dRelay; pin++) pinMode(pin, OUTPUT);//relay pins as outputs
}//setup()
void loop(){
EXEC(ydStart);
}//loop()
State off(){
if(digitalRead(onBtn)){
ydStart.Set(wye);
digitalWrite(cRelay, 1);//central realy on
digitalWrite(wRelay, 1);//wye relay on
}//if(onBtn)
}//off()
State wye(){
checkOff();
if(ydStart.Timeout(1000)){
digitalWrite(wRelay, 0);
ydStart.Set(ccp);
}//if(timeout)
}//wye()
State ccp(){
checkOff();
if(ydStart.Timeout(20)){//20ms for cross conduct prevention
digitalWrite(dRelay, 1);
ydStart.Set(delta);
}//()
}//ccp()
State delta(){
checkOff();
}//delta()
void checkOff(){
if(digitalRead(offBtn)){//check off btn
for(int pin = cRelay; pin<=dRelay; pin++) digitalWrite(pin, 0);//all relays off
ydStart.Set(off);
}//if(offBtn)
}//()