SHIELD-MD10, VIS SYSTEM,car, tacho meter(spark plug), convert 12V
hi guys! i'm mechanical engineering student hard sketching code me need guys ....
my project making vis system input spark plug signal , output 2 line operating linear actuator(6'' stroke, 22lb force high speed linear actuator firgelli automations) , use arduino uno , shield-md10(cytron 10a motor driver shield) supply 12v, problem if use arduino uno maybe can control using code actuator need 12v use shied convert 5v 12v
how change pin number 2,3 mortor pin (a,b) in shield???
my code
int hp=0;
int lp=0;
int rpmpast=0;
const int relay_1_a = 3;
const int relay_1_b = 4;
/// 2번은 입력(rpm) 3,4 번은 출력(linear actuator)
void setup() {
pinmode(2,input);
pinmode(relay_1_a, output);
pinmode(relay_1_b, output);
serial.begin(9600);
}
void loop() {
int h = pulsein(2,high);
int l = pulsein(2,low);
int dc;
dc=(h+l);
int duty;
int hz=1000000/dc;
int rpm=hz*60;
if(rpm<=0){
if(h==0 & l==0) rpm=0;
else rpm=rpmpast;
}
if((abs(rpm)-abs(rpmpast))>2000) rpm=rpmpast;
serial.print("high : ");
serial.print(h);
serial.print(", low : ");
serial.print(l);
serial.print(" ");
serial.print(dc);
serial.print(", ");
serial.print(hz);
serial.print("hz rpm : ");
serial.println(rpm);
if(rpm>7500){
while(rpm>7500){
digitalwrite(relay_1_a, low);
digitalwrite(relay_1_b, high);
delay(50);
digitalwrite(relay_1_a, high);
digitalwrite(relay_1_b, low);
delay(50);
h = pulsein(2,high);
l = pulsein(2,low);
dc=(h+l);
hz=1000000/dc;
rpm=hz*60;
}
rpmpast=rpm;
hp=h;
lp=l;
}
}
void extendactuator(int actuator) {
//set 1 relay 1 , other off
//this move extend actuator
digitalwrite(relay_1_a, high);
digitalwrite(relay_1_b, low);
}
void retractactuator(int actuator) {
//set 1 relay off , other on
//this move retract actuator
digitalwrite(relay_1_a, low);
digitalwrite(relay_1_b, high);
}
void stopactuator(int actuator) {
//set both relays off
//this stop actuator in braking
digitalwrite(relay_1_a, low);
digitalwrite(relay_1_b, low); }
my project making vis system input spark plug signal , output 2 line operating linear actuator(6'' stroke, 22lb force high speed linear actuator firgelli automations) , use arduino uno , shield-md10(cytron 10a motor driver shield) supply 12v, problem if use arduino uno maybe can control using code actuator need 12v use shied convert 5v 12v
how change pin number 2,3 mortor pin (a,b) in shield???
my code
int hp=0;
int lp=0;
int rpmpast=0;
const int relay_1_a = 3;
const int relay_1_b = 4;
/// 2번은 입력(rpm) 3,4 번은 출력(linear actuator)
void setup() {
pinmode(2,input);
pinmode(relay_1_a, output);
pinmode(relay_1_b, output);
serial.begin(9600);
}
void loop() {
int h = pulsein(2,high);
int l = pulsein(2,low);
int dc;
dc=(h+l);
int duty;
int hz=1000000/dc;
int rpm=hz*60;
if(rpm<=0){
if(h==0 & l==0) rpm=0;
else rpm=rpmpast;
}
if((abs(rpm)-abs(rpmpast))>2000) rpm=rpmpast;
serial.print("high : ");
serial.print(h);
serial.print(", low : ");
serial.print(l);
serial.print(" ");
serial.print(dc);
serial.print(", ");
serial.print(hz);
serial.print("hz rpm : ");
serial.println(rpm);
if(rpm>7500){
while(rpm>7500){
digitalwrite(relay_1_a, low);
digitalwrite(relay_1_b, high);
delay(50);
digitalwrite(relay_1_a, high);
digitalwrite(relay_1_b, low);
delay(50);
h = pulsein(2,high);
l = pulsein(2,low);
dc=(h+l);
hz=1000000/dc;
rpm=hz*60;
}
rpmpast=rpm;
hp=h;
lp=l;
}
}
void extendactuator(int actuator) {
//set 1 relay 1 , other off
//this move extend actuator
digitalwrite(relay_1_a, high);
digitalwrite(relay_1_b, low);
}
void retractactuator(int actuator) {
//set 1 relay off , other on
//this move retract actuator
digitalwrite(relay_1_a, low);
digitalwrite(relay_1_b, high);
}
void stopactuator(int actuator) {
//set both relays off
//this stop actuator in braking
digitalwrite(relay_1_a, low);
digitalwrite(relay_1_b, low); }
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > SHIELD-MD10, VIS SYSTEM,car, tacho meter(spark plug), convert 12V
arduino
Comments
Post a Comment