当前位置:网站首页>Arduino stepper library drive 28byj-48 stepper motor test program

Arduino stepper library drive 28byj-48 stepper motor test program

2022-07-01 19:58:00 perseverance52

Arduino Stepper Library drive 28BYJ-48 Stepper motor test procedure


  • Proteus Simulation
     Insert picture description here

Stepper motor 28BYJ-48 Related parameters

Stepper motor 28BYJ-48, Step angle :5.625 degree , Namely 1 A pulse signal turns 5.625 degree ,64 A signal turns 360 degree . Reduction ratio :1/64, The motor inside the motor housing turns 64 circle , The part outside the motor housing turns 1 circle .

Stepper Library description

The phase sequence of the driver of the library source code is different , To drive 28BYJ-48 Stepper motor

  • Mode one : Define the way :Stepper myStepper(motorSteps, 8,10,9,11);
  • Mode two : Adjust the motor line sequence .( This example adopts the line sequence )
  • Mode three : Modify the relevant code as follows :

file location :C:\Users\Administrator\Documents\Arduino\libraries\Stepper\src, Medium Stepper.cpp Source file , The first 257 That's ok -278 That's ok , Revised as follows , Is to adjust the order of high and low levels of pins .

 Insert picture description here

Stepper motor related parameters

Step Angle This parameter determines , Program runtime , Can the stepper motor rotate for one turn .

 Insert picture description here

Test function description

After running the simulation , The stepping motor stops after one revolution .

Sample code

/* Arduino control 28BYJ-48 Stepper motor test procedure  */
 
// This sample program uses Stepper library 
#include <Stepper.h>// Clicking here will automatically open the management library page : http://librarymanager/All#Stepper
  
//  The external output shaft of the motor rotates for one cycle of steps 
const int stepsPerRevolution = 64;
 
//  Create stepper motor object 
//  Define motor control pins and basic motor information .
//  The motor control pin is  8,9,10,11 
//  The above pins are connected in turn ULN2803  Drive plate  In1, In2, In3, In4 
 
Stepper steppermotor(stepsPerRevolution, 8, 9, 10, 11); 
 
void setup()
{
    
  Serial.begin(9600);
    // set the speed at 60 rpm:
    delay(1000);
    Serial.println("Start...");
  steppermotor.setSpeed(60);   
  steppermotor.step(128);
    Serial.println("Stop...");
  delay(1000);
}
 
void loop()
{
     
   //  Rotate slowly clockwise for one circle 
// steppermotor.setSpeed(60); 
// steppermotor.step(128);
// delay(1000);
  
  //  Rotate one circle counterclockwise quickly  
// steppermotor.setSpeed(60); 
// steppermotor.step(128);
// delay(2000);
 
}

Program source code and simulation resources

This example is based on Proteus8.12 platform .

 link :https://pan.baidu.com/s/10_t4Z3nn6_e_Twm1NHcSpw 
 Extraction code :up7u

Birdsong stream The Tang Dynasty · Wang wei
People idle sweet scented osmanthus fall , The night is still and the spring is empty .
The rising of the moon startles the birds , In the spring stream .
原网站

版权声明
本文为[perseverance52]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207011844099775.html