[Newbie question] Voltage, Arduino PWM vs LED PWM vs MCPWM vs BPWM
Posted: Sat Aug 12, 2017 4:58 pm
Hi everyone,
I'm a newbie not just with ESP32 but also with electronics in general so please be patient and sorry for the probably stupid question.
I've been playing with controlling a DC motor with my Arduino. I used an L293D chip, i controlled direction with 2 digital outputs from the arduino and 1 pwm output connected to the enable of the L293D. By changing the PWM signal in the arduino I control the speed of the motor.
Now I'm waiting for my ESP32 Dev kit board to arrive and meanwhile I'm ready a little bit about ESP32 and ESP-IDF.
I'm a bit confused about how I could achieve the same with the ESP32. Well, in fact I want to use an L298N circuit instead of the L293D but as far as i understand they work in a similar way.
My first question is about voltage. If I did understand right PWM works by upping and lowering the signal in the output pin in a very fast and precise way, so that the final result is that instead of getting and average of 5 volts in the output it might look like 4 volts, 3 volts or whatever. The driver checks this voltage and depending on it sends "more power" to the DC motor? Or maybe it justs turns it on an of in the same rate as the PWM signal?
If I did understand right the GPIO pins in the Devkit board work at 3.3volts so that this mean that the driver will move the motor more slowly ? Or am I mislead and the only thing that matters is the frequency of the signal?
Apart from that. What is the difference between the PWM in an arduino GPIO pin and the ones in the ESP32? I've read that there are 2 kinds of PWM in the ESP32 the so called LED PWM and the MCPWM.
By the name it seems that I should use the Motor Control PWM but looking at the example code I see that I have to configure 2 pins for the PWM unit, not just one as I would expect. Sadly the examples do not show any schematichs or wiring diagrams so I'm not sure how I'm supposed to hook those 2 pins to the L298N. Can I just attach one of those two pins of the controller to the enable pin of the L298N and manage the directions pin with two regular digital pins? Is the second pin useless in my case?
Thanks.
I'm a newbie not just with ESP32 but also with electronics in general so please be patient and sorry for the probably stupid question.
I've been playing with controlling a DC motor with my Arduino. I used an L293D chip, i controlled direction with 2 digital outputs from the arduino and 1 pwm output connected to the enable of the L293D. By changing the PWM signal in the arduino I control the speed of the motor.
Now I'm waiting for my ESP32 Dev kit board to arrive and meanwhile I'm ready a little bit about ESP32 and ESP-IDF.
I'm a bit confused about how I could achieve the same with the ESP32. Well, in fact I want to use an L298N circuit instead of the L293D but as far as i understand they work in a similar way.
My first question is about voltage. If I did understand right PWM works by upping and lowering the signal in the output pin in a very fast and precise way, so that the final result is that instead of getting and average of 5 volts in the output it might look like 4 volts, 3 volts or whatever. The driver checks this voltage and depending on it sends "more power" to the DC motor? Or maybe it justs turns it on an of in the same rate as the PWM signal?
If I did understand right the GPIO pins in the Devkit board work at 3.3volts so that this mean that the driver will move the motor more slowly ? Or am I mislead and the only thing that matters is the frequency of the signal?
Apart from that. What is the difference between the PWM in an arduino GPIO pin and the ones in the ESP32? I've read that there are 2 kinds of PWM in the ESP32 the so called LED PWM and the MCPWM.
By the name it seems that I should use the Motor Control PWM but looking at the example code I see that I have to configure 2 pins for the PWM unit, not just one as I would expect. Sadly the examples do not show any schematichs or wiring diagrams so I'm not sure how I'm supposed to hook those 2 pins to the L298N. Can I just attach one of those two pins of the controller to the enable pin of the L298N and manage the directions pin with two regular digital pins? Is the second pin useless in my case?
Thanks.