DC motor rotate speed is directly proportional to supply voltage and current. But it is very difficult to use software to control supply voltage and current . So use on/off time to control the DC motor is a better solution.
In my project I use TI DRV8837 to driver. DRV8837 has H-bridge structure to control motor forward/reverse rotate. So just simply add pwm input to DRV8837 then we can control the DC motor rotate speed.
1.Connect three gpio to DRV8837 nSleep , IN1 , IN2 .
2.Config PWM module and connect to IN1,IN2.
3.Now we can control DC motor rotate speed from 0 to 100% and rotate forward/reverse.
NOTICE!: It very danger when motor change rotate direction because it will shortly to turn both side H-bridge ON.It will need a short dead zone to prevent this situation.Luckily DRV8837 has build- in protection function when both IN1 IN2 are high the output will be low to stop the motor.
Ref:
1. DRV883x datasheet
2. H-bridge
訂閱:
張貼留言 (Atom)
Linux driver: How to enable dynamic debug at booting time for built-in driver.
Dynamic debug is useful for debug driver, and can be enable by: 1. Mount debug fs #>mount -t debugfs none /sys/kernel/debug 2. Enable dy...
-
The root cause is miss use a pointer to a static variable like: int x = 1; int y = (int) &x; Modify version int x = 1; int *y =...
-
We can easily get all the serial port in windows using regedit.exe In our application we read the windows register key `HARDW...
-
1.Create the project folder and win_gui_v1.go in your go work space > cd ..\src\ > mkdir win_gui_v1 2.Copy the .manifest file...
沒有留言:
張貼留言