Hi Michael. Thanks for you help. Just an fyi. I don’t want anyone to do this for me. Just a point in the right direction. The struggle is 75% of the fun.
I was hoping to see something like “pwm frequency : X”
I did a bit of google and best I could find is 50 Khz
The ESP8285 data sheet I was looking at (which I assume is the chip on your ESP01) seems to imply that it has a hardware PWM, but on my quick look I could not confirm how many PWM channels (concurrnet) it supports.
If there is hardware PWM, I would used that as it will be much much better then any pin level bit bang methods.
The ESP01 (which is a ESP8266 chip) supports PWM on GPIO0~GPIO3. Is the actual question related to how to drive a motor using PWM on the ESP01? If that’s the case, then the starting point is the IDE are you using for programming (because that will determine how it’s done).
Hay Jeff, thanks again. At the moment I’m using the ardunio ide but looking at the visual studio code one( can’t remember what it’s called.)
OK. If you are using a DC motor and a high-speed switching module such as this one connected from GPIO3 then you can use a sketch such as
const int motorPin = 3;
const int speed = 128;
void setup() {
pinMode(motorPin, OUTPUT);
analogWrite(motorPin, speed);
}
void loop() {
}
and that will run the motor at half speed. If your setup is different then the code will alter slightly.
I got this working, soft access with wifi uploads for programming, this frees up all GPIO pins to control the motors.
https://www.instagram.com/electrictronic_zootopia?igsh=MWZvYjVkcmdyYno3aA%3D%3D&utm_source=qr
If you want to see video of it working
Hey @Josh286640,
Glad to see you got it working! Can’t use Instagram right now, but I’ll be checking it out once I can!
It’s cool as, I haven’t found anyone else on the net who’s doing this with the Esp01 everyone thinks you only have 2 usable pins. Gota think outside the box. Once it’s flashed with the wifi ota program and that’s kept in every code after, we get 4 usable pins, just need to make sure the ota code is maintained or you get a board that can’t be reprogrammed.



