background image

Stepper Motor HAT User Manual 

   

 

 

 

 

19

  / 

24

 

CODE ANALYSIS 

We provide Raspberry Pi demo codes on wiki. 

BCM2835 

 

FILES 

 

/bin: 

.o files which are generated by makfile 

 

Makefile: Code compilation 

 

motor: Executable file, you can execute command sudo ./motor to run the code 

 

Obj/:    folders to save function files 

Debug.h: Debug header file, you can set USE_DEBUG to 1 to print debug 

information; 

Deconflict(h): Define pins and interface of Raspberry Pi.   

DRV8825.c(h): Driver code of DRV8825 

main.c: Main function 

README.txt: Description 

 

Summary of Contents for HAT

Page 1: ...ves two stepper motors easy to use 6 available microstepping modes configured with the DIP switches full step half step 1 4 step 1 8 step 1 16 step and 1 32 step Adjustable motor drive current via pot...

Page 2: ...Stepper Motor HAT User Manual 2 24 SPECIFICATIONS Motor controller DRV8825 Motor drive voltage 8 2V 28V Motor drive current 2 5A Logic voltage 3 3V Dimension 65mm 56mm Mounting hole size 3 0mm...

Page 3: ...ns 2 Hardware 5 Pinout 5 Power 7 Motor Driver 7 Cotnrol protocol 10 H bridge 10 protocol of motor 11 Microstepping 12 DRV8825 12 Demo codes 13 Preparation 13 Downloading 13 Libraries Installation 13 S...

Page 4: ...Stepper Motor HAT User Manual 4 24 WiringPi 18 Python 18 Code Analysis 19 BCM2835 19 files 19 Codes 20 wiringPi 22 Files 22 Python 22 Files 22 Codes 22 FAQ 24...

Page 5: ...Stepper Motor HAT User Manual 5 24 HARDWARE PINOUT PIN Description VIN 8 2 28V Power Input 5V 5V Power GND Ground A1 Output 1 of bipolar stepper motor M1 winding A...

Page 6: ...A A4 Output 4 of bipolar stepper motor M2 winding A B3 Output 3 of bipolar stepper motor M2 winding B B4 Output 4 of bipolar stepper motor M2 winding B A1 A2 B1 B2 Control pins of stepper motor M1 A3...

Page 7: ...gular supports wide 4 5V to 28V input and up to 2A current output Even thought that MP1584 support low to 4 5V input however VM also supply power for motor controller which require at least 8 2V So th...

Page 8: ...therwise chip will enter sleep mode and module cannot work properly nENBL Enable pin Low H bridge is enabled and rise edge of STEP is sampled High H bridge is disabled output is high impedance Note th...

Page 9: ...Stepper Motor HAT User Manual 9 24 So if you need to increase the output current you can adjust potentiometers on board...

Page 10: ...he center you should through two transistors in diagonal line to drive motor When Q1 and Q4 is accessed current flow from positive pole Q1 to Q4 negative pole then motor moves forward When Q2 and Q4 i...

Page 11: ...left in right out current coil C right in left out motor rotate 0 degree Status 2 coil B top in bottom out coil D bottom in top out motor rotate 90 degree against status 1 Status 3 coil A right in le...

Page 12: ...ion motor can rotate in smaller angle and rotate more smoothly Microstepping is to divide each full step into smaller steps to help smooth out the motor s rotation especially at slow speeds For exampl...

Page 13: ...OWNLOADING Visit Waveshare Wiki and search for Stepper Motor HAT open and download demo code from wiki Extract and copy to your Raspberry Pi LIBRARIES INSTALLATION 1 Install wiringPi 1 1 Open Terminal...

Page 14: ...tp www airspayce com mikem bcm2835 index html 2 2 Copy the zip you download to Raspberry Pi without extracting 2 3 Open Terminal extract and install bcm2835 1 xx tar gz tar zxvf boot bcm2835 1 xx tar...

Page 15: ...u can configure the microstepping by SOFTWARD softward which you can refer to Code Analysis Hardware configuring To use hardware configuration you need to modify the function Drv8825_SetMicroStep HARD...

Page 16: ...s uses full step setting for which all switches are set to 0 by default CURRENT SETTING The maximum output current of DRV8856 is 2 5A you can adjust current by adjusting the potentiometer Generally wo...

Page 17: ...age by clockwise and anticlockwise to increase the voltage The factory setting is compatible with most of stepper motor However there are some motor whose minimum phase current is much larger in this...

Page 18: ...Stepper Motor HAT User Manual 18 24 RUNNING DEMO CODE BCM2835 cd bcm2835 sudo motor WIRINGPI cd wiringpi sudo motor PYTHON cd python sudo python test py...

Page 19: ...Makefile Code compilation motor Executable file you can execute command sudo motor to run the code Obj folders to save function files Debug h Debug header file you can set USE_DEBUG to 1 to print deb...

Page 20: ...Microstepping DRV8825_SetMicroStep HARDWARD fullstep Parameter 1 set control type HARDWARE SOFTWARD Parameter 2 set microstepping fullstep halfstep 1 4step 1 8step 1 16step 1 32step 4 Steps DRV8825_T...

Page 21: ...chip may doesn t be disabled so this function is used to handle such case Ctrl C generates signal SIGINT Handler function is executed when the signal generated The Handler work with these statements D...

Page 22: ...to BCM2835 differences are DEV_Config c h Library called is different Makefile linking library is different PYTHON FILES DRV8825 py is driver code of DRV8825 which is used to control stepper motor tes...

Page 23: ...oStep softward fullstep Parameter 1 control type software hardware Parameter 2 microstepping fullstep halfstep 1 4step 1 8step 1 16step 1 32step 3 steps Motor1 TurnStep Dir forward steps 200 stepdelay...

Page 24: ...without heat sink Normally it supports up to 2 5A 3 Why doesn t motor work and only shake left and right Motor shake when lack phase try to connect motor with Dupont lines if both interfaces of modul...

Reviews: