dchurch24
Posts: 70
Joined: Thu Dec 06, 2012 7:29 pm

How to control this motor speed with PWM?

Thu Aug 15, 2019 12:41 pm

Hi,

I'm thinking about getting this motor:

https://thepihut.com/products/turbo-met ... m-2-2kg-cm

...but looking at it, I can only see the two connectors on the back of it.

I have a 12v2w PSU already, but am confused about how I would control the speed of this motor down to say 40 RPM and up to 160 RPM.

I've controlled servos from a Pi using Python, and have used GPIO for many things; LEDs, LED strips, footswitches etc... and now want to understand motors, specifically the speed control through PWM.

I do have a project in mind later down the line, so that's why I chose this motor (2kg-cm torque).

Would I need a motor driver? If so, which one?

If someone could point me in the right direction, I would be very grateful.

User avatar
joan
Posts: 14188
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 1:18 pm

You need a motor driver. You need a motor driver for all types of motor. Servos have them built-in. Other types of motor normally don't.

A L298N based board should be fine, perhaps even a L9110S based board although 1 amp stall current might be a problem. You can get those boards for a few GBP from eBay.

Using PWM on the motor driver inputs will let you control the motor power and thus speed.

https://www.4qd.co.uk/docs/what-is-pwm/

Any of the GPIO libraries will let you generate suitable PWM signals on the GPIO.

dchurch24
Posts: 70
Joined: Thu Dec 06, 2012 7:29 pm

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 1:34 pm

Thank you. I thought I would need one.

I'll get on ebay :)

I have used the PWM with things like dimming and brightening an LED - just figured I'd learn a little about motors.

dchurch24
Posts: 70
Joined: Thu Dec 06, 2012 7:29 pm

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 1:39 pm

It doesn't matter that they say the drivers are for stepper motors, does it? Does that just mean that there will be extra outputs that I won't use?

https://www.ebay.co.uk/itm/L298N-Board- ... SwDLhdVPXS

pcmanbob
Posts: 6641
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 2:05 pm

dchurch24 wrote:
Thu Aug 15, 2019 1:39 pm
It doesn't matter that they say the drivers are for stepper motors, does it? Does that just mean that there will be extra outputs that I won't use?

https://www.ebay.co.uk/itm/L298N-Board- ... SwDLhdVPXS
That motor drive board will be just fine for your motor .

you will just use one of the outputs to connect your motor to , the other one could be used to control a second motor.

this image gives you the basic connections

Image

and this is an example of the pi driving just one motor with the same L298N board.

Image
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

dchurch24
Posts: 70
Joined: Thu Dec 06, 2012 7:29 pm

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 2:52 pm

Lovely! On order as we speak :p

Thank you for taking the time to reply.

Truly appreciated.

pcmanbob
Posts: 6641
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 3:04 pm

This might also be of interest.

https://www.electronicshub.org/raspberr ... pberry-pi/

Just one of many on line
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

dchurch24
Posts: 70
Joined: Thu Dec 06, 2012 7:29 pm

Re: How to control this motor speed with PWM?

Thu Aug 15, 2019 3:26 pm

Brilliant. Thank you.

I did read some tutorials, but was getting a bit lost as some of the motors I was looking at mentioned that they weren't for use with PWM, so wanted to make sure the one I was looking at could be speed controlled.

Return to “Automation, sensing and robotics”