Friday,30-September-2016
VDO Marelli Idle motor - test control
EN
Because I start to have some issues with my Xantia`s Idle motor decide to build something what can help me to move the valve piston IN and OUT and test it how it goes. In that way it will be easy to open and clean it, and of course to fit it back.
Used parts are:
- 2 x push buttons(in my case 2pin headers) - used to control the motor forward and reverse
- 2 x 10kOm resistors
- 1 x L293D driver
- 12V charger (about 1.2A)
- 1 x arduino uno
- test board and wires
My configuration is:
The script moving the “things” :
#define motor_pin_1 2 //arduino digital 2 #define motor_pin_2 3 //arduino digital 3 #define motor_pin_3 4 //arduino digital 4 #define motor_pin_4 5 //arduino digital 5 int spin[32] = { 1,0,0,0, 1,0,1,0, 0,0,1,0, 0,1,1,0, 0,1,0,0, 0,1,0,1, 0,0,0,1, 1,0,0,1 }; void setup(){ pinMode(motor_pin_1,OUTPUT); pinMode(motor_pin_2,OUTPUT); pinMode(motor_pin_3,OUTPUT); pinMode(motor_pin_4,OUTPUT); pinMode(8,INPUT); pinMode(9,INPUT); } void loop(){ if(digitalRead(8) == HIGH){ forward(1,3); } if(digitalRead(9) == HIGH){ backward(1,3); } } void forward(int rep,int dly){ for(int x=0; x<rep;x++){ for(int t=0; t<32; t+=4){ digitalWrite(motor_pin_1, spin[t]); digitalWrite(motor_pin_2, spin[t+1]); digitalWrite(motor_pin_3, spin[t+2]); digitalWrite(motor_pin_4, spin[t+3]); delay(dly); } } digitalWrite(motor_pin_1, LOW); digitalWrite(motor_pin_2, LOW); digitalWrite(motor_pin_3, LOW); digitalWrite(motor_pin_4, LOW); } void backward(int rep,int dly){ for(int x=0; x<rep;x++){ for(int t=32; t>=0; t-=4){ digitalWrite(motor_pin_1, spin[t]); digitalWrite(motor_pin_2, spin[t+1]); digitalWrite(motor_pin_3, spin[t+2]); digitalWrite(motor_pin_4, spin[t+3]); delay(dly); } } digitalWrite(motor_pin_1, LOW); digitalWrite(motor_pin_2, LOW); digitalWrite(motor_pin_3, LOW); digitalWrite(motor_pin_4, LOW); }
Or there is option two: Using straight Atmel Tiny 85(and that make the project smaller)
- Attiny 85
- L293D
- 10k , 22k, 220k
- 2x push buttons
- 7805 , 1uF , 10F caps
* here to mention: in my test with SMD elements, there was small trouble with that resistor values. With 3.3k and 12k seems to work better. Then in the program below you need to change the range (10-:-200) to (80-:-180) and (200-:-600) to (250-:-900). Or just choose suitable(with quite difference in between) and then you can use “analogue read sketch” on arduino uno to check what values every one give you and to replace in that program:
#define motor_pin_1 0 // pin 5 coil 1 #define motor_pin_2 1 // pin 6 coil 1 #define motor_pin_3 3 // pin 2 coil 2 #define motor_pin_4 4 // pin 3 coil 2 int spin[32] = { 1,0,0,0, 1,0,1,0, 0,0,1,0, 0,1,1,0, 0,1,0,0, 0,1,0,1, 0,0,0,1, 1,0,0,1 }; void setup(){ pinMode(motor_pin_1,OUTPUT); pinMode(motor_pin_2,OUTPUT); pinMode(motor_pin_3,OUTPUT); pinMode(motor_pin_4,OUTPUT); } void loop(){ int buttonRead = analogRead(A1); delay(5); if(buttonRead > 10 && buttonRead < 200){ backward(); }else if(buttonRead > 200 && buttonRead < 600){ forward(); }else{ park(); } } void forward(){ for(int t=0; t<32; t+=4){ digitalWrite(motor_pin_1, spin[t]); digitalWrite(motor_pin_2, spin[t+1]); digitalWrite(motor_pin_3, spin[t+2]); digitalWrite(motor_pin_4, spin[t+3]); delay(3); } } void backward(){ for(int z=32; z>=0; z-=4){ digitalWrite(motor_pin_1, spin[z]); digitalWrite(motor_pin_2, spin[z+1]); digitalWrite(motor_pin_3, spin[z+2]); digitalWrite(motor_pin_4, spin[z+3]); delay(3); } } void park(){ digitalWrite(motor_pin_1, LOW); digitalWrite(motor_pin_2, LOW); digitalWrite(motor_pin_3, LOW); digitalWrite(motor_pin_4, LOW); }
And video how it work:
Hope, it was helpful for you ;)