Hey Guys! I am new to the Particle community and to the world of SOCs in general.
I am currently having an issue with getting a 5V Stepper motor you might be familiar with: 28BYJ-48.
I did read the forums similar to this topic, but could not find a satisfactory solution.
I am currently running a simple ‘brute force’ code to switch on the relevant pins in an order with a 0.5sec time delay in between them.
From the online forums and discussions, it seems this is an issue with the firing order but I cant seem to recognise the fault, nor can I pinpoint if its some other issue.
I apologise if this is issue is a trivial one and already solved with a motor shield etc…I am very keen to get it right with first principles before moving on to shields etc.
Some simple measurements made:
- Voltage between VIN and GND of the Photon holds good at 4.95V
- Current from L293D output pin to GND (without any motor/resistor attached) read 1.3 A on the mutimeter
I have provided all the details below
PROBLEM :
The Motor is simply vibrating in at the same frequency as the step interval, but not turning.
HARDWARE USED:
- Photon
- Stepper Motor 5V 4phase 28BYL-48 5-WIRE
- Battery: 9V Duracell 170mAh (for testing only)
- Driver: L293D
- Voltage regulator - 7805
- 10 microfarad caps for bypass
SETUP BELOW:
FIRING ORDER USED:
Note: The RED supply (5th wire ) is unused.
CODE:
//-----------------------------------------------------------------------------
// INPUTS/OUTPUT pins
//GPIO OUTPUTS
int LEAD1_BLUE = D1; // GPIO OUTPUT FOR MOTOR LEAD 1 (COIL2 END2)
int LEAD2_PINK = D2; // GPIO OUTPUT FOR MOTOR LEAD 2 (COIL1 END1)
int LEAD3_YELLOW= D3; // GPIO OUTPUT FOR MOTOR LEAD 3 (COIL2 END1)
int LEAD4_ORANGE= D4; // GPIO OUTPUT FOR MOTOR LEAD 4 (COIL1 END2)
//------------------------------------------------------------------------------
void setup() {
// Put initialization like pinMode and begin functions here.
//Initialize the OUPUT pins
pinMode(LEAD1_BLUE, OUTPUT);
pinMode(LEAD2_PINK, OUTPUT);
pinMode(LEAD3_YELLOW, OUTPUT);
pinMode(LEAD4_ORANGE, OUTPUT);
}
// loop() runs over and over again, as quickly as it can execute.
void loop() {
//------------------TESTING ONLY----------------------------------------
digitalWrite(LEAD1_BLUE, HIGH);
digitalWrite(LEAD2_PINK, HIGH);
digitalWrite(LEAD3_YELLOW, LOW);
digitalWrite(LEAD4_ORANGE, LOW);
delay(500);
digitalWrite(LEAD1_BLUE, LOW);
digitalWrite(LEAD2_PINK, HIGH);
digitalWrite(LEAD3_YELLOW,HIGH);
digitalWrite(LEAD4_ORANGE, LOW);
delay(500);
digitalWrite(LEAD1_BLUE, LOW);
digitalWrite(LEAD2_PINK, LOW);
digitalWrite(LEAD3_YELLOW,HIGH);
digitalWrite(LEAD4_ORANGE,HIGH);
delay(500);
digitalWrite(LEAD1_BLUE, HIGH);
digitalWrite(LEAD2_PINK, LOW);
digitalWrite(LEAD3_YELLOW, LOW);
digitalWrite(LEAD4_ORANGE, HIGH);
delay(500);
}