BuddyBot: Controlling a Stepper Motor with an Android Smartphone
By Michael Parks, P.E., Mouser Electronics
Licensed under CC BY-SA
4.0
Assembly: Putting It All Together
As I mentioned in the Project Summary, I used a 3D printer to manufacture some of the mechanical interface
components. I also used my amateur woodworking abilities to build the physical structure. Feel free to let your
imagination run wild with laying out your BuddyBot. Some things to keep in mind though:
- Give it sufficient height, and angle the laser accordingly to give yourself ample room for the dot to
traverse around your hardware. You don’t want Felix the Cat running into the box while chasing the laser.
- You may need to tweak certain variables in the STM32 Nucleo code such as triggerDistanceCM in the main.cpp
file to account for the height and angle of your laser.
- Make sure to adjust the location of your limit switches so they are activated before the laser and PING
sensor wires get wrapped up around the motor shaft.
- If you power the device from a USB wall charger (instead of a computer’s USB port), be sure to place a jumper across
JP1, or else the STM32 Nucleo will not power the microcontroller.
Figure 9: 3D printer files are provided for the enclosure if you
have one, but is not necessary, depending on how violent your cat gets when it plays.
Figure 10: Assembly.
Time to fire it all up!
- Plug the USB cable into the STM32 Nucleo and into a wall outlet.
- Make sure that there are blinking LEDs on both the STM32 Nucleo and the Bluetooth module.
- Launch the BuddyBot app on your Android device.
- Click the “Pair” button to pair to the RN42 device. You should only have to ever do this once.
- Next click the “Connect” button and the blinking LED on the Bluetooth module should become solid.
- Try turning the laser on and moving the motor!
Figure 11: Testing the Buddy Bot in random mode. I also made a
housing to put around it and protect the electronics from jumping cats.
Figure 12: Testing the BuddyBot with my tablet. This is Bluetooth
wireless, so you have to be within about 15 feet of BuddyBot to control it, but you could re-program the app
to turn on in random mode at certain times of the day, if you’re willing to leave your tablet within 15 feet
of Buddy Bot.
So there you have it, you’ve built your very own BuddyBot! Please send us pictures of your furry friend enjoying
their new toy. If you make any modifications to the design, please share that as well. We can’t wait to see what
you do!
We would love to hear what you think about this project; please tell us in the
comments section below.