Hello again.
I tried to send PWM signals to VrefA, VrefB and the Clock.
After a day of fails, I finally make the motor turn by only using this Arduino code :
//Main
#define MOT_ENABLE 2
#define REF_A_BIS 3
#define MODE 4
#define CONTROL 5
#define CLOCK_PIN 6
#define COUNTERWISE 7
//#define RESET 8
#define REF_B 9
#define REF_A 11
#include "FonctionsMot.h";
void setup() {
#include "SetupPorts.h";
//faire1Revo();
faire12Revo();
}
void loop() {
//faire1Revo();
}
//FonctionsMot.h
#define CLOCK_TIME 1
#define TEST_TIME 12
void testCombinaisons(){
digitalWrite(REF_A, HIGH);
digitalWrite(REF_B, LOW);
digitalWrite(CLOCK_PIN, HIGH);
delay(TEST_TIME);
digitalWrite(REF_A, HIGH);
digitalWrite(REF_B, LOW);
digitalWrite(CLOCK_PIN, LOW);
delay(TEST_TIME);
digitalWrite(REF_A, LOW);
digitalWrite(REF_B, HIGH);
digitalWrite(CLOCK_PIN, HIGH);
delay(TEST_TIME);
digitalWrite(REF_A, LOW);
digitalWrite(REF_B, HIGH);
digitalWrite(CLOCK_PIN, LOW);
delay(TEST_TIME);
}
void faire1Revo(){
for(int i = 0 ; i < 100 ; i++) testCombinaisons();
}
void faire12Revo(){
for(int i = 0 ; i < 100*12 ; i++) testCombinaisons();
}
//SetupPorts.h
Serial.begin(9600);
pinMode(MOT_ENABLE, OUTPUT);
pinMode(MODE, OUTPUT);
pinMode(CONTROL, OUTPUT);
pinMode(CLOCK_PIN, OUTPUT);
pinMode(COUNTERWISE, OUTPUT);
pinMode(REF_B, OUTPUT);
pinMode(REF_A, OUTPUT);
digitalWrite(MOT_ENABLE, HIGH);
digitalWrite(MODE, LOW); //FULL STEP mode
digitalWrite(CONTROL, HIGH); //SLOW DECAY mode
digitalWrite(COUNTERWISE, LOW); /*It says HIGH for clockwise but for me it's LOW that gives clockwise rotation*/
I need to drive this motor at the speed of 12rotations/min. I previously measured 9.75s to make 12 rotations with 2ms for TEST_TIME so I just multiplied by six the time for a step and I got 12 rotations in 57.5s.
I got a few problems including the heating and the vibrations. My apprentice master told me it's because stepper motor are using lot of current to rotate and the vibration may come from the fact that I'm using too much current to drive to motor so it gains rotational inertia and it does a little more than a step...
Now I need to understand how I can limit the vibrations and heating by controlling the current with my Arduino but I haven't seen anything like this so I'm a little lost. What's your thoughts guys ? I'd happy to receive your remarks.