ARDUINO PWM

Thread Starter

beatsal

Joined Jan 21, 2018
392
I am trying to control 2 12 V dc motors with an arduino. Using the 2 PWM outputs of the Arduino (pins 6, 7) to connect to 2 Dafurdui HW-517 MOTOR controller. Not sure how to connect. Kindly suggest, perhaps with a sketch or description. Thanks.
 

ericgibbs

Joined Jan 29, 2010
18,767
hi beat,
Do you have an image of the HW-517 to post and any specification data.
Googling brings up different HW number types.??
E
 

Thread Starter

beatsal

Joined Jan 21, 2018
392
hi beat,
Do you have an image of the HW-517 to post and any specification data.
Googling brings up different HW number types.??
E
Thanks. Here it is.

DaFuRui 8Pack DC 5V-36V 15A(Max 30A) 400W MOS Transistor Driving Controller Dual High-Power 0-20KHz FET PWM Trigger Switch Driver Module Adjustable Switch Control Board Motor Speed Lamp Brightness
Visit the DaFuRui Store




★Operating Voltage: DC DC 5V--36V; continuous current 15A at normal temperature; power: 400W; The maximum current can reach 30A under auxiliary cooling conditions.
  • ★Trigger signal source: digital high and low level (DC3.3V--20V), can be connected to single-chip IO port, PLC interface, DC power supply, etc., can be connected to PWM signal, signal frequency 0--20KHZ support
  • ★Adopt imported dual MOS parallel active output, lower internal resistance, large current, strong power, 15A, 400W at room temperature, meeting the needs of most equipment
  • ★Application: The output can control high-power equipment, motor, bulb, LED strip, DC motor, micro pump, solenoid valve, etc. It can input PWM, control motor speed, lamp brightness, etc
  • ★Wide voltage, support PWM;Easily control high-power devices;Service life: unlimited switch; working temperature: -40-85 ¡ã C; size: 1.34x0.7x0.5inch/3.4 x 1.7 x1.2cm(L*W*H)
 

Thread Starter

beatsal

Joined Jan 21, 2018
392
Thanks Eric. So I will connect pins 3, 11 (PWM outputs of Arduino) to "Input signal (pwm)+". I will use one module (pic you showed) for each motor, hence 2 modules for 2 motors. The other confusion for me is that the Arduino pinout shows different pins (6,7) so not sure if they refer to the actual Arduino board output pins?
 

MrSalts

Joined Apr 2, 2020
2,767
Careful, D11 is no longer PWM on some newer Arduino boards. Like the "Nano Every". The "~" means PWM in the image below.

1637079391008.png
 

Thread Starter

beatsal

Joined Jan 21, 2018
392
Thanks. My question now is:
Since I am confused with the pin numbers, not sure where to connect the 2 PWM pins for the 2 motors. I have a arduino program where I used pins 3, 11 for pwm outputs. The pinout diagram you sent contradicts this. This would confirm my priogram and power supply. Hence, need to confirm pin numbers before I go ahead and connect the UNO to the motor controller. Kindly help.
For now will have to settle for forward direction ONLY to establish that the robot moves at all.
 

KeithWalker

Joined Jul 10, 2017
3,063
On the Arduino uno, pins D3 and D11 are PWM outputs that you can connect to the two PWM inputs on the HW-517. That should work with your program.
 

djsfantasi

Joined Apr 11, 2010
9,156
Note that the physical PIN numbers do not correspond to the labeled PIN numbers. I.e., pin D3 is the fourth pin on the board.

Also, note that pin D3 on the Arduino Uno is shared with the USB port and the IDE console. If you output to the console AND use D3 for PWM, you may have an issue.

The PWM pins on the Uno are 3, 5, 6, 9, 10 and 11. Perhaps you can use different pins.
 

Thread Starter

beatsal

Joined Jan 21, 2018
392
Thanks Keith and dsfantasi. Will coneect it.accordingly.
Wonder if there is a solution for reverse drive using the HW-517 say connecting them in H-BRIDGE or similar?
 

KeithWalker

Joined Jul 10, 2017
3,063
Thanks Keith and dsfantasi. Will coneect it.accordingly.
Wonder if there is a solution for reverse drive using the HW-517 say connecting them in H-BRIDGE or similar?
I had a similar requirement where, at short notice, I had to drive a small 12V motor using an arduino. I used an IRFZ44 MOSFET, with its gate switched by a transistor. I had a small 5V DPDT relay with 2 Amp contacts laying around so I used it, driven by a transistor, to reverse the motor. If you use a relay, make sure the motor has stopped before you switch the relay or the back EMF will weld or burn off the contacts.
MOSFET&Relay1.jpg
 
Last edited:

Reloadron

Joined Jan 15, 2015
7,501
I had a similar requirement where, at short notice, I had to drive a small 12V motor using an arduino. I used an IRFZ44 MOSFET, with its gate switched by a transistor. I had a small 5V DPDT relay with 2 Amp contacts laying around so I used it, driven by a transistor, to reverse the motor. If you use a relay, make sure the motor has stopped before you switch the relay or the back EMF will weld or burn off the contacts.
View attachment 252896




Why does the drawing of a 2N3904 reflect it as being a PNP verse NPN? The PNP compliment would be a 2N3906.

Ron
 

Reloadron

Joined Jan 15, 2015
7,501
Using an Arduino UNO you also want to consider:
On Arduino Uno, the PWM pins are 3, 5, 6, 9, 10 and 11. The frequency of PWM signal on pins 5 and 6 will be about 980Hz and on other pins will be 490Hz. The PWM pins are labeled with ~ sign.
So you may want to consider using pins 5&6 or any combination of the remaining four pins. Just in the interest of keeping the PWM frequency the same.

Ron
 

SamR

Joined Mar 19, 2019
5,031
As a general note, Arduino can't drive much of anything directly from a PWM pin except an LED or two. The pin is limited to 40mA max so you have to use the PWM pin to drive something else that can provide more than the 5V @ 40mA max. Module, transistor switch, relay, etc.
 
Top