The next step was to characterize the relationship between the motor power and the throttle blade angle.
Surprisingly enough, there isn't much of a relationship. I had guessed that the opening angle would be roughly proportional to the duty cycle, and whlie that isn't completely wrong, the relationship is VERY rough. Friction and momentum play a huge role. The only way to really control the blade angle is with a PID loop.
So I wrote a state machine that exercises the blade angle slowly from closed to open and back again, and added a PID loop to control it. Then I added some fast transitions between different blade angles, and experimented with different PID gains. It was surprisingly insensitive - a wide range of gains give reasonable good control, or at least it seems that way on my desk.
I'll attach the .ino file, and perhaps a video.
Kudos to the authors of these web pages - this information helped a lot:
ESP32 PWM with Arduino IDE (Analog Output) | Random Nerd Tutorials
https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/
Not sure why the 2nd one is showing up as a URL rather than as the page title, but you can tell what it's about.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.