Waveshare HAT User Manual

Stepper motor
Hide thumbs Also See for HAT:

Advertisement

Quick Links

Stepper Motor HAT User Manual

OVERVIEW

Stepper Motor HAT is designed for Raspberry Pi, can drives two stepper motors and
support up to 1/32 microstepping

FEATURES

Raspberry Pi connectivity, compatible with Raspberry Pi Zero/Zero W/Zero
WH/2B/3B/3B+
Onboard dual DRV8825 motor controller IC with built-in microstepping indexer,
drives 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 potentiometer, maximum 2.5A current output
Protection features: Overcurrent Protection (OCP), Thermal Shutdown (TSD), VM
Undervoltage Lockout (UVLO)
Integrates 5V regulator, allows providing power to Raspberry Pi
Onboard multi connector options for stepper motors in different specifications
Comes with development resources and manual (examples in BCM2835, wiringPi,
and python)
Stepper Motor HAT
User Manual
1 / 24

Advertisement

Table of Contents
loading

Summary of Contents for Waveshare HAT

  • Page 1: Overview

    Stepper Motor HAT User Manual Stepper Motor HAT User Manual OVERVIEW Stepper Motor HAT is designed for Raspberry Pi, can drives two stepper motors and support up to 1/32 microstepping FEATURES Raspberry Pi connectivity, compatible with Raspberry Pi Zero/Zero W/Zero ⚫...
  • Page 2: Specifications

    Stepper Motor HAT User Manual 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 ⚫ 2 / 24...
  • Page 3: Table Of Contents

    Stepper Motor HAT User Manual CONTENT Overview ............................... 1 Features ..............................1 Specifications ............................. 2 Hardware ..............................5 Pinout ..............................5 Power ..............................7 Motor Driver ............................7 Cotnrol protocol ............................10 H-bridge ............................. 10 protocol of motor ........................... 11 Microstepping ..........................
  • Page 4 Stepper Motor HAT User Manual 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: Hardware

    Stepper Motor HAT User Manual HARDWARE PINOUT Description 8.2~28V Power Input 5V Power Ground Output 1 of bipolar stepper motor M1 winding A 5 / 24...
  • Page 6 Stepper Motor HAT User Manual Output 2 of bipolar stepper motor M1 winding A Output 1 of bipolar stepper motor M1 winding B Output 2 of bipolar stepper motor M1 winding B Output 3 of bipolar stepper motor M2 winding A...
  • Page 7: Power

    Stepper Motor HAT User Manual POWER MP1584 regular 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, the recommend input voltage is 8.2~28v.
  • Page 8 Stepper Motor HAT User Manual The DRV8825 is e has two H-bridge and a microstepping indexer, and is intended to drive a bipolar stepper motor. It supports up to 1/32 microstepping. Internal shutdown functions are provided for overcurrent, short circuit, under voltage lockout and over temperature.
  • Page 9 Stepper Motor HAT User Manual So, if you need to increase the output current, you can adjust potentiometers on board. 9 / 24...
  • Page 10: Cotnrol Protocol

    Stepper Motor HAT User Manual COTNROL PROTOCOL H-BRIDGE H-bridge is a popular motor control circuit. It is named because it looks like character “H”. It consists of four transistors/MOSFET, motor is connected on the center, you should through two transistors in diagonal line to drive motor.
  • Page 11: Protocol Of Motor

    Stepper Motor HAT User Manual PROTOCOL OF MOTOR According to Ampère's circuital law, when current of coil A flow from left to right, stator generates magnetic field, internal side is North pole which will adopt rotator of motor. When the currents of four coils based on certain rule, they will generate a rotate magnetic field and drive the rotator rotate.
  • Page 12: Microstepping

    Stepper Motor HAT User Manual 28BYJ-48 is four phase and eight steps, Speed Variation Ratio is 1/64 and its step angle is 5.625/64 degree. MICROSTEPPING We have said that motor rotate because of flowing current. According to its working principle, we can control currents in coils to make them rise or fall regularly.
  • Page 13: Demo Codes

    Stepper Motor HAT User Manual DEMO CODES PREPARATION DOWNLOADING Visit Waveshare Wiki and search for “Stepper Motor HAT”, open and download demo code from wiki. Extract and copy to your Raspberry Pi. LIBRARIES INSTALLATI ON Install wiringPi Open Terminal (Ctrl+T), clone wiringPi git clone git://git.drogon.net/wiringPi...
  • Page 14 Stepper Motor HAT User Manual Install it cd wiringPi ./build Install BCM2835 Download the latest bcm2835 library http://www.airspayce.com/mikem/bcm2835/index.html Copy the zip you download to Raspberry Pi without extracting Open Terminal, extract and install #下载最新的函数库 bcm2835-1.xx.tar.gz tar zxvf /boot/bcm2835-1.xx.tar.gz cd bcm2835-1.xx ./configure...
  • Page 15: Setting

    Stepper Motor HAT User Manual SETTING MICROSTEPPING Stepper motor HAT support up to 1/32 microstepping. Support both software and hardware configuring. Software configuring In the demo codes, you can configure the microstepping by SOFTWARD/softward which you can refer to Code Analysis...
  • Page 16: Current Setting

    Stepper Motor HAT User Manual For more details, please refer to datasheet page13 【Note】Sample codes 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, working current of stepper motor is less than 2.5A, in this case, we need to...
  • Page 17 Stepper Motor HAT User Manual For more details about the current required, please refer to datasheet page12. The R(isense) on board is 200mR, so we can get that I(chop) = V(xref). V(xref) is voltage of potentiometer, Ichop is output current. Reduce voltage by clockwise and anticlockwise to increase the voltage.
  • Page 18: Running Demo Code

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

    Stepper Motor HAT User Manual 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 ⚫...
  • Page 20: Codes

    Stepper Motor HAT User Manual CODES 1. Initializing BCM2835 and setting pins if(DEV_ModuleInit()) exit(0); 2. Choose Motor DRV8825_SelectMotor(MOTOR1); #Parameter: choose motor; MOTOR1, MOTOR2 3. Setting 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"...
  • Page 21 Stepper Motor HAT User Manual If you use CTRL+C to stop the code, DRV8825 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.
  • Page 22: Wiringpi

    Stepper Motor HAT User Manual WIRINGPI FILES Similar 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. test.py: test code CODES test.py:...
  • Page 23 Stepper Motor HAT User Manual Motor1 = DRV8825(dir_pin=13, step_pin=19, enable_pin=12, mode_pins=(16, 17, 20)) 2. Set microstepping Motor1.SetMicroStep('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 = 0.005) #Parameter 1: control direction, 'forward'、'backward'...
  • Page 24: Faq

    Stepper Motor HAT User Manual Why the motor and chips on modules get serious hot? Energy efficiency of stepper motor is very low, has only 20%~30% useful work, others become heat. So, stepper motor will get very hot after running for long time.

Table of Contents