Generic Step Direction driver

Introduction

The Generic Step Direction driver is designed to work in conjunction with a A4988 driver chip to control bipolar stepper motors. The driver has driver MOSFETs integrated so all we have to do is to provide a step count and a direction signal to the chip. A very famous one is the Polulu A4988 module


Driver Parameters

The Generic Step Direction driver has four parameters that need to be configured:

Step Pin

This tells the driver IC the pins it should proceed. One positive edge rotates the motor a single step in the direction provided by the direction pin

Direction Pin

This pin provides the direction to the driver. Holding it low turns the motor one way while holding it high drives it the other way

RPM

This is the revolutions the motor performs per minute. We can handle revolutions per minute between 5 and 60 with the default being 10.

Steps/Rev

The steps per revolutions tells the driver how often the coils have to be energized to determine a full rotation. This value can be found very prominently in the datasheet of the motor.


Wiring

The pinout of the Polulu A4988 can be found below:

None of the special functionality is supported as of now, so we just connect it as shown in the schematic. STEP and DIR are the pins we connect to the Builder Base.

 

We just use the A4988 as an example!

The A4988 has a maximum power rating which can be found in its datasheet. In general the stepper should not draw more than 1.5A roughly at 12V, otherwise the IC can overheat and unexpected behavior occurs. There are different solutions like more beefier step direction drivers or just using plain transistors/MOSFETs to drive the Motor.

Example

In this example, the Generic bipolar stepper motor is connected to an A4988 driver IC. From the Builder Base, the 5V pin is connected to the VDD pin on the IC; the GND pins are connected to the GND pins on the IC, and to the GND pin on our power supply. GPO is connected to the DIR pin, GP1 to the Step Pin. From the chip, 1A is connected to the A pin on the coil, 1B is connected to the C pin ,2A is connected to the B pin, 2B is connected to the D pin. Lastly, the positive voltage from our power supply is connected to VMOT on the chip. We use an external power supply for the motor voltage here because most stepper motors run on 12V.

Note: In the schematic the poles for each coil are labeled A, B, C and D instead of A+, A-, B+ and B- like in our driver IC. This is purely a difference in naming convention that occurs between stepper motors manufactured by different companies and different schematics. All that matters is that the outputs driven by A+ and A- are connected to one coil and the ones driven by B+ and B- are connected to the other coil.

 Breadboard

Schematic 

Used Pins

Used Pins

Description

Used Pins

Description

GP0: (Can be any GP pin)

Controls the Direction of the Motor

GP1: (Can be any GP pin)

Controls the steps the motor takes

+ voltage (from power supply)

Provides power to stepper motor (VMOT on IC)

5V:

Provides 5V power for the IC. Connected to VDD

GND:

Provides grounding for the circuit: Connected to GND pins on chip and the power supply.


How to write an App

Navigate to the App Builder and create a new application. You can find the “Stepper Motor” code object under the “Hardware” Tab in the object drop down menu on the left, or you can also use the search bar.

 

 

 

Drag the “Stepper Motor” Object onto the canvas.

Next, locate the “Button” and “Input Number” Objects under the interface tab and drag two instances of the “Button” Object and one instance of the “Input Number” Object onto the canvas.

 

 

Finally, from the “Button” Objects connect one state port to the Increment port and one state port to the Decrement port on the “Stepper Motor” Object. From the “Input Number” Object connect the Number port to the Steps in Degrees port. If you wish, label your code objects for easier identification on the dashboard, and save your application.

 


How to create a firmware

Navigate to the Firmware Builder and create a new firmware file.

Click the “+ Add Hardware” button which will open a modal window. Scroll down in the list to find the “Generic” section and select the “Stepper Motor” hardware option.

Give your device a name, and click “Add Device”

 

 

 

Next, select the “2-Phase ” driver under the driver dropdown menu.

 

 

 

For this example we select:

  • Step Pin: GP1

  • Step Direction: GP0

  • RPM: 10

  • Steps/Rev: 200

 

You may now save your firmware file and upload it to one of your clients.

 

 

 


Supported Hardware

  • 2-Phase Stepper Motor


Downloads

Apps

Firmware

Assets