Hey! need some help to wire my arduino to this setup using pwm, how should i wire everything related to Arduino card from this motordriver? hard to find help about this specific motordriver..
A quick look at the page you links and they link Arduino examples here and a user manual that shows how to wire it up and set jumper settings.
Ye, i can't really find the wiring scheme tho, could u help me?...
Assuming your using the Arduino UNO then...
For PWM you need to use the 2 grove connectors (N and O on the board image below)
Connector N is marked AN2, AN1, NC & GND
AN2 is the PWM input for right motor (Arduino pin 9)
AN1 is the PWM input for the left motor (Arduino pin 3)
NC is not connected (NC = No Connection)
GND is for connecting to the Arduino GND
Connector O is marked IN2, IN1, NC & GND
IN2 is the motor direction for the right motor (Arduino pin 10)
IN1 is the motor direction for the left motor (Arduino pin 4)
NC is not connected (NC = No Connection)
GND is for connecting to the Arduino GND
The manual shows the DIP switch settings needed for PWM but I have included the DIP image for completeness.
If you connect this like this then the PWM_DIR_DUAL.ino example from the Cytron github site I linked (Included below) should work.
/*******************************************************************************
* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTY AND SUPPORT
* IS APPLICABLE TO THIS SOFTWARE IN ANY FORM. CYTRON TECHNOLOGIES SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES, FOR ANY REASON WHATSOEVER.
********************************************************************************
* DESCRIPTION:
*
* This example shows how to drive 2 motors using the PWM and DIR pins with
* 2-channel motor driver.
*
*
* CONNECTIONS:
*
* Arduino D3Â - Motor Driver PWM 1 Input
* Arduino D4Â - Motor Driver DIR 1 Input
* Arduino D9Â - Motor Driver PWM 2 Input
* Arduino D10 - Motor Driver DIR 2 Input
* Arduino GND - Motor Driver GND
*
*
* AUTHORÂ : Kong Wai Weng
* COMPANYÂ : Cytron Technologies Sdn Bhd
* WEBSITEÂ : www.cytron.io
* EMAILÂ Â : support@cytron.io
*
*******************************************************************************/
#include "CytronMotorDriver.h"
// Configure the motor driver.
CytronMD motor1(PWM_DIR, 3, 4);Â // PWM 1 = Pin 3, DIR 1 = Pin 4.
CytronMD motor2(PWM_DIR, 9, 10); // PWM 2 = Pin 9, DIR 2 = Pin 10.
// The setup routine runs once when you press reset.
void setup() {
Â
}
// The loop routine runs over and over again forever.
void loop() {
 motor1.setSpeed(128); // Motor 1 runs forward at 50% speed.
 motor2.setSpeed(-128); // Motor 2 runs backward at 50% speed.
 delay(1000);
Â
 motor1.setSpeed(255); // Motor 1 runs forward at full speed.
 motor2.setSpeed(-255); // Motor 2 runs backward at full speed.
 delay(1000);
 motor1.setSpeed(0);  // Motor 1 stops.
 motor2.setSpeed(0);  // Motor 2 stops.
 delay(1000);
 motor1.setSpeed(-128); // Motor 1 runs backward at 50% speed.
 motor2.setSpeed(128); // Motor 2 runs forward at 50% speed.
 delay(1000);
Â
 motor1.setSpeed(-255); // Motor 1 runs backward at full speed.
 motor2.setSpeed(255); // Motor 2 runs forward at full speed.
 delay(1000);
 motor1.setSpeed(0);  // Motor 1 stops.
 motor2.setSpeed(0);  // Motor 2 stops.
 delay(1000);
}
I am working / learning to combine Mdds30 motordriver and Adruino Nano and controlling the speed and direction with a analog Joystick.
I got it so far that the motors are working independent on x axis and one on y axis.
I want to have both motors going forward and backwards on one axis.
I done it with a different motor-driver, but can’t figure it out using Cytron MDDS30.
Could anybody give me some advice or help me with the code.
Basically it would be the same idea as driving a wheelchair.
Thank you
Cannot find the wiring scheme please help me out waiting....
new orleans seo consultant
I wrote something that works for this.
#define enA 9
#define in1 4
#define in2 5
#define enB 10
#define in3 6
#define in4 7
#define in5 3 // switch 7
#define shooter 12
int motorSpeedA = 0;
int motorSpeedB = 0;
int shoot = 0;
void setup() {
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(in5, INPUT_PULLUP);
pinMode(shooter, OUTPUT);
}
void loop() {
int xAxis = analogRead(A0); // Read Joysticks X-axis
int yAxis = analogRead(A1); // Read Joysticks Y-axis
shoot = digitalRead(in5);
// Y-axis used for forward and backward control
if (yAxis < 470) {
// Set Motor A backward
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
// Set Motor B backward
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
// Convert the declining Y-axis readings for going backward from 470 to 0 into 0 to 255 value for the PWM signal for increasing the motor speed
motorSpeedA = map(yAxis, 470, 0, 0, 255);
motorSpeedB = map(yAxis, 470, 0, 0, 255);
}
else if (yAxis > 550) {
// Set Motor A forward
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
// Set Motor B forward
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
// Convert the increasing Y-axis readings for going forward from 550 to 1023 into 0 to 255 value for the PWM signal for increasing the motor speed
motorSpeedA = map(yAxis, 550, 1023, 0, 255);
motorSpeedB = map(yAxis, 550, 1023, 0, 255);
}
// If joystick stays in middle the motors are not moving
else {
motorSpeedA = 0;
motorSpeedB = 0;
}
// X-axis used for left and right control
if (xAxis < 470) {
// Convert the declining X-axis readings from 470 to 0 into increasing 0 to 255 value
int xMapped = map(xAxis, 470, 0, 0, 255);
// Move to left - decrease left motor speed, increase right motor speed
motorSpeedA = motorSpeedA - xMapped;
motorSpeedB = motorSpeedB + xMapped;
// Confine the range from 0 to 255
if (motorSpeedA < 0) {
motorSpeedA = 0;
}
if (motorSpeedB > 255) {
motorSpeedB = 255;
}
}
if (xAxis > 550) {
// Convert the increasing X-axis readings from 550 to 1023 into 0 to 255 value
int xMapped = map(xAxis, 550, 1023, 0, 255);
// Move right - decrease right motor speed, increase left motor speed
motorSpeedA = motorSpeedA + xMapped;
motorSpeedB = motorSpeedB - xMapped;
// Confine the range from 0 to 255
if (motorSpeedA > 255) {
motorSpeedA = 255;
}
if (motorSpeedB < 0) {
motorSpeedB = 0;
}
}
// Prevent buzzing at low speeds (Adjust according to your motors. My motors couldn't start moving if PWM value was below value of 70)
if (motorSpeedA < 70) {
motorSpeedA = 0;
}
if (motorSpeedB < 70) {
motorSpeedB = 0;
}
analogWrite(enA, motorSpeedA); // Send PWM signal to motor A
analogWrite(enB, motorSpeedB); // Send PWM signal to motor B
}```
That looks interesting. Thanks, I will experiment with it.
Thanks
Hello Carneym1982
I looked over the sketch and I don’t think it will work.
The mdds30 has only 4 inputs AN1 and AN2 and also In1 and In2.
I am using right now AN1 andAn2 connected to the Joystick. But I would like also connect 3 push buttons to simulate the Joystick.
Where the push buttons only have one preset speed .
Hi there, Could you connect the push buttons to open pins on the Arduino?
I think that's how I would set it up.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.