-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plans to port to ESP32 ? #77
Comments
Hi,
Also the setup :
With L298 driver, the pwmount is changed :
And the loop :
All the code wifi and eeprom will be changed too , but it's no important to have a good control on the motors with the pid algorithm. My configuation for a DC motor with a ratio of 30 is : P : 500 , I:4, D:6. I have a good result and the motor freeze very slitely in the end. |
Thanks a lot @ghaz007 for your comments. I reckon you can remove the analogWrite from your L298 code entirely. And those that write a 0 can be replaced by digitalWrite(M<1|2>,LOW); |
Great job misan, it's just perfect, thank's !!
We can keep you initial code without modifications in the loop routine.
|
@ghaz007 Good job. Can you please post you whole code for everybody else? Thanks. |
Hi,
|
one more thing: just get rid of digitalWrite method in pwmOut routine. Use the method described here instead: Have you got some videos showing your servo in action? |
@ghaz007 Thank you. |
Hi @bogus105, Please take into account that ESP32 is a much faster processor than Arduino (and totally different architecture) so the Arduino macros will not work with it. What you are describing seems to be a dead-band problem: Real-world does not always conform according to our models, and that kind of breaks some of the assumptions of PID regulators. If your motor does not move with a non-zero output (dead-band), then it cannot correct the error at this stage. You can deal with that by adding some non-linear behavior on pwmOut (so you do not use output values that do not move the motor, though you still keep the 0 value). A large integrative action can help to correct the error but it will take a long time to do so, which is not what you want, and it might also end up oscillating around the target. |
Dear all,
Not sure if there are any plans to port it to ESP32 ?
Somehow PWM is not working.
Few changes might be needed(I've used dcservoESP_wifi.ino).
Add this and change all BUILTIN_LED to LED_BUILTIN
int LED_BUILTIN = 2; for dev board.
Change analog write analogWrite(M2,out) to something like ledcWrite(1, out); .
PWM setup if different:
ledcSetup(0, 20000, 255); // set PWM to 20Khz ,set PWM to 255 levels
ledcAttachPin(M1, 0);
ledcSetup(1, 20000, 255); // set PWM to 20Khz ,set PWM to 255 levels
ledcAttachPin(M2, 1);
Library change from 8266 to WIFI.h
//#include <ESP8266WiFi.h>
#include <WiFi.h>
CHange of ESP32 hostname
WiFi.begin(ssid, password);
WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); // required to set hostname properly
WiFi.setHostname("your host name");
If someone will make working example please upload.
Mine still not OK, but at least those are needed for sure.
May be I've accidently burned mine ESP32, but hope I will have time to order new one and try again.
Regards
The text was updated successfully, but these errors were encountered: