Simple Button Controlled Stepper Motor With Raspberry Pi Pico

by KushagraK7 in Circuits > Raspberry Pi

13939 Views, 17 Favorites, 0 Comments

Simple Button Controlled Stepper Motor With Raspberry Pi Pico

20210426_093019.jpg

In this quick project, let's make a simple stepper motor controller using some pushbuttons, a Raspberry Pi Pico, and a stepper motor driver. So without further ado, let's get started!

Get All the Required Stuff

20210426_093636.jpg
20210426_093528.jpg

For this project, you will need:

  • A Raspberry Pi Pico
  • A step/dir-based stepper motor driver(Like A4988, TMC2208, DRV8825, TB6600, etc)
  • Male jumper wires for making the wiring connections.
  • A breadboard
  • 3 normally-open pushbuttons
  • *Hook-up wires for breadboard
  • A 12-volt DC power source(Depends on the stepper motor and driver)
  • A 5-volt DC power source(A 5-volt regulator can also be used instead of a separate supply)

*Hook-up wires are recommended for making tidy breadboard wiring connections, although you can also use male jumpers.

Program the Pico

Button_Controlled_AccelStepper _ Arduino 1.8.13 26-04-2021 09_57_55.png

Here, I have used the Arduino IDE to program the microcontroller. The reason being the availability of an easy-to-use AccelStepper library for motor control. You can learn how to program a Raspberry Pi Pico from the Arduino IDE from here.

Make the Wiring Connections

20210426_073821.jpg

Connect a pushbutton each between 'GND' and the following pins:

  • ADC0
  • ADC1
  • ADC2

Connect the Motor Driver to the Microcontroller

20210426_092915.jpg

Make the following connections:

  • Step/Pulse -> GP16
  • Dir -> GP17

Also, connect the 'GND' pin of the microcontroller with the 'GND' terminal of the motor driver.

Connect the Motor Driver and the Microcontroller to Power

20210426_093210.jpg
20210426_093102.jpg
NF4vsRaVqecVwjpmX8Cj8n-1200-80.png

Connect the motor driver's 'VCC' pin to the +ve of the supply voltage(Here, 12-volts, shown with yellow wire), 'GND' to the -ve of the supply(Black). Connect the +5-volt wire to the 'VSYS' pin of the Pico and black wire to the 'GND' pin of the Pico.

Power Up the Setup and Test the Controls

Simple Button Controlled Stepper Motor | Raspberry Pi Pico Stepper Motor Control

If everything was done the right way, your motor should run as shown in the video.

Make sure all of the wiring connections are made with the right pins of the microcontroller and the buttons are working properly.