This is my first post and I'm just asking a little bit about motor control in a team project I'm a member of.
This is a bit of a "not so serious" project, so probably the solar panel system consumes much more energy than it generates but anyway: our parts budget for the project was not very extensive and we just had whatever was available at the school for parts.
So, we are using a DC motor to control the rotation of a solar panel tracker system. It was given to us by our teacher so we don't know much about it. We did test that it works at full speed in both directions, but as the supply voltage became too low, it didn't work so well (less than 3 V wasn't very good).
The system works like this:
- There is a solar panel plate to which the solar panel attaches on a hinge, and the other end of the solar panel has a hinge and a part into which the "top-end" of screw attaches, and solar panel is able to tilt, by using a screw, which is turned by the stepper ("bottom-end" of screw is attached at the stepper). The stepper is mounted on a hinge at the solar panel plate
- That solar panel plate has wheels at the bottom,
- Then there is a second "baseplate" and the solar panel plate rests on that baseplate.
- The baseplate has the DC motor which turns the solar panel plate, the rotation part.
Then we have that L298n chip.
The tilting axis is controlled with a separate stepper motor.
I think we are connecting 12 V into the power of the DC motor, but this results in too fast a speed for the motor.
I think that after consulting an Arduino tutorial (and the chip L298 datasheet), it was recommended to use PWM into the enableB pin, to control speed.
We are using SCtimer functionality from the LPCxpresso to pulse the PWM
Questions:
It appears that on this website, it was recommended to PWM into the in3 and in4 pins, see L298n PWM frequency. Is it a better solution to PWM into the in3 and in4 pins, as opposed to the enableB pin? We require good speed control in our project, and the motor speed should be able to be fairly slow, and we would want to have the ability to rapidly stop also. Overall, I would say that we require of the motor: slow speed, ability to stop quickly, ability for direction changes.
I would say that of course one channel PWM into the enableB pin is the simplest PWM in the software to configure, but I suppose that we could also make a two channel PWM, while leaving the enableB pin = TRUE. Then we could control the directions by changing the duty cycles of in3, and in4, by switching around the duty cycles like (0%, 25%) and vice-versa. I suppose we could also have the stop motor at (0%, 0%)
Is there any way to know a good PWM frequency for a DC motor, if you don't know much about that motor directly in terms of specs and datasheet, and make & model? I think that we succeeded in some early tests with 1 kHz PWM, but some of our classmates had used that same DC motor with about 400 Hz PWM.