1
\$\begingroup\$

I am using a NodeMCU to control a BTS7960b motor driver. (datasheet of the BTS7960) This driver controls a 12v dc motor. This image shows my wiring (without the display and the buttons and with a NodeMCU instead of the Arduino nano).

My problem is, when the driver is set to maximum speed (the pins L_EN and R_EN set to high, as well as either LPWM or RPWN to 255 [pin naming visible on this page]) the output voltage to the motor is consistently only 3v instead of 12v. Because of that my 180 RPM high torque motor just runs with about ~42 RPM. Decreasing the speed also decreases the output voltage. E.g. setting the speed to 150 decreases the voltage to ~1.8v. It doesn't matter in which direction the motor is turning.

The motor, NodeMCU and driver are powered by the same power supply with a buck converter. I get the same behavior with 3.3v and 5v on the NodeMCU and the driver. What am I doing wrong?

Thanks for the help! :)

\$\endgroup\$
  • \$\begingroup\$ Is it only a problem when you try to make the motor run at full speed? Can you make the motor run at 1/2 speed? Can It run in both directions? \$\endgroup\$ – Peter Karlsen Sep 16 '19 at 7:47
  • \$\begingroup\$ @PeterKarlsen When I lower the speed the output voltage decreases too. E.g. when setting the speed to 150, the voltage is ~1.8v and it runs with ~20 RPM. I can let it turn in both directions by setting the LPWN or RPWN pin to a value between 1 and 255. I updated the original question accordingly. \$\endgroup\$ – Pothi Sep 16 '19 at 8:37
  • \$\begingroup\$ You need to isolate the source of the problem. Is it a power supply issue, software or something else. Try changing the LPWM and RPWM pins to regular GPIOs. Set one to high and the other low. That should make your motor run at full speed. If it works the problem is probably in your PWM signals. Have you measured them with an oscilloscope? \$\endgroup\$ – Peter Karlsen Sep 16 '19 at 8:48
  • \$\begingroup\$ Thank you for the hints @PeterKarlsen. I figured it out. (See my answer) \$\endgroup\$ – Pothi Sep 16 '19 at 10:02
1
\$\begingroup\$

Thanks to the hints of @Peter Karlsen I figured it out:

I was used to the 8 bit resolution for PMW of the Arduino boards. But since my NodeMCU uses an ESP8266 Chip the PMW resolution is 10 bit [reference]. So the max value is not 255 but 1023.

Changing the values in my code solved the problem.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.