BuddyBot: Controlling a Stepper Motor with an Android Smartphone
By Michael Parks, P.E., Mouser Electronics
Licensed under CC BY-SA 4.0
Download Full Project
BOM
Overview
The Brains : We will use an STM32 Nucleo
F401RE microcontroller platform to tie all our components together. The STM32 Nucleo is programmed
using the C/C++ language.
Figure 2: The STM32 Nucleo has a detachable, reusable
programming card at the top that is removed once a project is ready for final deployment.
You will need a free account on mbed.org to use the STM32 Nucleo since their Integrated
Development Environment (IDE) lives in the cloud. The benefits of having a cloud-based IDE are that:
you are always running the latest IDE
your code is backed up on their servers
it makes adding third-party libraries a breeze.
We will use the latter feature to add a pre-built library to interface with our ultrasonic sensor so we can
enable an automatic “robot” mode for our BuddyBot. I have also provided a link to
the STM32 Nucleo
code to help get you started.
The Brawn : A NEMA 17 stepper motor will provide the rotation of our laser and ultrasonic sensor. We will
also use a L293D dual H-Bridge motor driver microchip to provide the interface and some
protection between our microcontroller and the stepper. Important note: the ‘D’ at the end of L293D
signifies that it has the built-in flyback protection diodes. There are also L293 chips that do not have the
diodes, so be sure to pick the right ones when ordering if you don’t use the ones in the project cart already.
The diodes are key in preventing blowback voltage from the motor coils from frying your microcontroller.
Blowback voltage results when the power to the relay coil gets switched off and the magnetic field starts to
fade. Current can flow back into your microcontroller if you leave it unprotected.
Cutting the Wires : We will use a RN42 Bluetooth
board to provide the serial communications link between our STM32 Nucleo and our Android app. To
make things easy, we will be using MIT’s App
Inventor software to develop our app. In addition, I have provided the .aia file
if you want to upload it into your App Inventor account and tinker with
the code.
We would love to hear what you think about this project; please tell us in the
comments section below.