Dear all,
this hobby project I setup is using an encoder to make the stick to be 90 degress which is at 1500 steps (0 degrees=perfectly horizontal using PID control). My encoder counter code is obtained from video here and I have tested it which works perfectly well. Since this encoder is 1200 steps/rev. it would mean it take 300 steps for 90 degrees rotation. My encoder initial position are shown in diagram below which is 1200 steps initial starting point. May I know the arduino code to balance the stick at 90 degress or prefectly horizontal using PID? I have also checked when PWM increase, the fan will increase fan speed which will rotate clockwise . I have attached a encoder counter code below and I have checked that all PID code should be placed inside the IF statement in order for counter to work properly and not skipping any steps. I have attached my encoder counter code below.
Thank you for reading and have a nice day .
this hobby project I setup is using an encoder to make the stick to be 90 degress which is at 1500 steps (0 degrees=perfectly horizontal using PID control). My encoder counter code is obtained from video here and I have tested it which works perfectly well. Since this encoder is 1200 steps/rev. it would mean it take 300 steps for 90 degrees rotation. My encoder initial position are shown in diagram below which is 1200 steps initial starting point. May I know the arduino code to balance the stick at 90 degress or prefectly horizontal using PID? I have also checked when PWM increase, the fan will increase fan speed which will rotate clockwise . I have attached a encoder counter code below and I have checked that all PID code should be placed inside the IF statement in order for counter to work properly and not skipping any steps. I have attached my encoder counter code below.
Thank you for reading and have a nice day .
Attachments
-
656 bytes Views: 7