Control Large Gearmotors with PWM & Arduino
Pulse Width Modulation (PWM) is the ideal method of controlling large DC gearmotors, but driving these motors can often be challenging and expensive. Today I will show you an inexpensive and efficient H-Bridge motor controller - the Cytron MD10C.
I’ll also show you how raising the PWM frequency can make your motor controller design far more efficient.
Article with code: https://dbot.ws/dcpwm
We have used PWM to control small DC motors many times but what happens when you need to control a bigger motor? The L298N is the usual “go-to” motor controller but it doesn’t have the current capability to handle anything that draws over 3.5 amperes., so it won’t work with large motors.
Most large H-Bridge controllers are expensive, many cost as much or even more than the motor they are driving. But there are a few inexpensive options, and I’ve got a great one for you today.
The Cytron MD10C is a single-motor H-Bridge controller that can support motors that draw up to 13 amperes continuous, with peaks of up to 30 amperes! Amazingly this device is not only cheap, it also is so efficient that it doesn’t even require a heatsink to source those impressive current levels.
It is a very easy controller to use with an Arduino. I’ll show you how to hook it up as well as how to code for it. But it doesn’t stop there.
We’ll put our motor controller to the test and observe its performance. I will then “fine-tune” it to run a LOT more efficiently, and I’ll demonstrate its capabilities by driving a 10 Kg (22 lb) weight around the room!
We’ll then look at an improved Arduino design to control our DC gearmotors.
Here what we will cover in today's video:
00:00 - Introduction
03:04 - H-Bridge Design
04:57 - Cytron MD10C
08:03 - Arduino PWM Sketch
13:57 - Arduino PWM Test
18:25 - High Frequency PWM Test
23:11 - First Load Test
26:13 - Arduino High Frequency PWM Sketch & Test
"Never trust a computer you can’t throw out a window." — Steve Wozniak
What am I missing?
On line 23 in the "pwm_motortest.ino" file and on line 26 in the "pwm_motortest_hi.ino" file you define the Analog pin "diy_pwm" as A2. I thought this was A0. Or is it somehow modified by the library for LCD_Key?
I think the "diy_pwm" define statement is an artifact from the Cytron code you said you had to modify to get the code to run. I have eliminated that code and it seems to compile and upload just fine. Haven't connected it to my Cytron motor drivers yet, but it appears that that define statement can be safely deleted.
But the display changes its DIR variable on pressing the "left" button and the PWM variable goes "up" and "down" when the appropriate button is depressed.
The analog pin used on the LCD Keypad is actually A0 and not A2. It is actually defined via the LCD_Key library and not in the pwm_motortest.ino or the pwm_motortest_hi.ino sketches.
In trying to help a fellow forum member, I have recreated your demo and have things working even with the item I have identified above. I now would like to hook my scope up to see the two traces you were showing.
My question is exactly where did you connect the two traces of your scope? I'm assuming the first probe was directly from the PWM signal come from digital pin 3 on the Arduino, but I'm having trouble figuring out where the second scope probe is connected,
I was going to do the same thing! From his video it seems he goes directly to the output of the MC10 driver board. This would show the PWM signal going to the motors.
From my statement above I just eliminated that define statement, so there was "no other name" assigned. It has been sometime since all this was fresh in my mind, so the details are a little sketchy.