STM32 Stepper Bot

STM32 based Stepper Motor robot

03/18/2021

Lately I’ve been reviewing many of my old projects due to the website update and I spent some time with the MegaBot (basically and upgrade to the Bargain UNO BOT but using an Arduino MEGA and more sensors).

I was somewhat disappointed with the precision of the wheels using the DC motors and optical encoders. I have a large collections of stepper motors but they are heavy and require lots of power

to drive them.

I found some relatively small stepper motors in my parts collection and since I had a few really nice (and powerful) 11.1v 2200mah LiPo batteries started to experiment with those parts.

I also found in my collection a few A4988 stepper motor driver modules typically found in 3D printers. These would be perfect and spared me from having to build the drivers myself.


This time I chose the STM32F013 BluePill board as a CPU just to make things interesting.


Once the motor experiments proved successful I searched for 3D printable wheels on Thingiverse. Here’s a nice contribution that adjustable in a ton of ways.
https://www.thingiverse.com/thing:21486

I designed mountings to hold the main circuit board and the batteries (I have 2 sizes and the design will hold either style). Later I also designed supports for the front mounted distance sensors, brackets for the motors and motor driver board.

The base is cut from a 1/4” piece of plexiglass pulled from an old LCD monitor screen.


Once the wheels were paired with the stepper motors I was slightly disappointed with the maximum speed I could reliably get out of the bot. But this robot was built for precision not speed.

The 11cm wheels and 200 steps/rev motors gave me 172mm per step but a top speed of only around

300mm/sec.


Early in the design & testing I inadvertently connected the LiPo battery to the wrong connector and toasted my 2 stepper motor driver modules. These are really inexpensive (5 for $8.49 )and a week later I had a fresh supply. I took this opportunity to order up a few more HC-SR04 ultrasonic sensors and more HC-06 bluetooth modules so I’ll be ready for another build when that time comes.


Software development stalled when I simply couldn’t get reliable reading from the HC-SR04 ultrasonic

distance sensors. Eventually I ditched my home-grown routines and found a library online for the STM32F104 and still had poor results. Finally I pulled out a new module from my freshly ordered supply and everything worked great. (who would have guessed a faulty module that wasn’t completely dead, just erratic).


Later I added the bluetooth module and located a new joystick app for my android phone that interfaced nicely with the bot allowing me to drive it around with my phone. *Arduino Bluetooth Controlled Joystick from Uncia Robotics.

https://play.google.com/store/apps/details?id=uncia.robotics.joystick


As usual I’ve provided a copy of the software source, schematic and a link to a short video showing it in action.



Left Side

Right Side

Back

Motor Driver Board

Terminal Menu for testing and debugging


Description of download links:

StepperBot_FindWall2.mp4 Short Video of robot in motion.

STM32_StepperBot.zip STM32F104 Source code for StepperBot

STM32_StepperBot_SchematicV10.pdf StepperBot Schematic