Close

Activating motors with MQTT

A project log for Haptic Sleeve

Sleeve worn on the arm to provide haptic feedback while performing handwriting exercises.

grant-stankaitisGrant Stankaitis 04/13/2020 at 18:380 Comments

I have been keeping track of my work for the past few weeks but neglected to keep my logs updated. So, here is my documentation for everything!

4/1, I was able to activate the motors using MQTT! I used the main_PWM.py script, sent messages from my PC to the server and it activated the appropriate motors with the appropriate PWM signal.

I did have to do a bit of debugging because there were issues with the code. The IDE was had issues due to inconsistencies within the file because sometimes spaces were used and other times tabs were used for whitespace. There were also important colons missing after elif/else statements, but after addressing all of these issues the code worked! See the screenshot below to see the command being sent on the right, and the ESP32 receiving the command on the bottom left.

As you can see, sending the command "0,0" turns the motors off. Then, sending a command such as "1,1" activates the 1st motor with a pulse level of 1. In the terminal window on the right, I tested each motor (1 through 4) with a power level of 1, and they all worked as intended. Additionally, not shown, I was able to test it with the specified power levels (1-3), and they all worked properly, being able to distinguish between the 3 power levels.

Discussions