Close

Low level DC motor driver

A project log for Mini WiFi/BLE 4WD robot platform

A compact & modular WiFi/BLE controlled 4WD robot platform with all required sensors

stefanStefan 06/18/2017 at 19:171 Comment

The motors are driven by a DRV8833 dual H-bridge circuit. The principle of such a control is pretty simple, the H – bridge hold one terminal of the motor to ground while the other is set to Vdrive. For the reverse direction it’s just the other way round.

The bridge is controlled by two inputs for both side of the bridge and if they haven’t the same state the motor turns in one or the other direction. You’ll find a very detailed explanation about here: http://www.modularcircuits.com/blog/articles/h-bridge-secrets/h-bridges-the-basics/.

To control the speed of the motor a PWM signal is applied to one input while the other input is hold to LOW. A PWM signal is what is generated with the Arduino when the analogWrite() procedure is used. In the current stage the Arduino IDE for the ESP32 can’t do such a analogWrite() procedure not yet exactly, a espressif call is required therefore – this is why the drive on github is still in development state, but it has been promised that even a much more accurate driver function will come. – For an analog output the ESP32 would have even to DAC for a real analog value but they can’t be used with the H-bridges.

Theoretical it would be also possible to keep one input of the bridge on a HIGH state instead of a LOW state while applying a PWM signal on the other input. This would change the turn direction and changing the control from fast to slow instead from slow to fast but would work as well. In the same way? Not in the same way exactly as the datasheet of Ti shows:

The table shows that in this case “slow decay” instead of “fast decay” will be applied. The difference between those two modes is that the terminals of the motor are either shortened or open while the not powered phase of the PWM cycle.

This means with “Fast decay” the robot is just free rolling while there isn’t power on the motor while it does kind of break speed depended in the “Slow decay” mode. This has no impact on the top speed only the movement should be more accurate and the way to stop should be shorter. The last should be of relevance for this robot platform. This as the max speed is that high that it needs to be reduced pretty much when realizing a line follower. The “Slow decay” mode should help to increase its reactivity for such an application.

Discussions

Christophe wrote 01/20/2018 at 13:58 point

Hi Stefan,

I plan to drive small vibrating coreless DC motors from a ESP32 and your post is quite interesting for me.

Looking at the drv8833 specifications, it looks to be designed for DC brushed motor but you are using coreless motors. Can you confirm you did not get any issue with it ?

Regarding missing analogWrite() on ESP32, would it be feasible to emulate PWM ( https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM ) by software using ESP32 multithreading capabilities ? Here is an example ( https://github.com/copercini/esp32-iot-examples/blob/master/multiloop/multiloop.ino ) where each loop could modulate a PWM signal on a pin until the frequency change and another loop is started. What do you think ?

Kind Regards,

Christophe

  Are you sure? yes | no