Utilizes an ESP32 or Arduino to read a PWM signal and control a stepper motor.
git clone https://github.com/RoboticsClubatUCF/ESP32-PWM-to-Stepper/Learn how to install and use PlatformIO here. Open the folder in PlatformIO, compile, and upload the program to an Arduino or ESP32. Also, the main.cpp file could be copied into a blank Arduino project (.ino file) if you are more familiar with how to use that.
- Stepper Pulse: 7
- Stepper Direction: 8
- Potentiometer Input: 0
- PWM input: 2
Tune these values:
- The PWM_MIN and PWM_MAX refer to the min/max value of analogRead based on the PWM signals your flight controller sends.
- MAX_RUDDER_ANGLE refers to how many degrees your rudder should rotate from center.
- POTENTIOMETER_MIDDLE should be adjusted based on the calibration of your potentiometer. POTENTIOMETER_ERROR is tuned to the noise in the potentiometer reading. If the board is connected to the serial monitor, these values are printed so you can adjust them accordingly.
- REVERSED is whether the movement of the stepper is reversed or not. If the ruder oscillates around a given point, this is likely inverted