(dual motor driver)MDDS30 programming and connection problem

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

(dual motor driver)MDDS30 programming and connection problem

Postby jackielj » Sat Apr 07, 2018 11:47 am

I am new to the Arduino kit and the dual driver.

Recently, I just bought the MSSS30 as the motor driver for my wheelchair project(2 wheels).

My goal is to motorized the wheels and I chose to use the combination of the dc motor driver, Arduino kit and the Arduino shield V2 as my parts.

I used the following link as my reference to set up my model.

https://www.youtube.com/watch?v=6RxugAY1-TU

Please adjust the time to 3:00 to watch the setup.

My question is that which mode should I choose? (Analog joystick to PWM?)

The mode I used right now is 01 00 00 00(Analog mixed mode?) I'm very confused about this.

My goal is to control the wheels using a joystick which can achieve going forward, going backward, turn left, and turn right.

The other major problem is about the code. Because I am really new to the coding part, I hope someone can help me with it.

The current code I used is following:
CODE: SELECT_ALL_CODE
#include <Cytron_SmartDriveDuo.h>
#define IN1 4 // Arduino pin 4 is connected to MDDS30 pin IN1.
#define AN1 6 // Arduino pin 5 is connected to MDDS30 pin AN1.
#define AN2 5 // Arduino pin 6 is connected to MDDS30 pin AN2.
#define IN2 3 // Arduino pin 7 is connected to MDDS30 pin IN2.
Cytron_SmartDriveDuo smartDriveDuo30(PWM_INDEPENDENT, IN1, IN2, AN1, AN2);

char inChar;
signed int speedLeft, speedRight;

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
 
  digitalWrite(13, HIGH);
  delay(2000); // Delay for 5 seconds.
  digitalWrite(13, LOW);
}

void loop()
{
  int motorspeedA = analogRead(A0);
 
  speedRight = map(motorspeedA, 0, 1023,-100,100);
 
  int motorspeedB = analogRead(A1);

  speedLeft = map(motorspeedB, 0, 1023,-100,100);

   smartDriveDuo30.control(speedLeft, speedRight);

   delay(100);
 
}



It is possible that I could have some ridiculous mistakes in my code. Appreciate it if someone could give me some suggestion or advice.

One thing to mention is that I also want to add some function like when the joystick is near the center position, give a range to the value so that the motor will stop when it is near the center part.

Also, a function that will keep the motor not rotating when it is at low rpm like 30rpm.



In general, my questions are:

1. Which mode should I choose by using a joystick connected to Arduino kit to control motors?

2. Do you have any suggestion on how should I connect all these parts?

3. Do you have advice on how should I revise my code or even a general code for joystick control motors?

4. I want to add functions like keep motors rest when the joystick is near its center, also make it rest when the rpm is low.
jackielj
Fledgling
 
Posts: 1
Joined: Sat Apr 07, 2018 10:53 am

Re: (dual motor driver)MDDS30 programming and connection pro

Postby Idris » Mon Apr 09, 2018 8:39 am

Hi jackielj,

I will focus on your objective which "is to control the wheels using a joystick which can achieve going forward, going backward, turn left, and turn right." This setup video (https://www.youtube.com/watch?v=PrvsJ_YS0No) is the best explaination. We use:
1. Cytron SmartDriveDuo-30
2. Breakout Board with Joystick Soldered

Follow exactly the steps show in the video. No microcontroller/programming is required for this mode (ANALOG MIXED MODE).

Hope this helps.

Thanks.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: (dual motor driver)MDDS30 programming and connection pro

Postby mscholl » Thu Sep 13, 2018 10:43 am

HI! I appreciate the video link for setting up the MDDS30 directly with an analog joystick. Is it possible to add a potentiometer to slow down the speed in addition to the throw of the joystick, or would it need to be added thru an arduino? For example, if I only want the the motors to go at half speed, and don't want to hold the joystick in a middle position of the axis, how could I achieve this?
mscholl
Newbie
 
Posts: 10
Joined: Sat Sep 09, 2017 8:55 pm

Re: (dual motor driver)MDDS30 programming and connection pro

Postby ZaM » Tue Sep 18, 2018 11:49 am

HI,

Personally i recommend to use PWM input mode with microcontroller (Independent Both) because the code will be easier as you can use normal motor driver code (MD10C, MDD10C, MD30C, L298N (need changes for single DIR pin)). For wire connection, you can refer to User Manual page 16 https://docs.google.com/document/d/1OstW8T0kRIopWSuMEOyG2h9KNhQ3O4yowwjnp40Z23o/view.
ZaM
Moderator
 
Posts: 78
Joined: Tue Nov 23, 2010 4:16 pm

Re: (dual motor driver)MDDS30 programming and connection pro

Postby mscholl » Sun Sep 23, 2018 2:43 am

Yes, but the question is, CAN I control the max speed using a potentiometer in addition to the joystick WITHOUT using a microcontroller? I am trying to decide between your motor driver and another for a project, and the other allows for this. I would like to do this on yours as well, but need to know which pin to use and the dipswitch configuration.
mscholl
Newbie
 
Posts: 10
Joined: Sat Sep 09, 2017 8:55 pm

Re: (dual motor driver)MDDS30 programming and connection pro

Postby Idris » Tue Sep 25, 2018 9:48 am

Hi mscholl,

MDDS30 don't have feature like you mentioned. Thanks.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 16 guests

cron