Mdds30 and Adruino controlled by analog joystick and some er

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Mdds30 and Adruino controlled by analog joystick and some er

Postby FritzPeyerl » Mon May 03, 2021 9:55 am

I am a newcomer to Cytron smart driver and need help.
I am using a Mdds30, Adruino uno, Analog Joystick and want to control 2 motors direction and speed, to steer a platform
X axis should control forward and backward rotation on both motors at same time.
Y axis should control the speed of left motor when Joystick is pushed to left from centre and same idea for right motor.
Basically the same idea as driving a wheelchair.

How do I change the code to achieve above functions.
Your help would be very appreciated.


#include <Cytron_SmartDriveDuo.h>
#define IN1 4 // Arduino pin 4 is connected to MDDS30 pin IN1.
#define AN1 5 // Arduino pin 5 is connected to MDDS30 pin AN1.
#define AN2 6 // Arduino pin 6 is connected to MDDS30 pin AN2.
#define IN2 7 // 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(0); // Delay for 5 seconds.
digitalWrite(13, LOW);
}

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

int adc2 = analogRead(A1);
speedLeft = map(adc2, 0, 1023, -100, 100);

smartDriveDuo30.control(speedLeft, speedRight);
delay(0);

}

I got the switches on the MDDS30 set as following
1-on
2-off
3-on
4-on
5-off
6-off
7-off
8-off

x axis works perfect, push joystick forward both motors run forward and speed can be controlled
push joystick back and both motors run backwards and speed can be controlled
y axis does not work properly. push joystick to left, left motor should run only and speed should be able to be controlled,
left motor works fine, but right motor runs backwards instead being stopped.
same problem with right motor id joystick is pushed to right, right motor runs in reverse instead forward,
opposite direction to the left motor.
Is the problem in the switches or in the code?

I done some similar design with different motor drivers, but this time I need more powerful motors.
the speed of the platform will be 15 ft per minute.

hope some body understands my explanation and has some idea, where I went wrong.
FritzPeyerl
Freshie
 
Posts: 5
Joined: Fri Apr 30, 2021 2:34 am

Re: Mdds30 and Adruino controlled by analog joystick

Postby waiweng83 » Tue May 04, 2021 2:36 pm

Hi. For your application, you can connect the joystick directly to the motor driver and the Arduino Uno is not needed.
You don't even need to write a single line of code.

Just follow this video tutorial: https://www.youtube.com/watch?v=PrvsJ_YS0No

Thanks.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: Mdds30 and Adruino controlled by analog joystick

Postby FritzPeyerl » Wed May 05, 2021 12:43 am

Thanks for your reply.
I understand that I could hook up a Joystick direct and work it without an Arduino.
I have one application, where the full travel from the Joystick should only produce 25% 50% or 100% of the speed.
I wanted to control this with PMW and some switches.
If There is a better way to do that, I am open to suggestions

thanks
Fritz
FritzPeyerl
Freshie
 
Posts: 5
Joined: Fri Apr 30, 2021 2:34 am

Re: Mdds30 and Adruino controlled by analog joystick

Postby FritzPeyerl » Wed May 05, 2021 10:20 pm

During working with it and trying to set it up on my workbench, the error light starts blinking. It blinks twice and then stops for a second and another 2 blinks and the two little green LED are flashing very fast.
when I push the run buttons on either motor they are running and I can control the rotation with the push buttons
I powered down the unit reset the switches to 01000000 powered it up and still the same error message.
How can I reset the unit or did I blow some thing on the board.
FritzPeyerl
Freshie
 
Posts: 5
Joined: Fri Apr 30, 2021 2:34 am

Re: Mdds30 and Adruino controlled by analog joystick

Postby waiweng83 » Fri May 07, 2021 2:21 pm

FritzPeyerl WROTE:Thanks for your reply.
I understand that I could hook up a Joystick direct and work it without an Arduino.
I have one application, where the full travel from the Joystick should only produce 25% 50% or 100% of the speed.
I wanted to control this with PMW and some switches.
If There is a better way to do that, I am open to suggestions

thanks
Fritz


You can do that by connecting a resistor in series with the POT at 5V and GND each like this:
MDDS30.jpg
MDDS30.jpg (34.8 KiB) Viewed 9126 times


FritzPeyerl WROTE:During working with it and trying to set it up on my workbench, the error light starts blinking. It blinks twice and then stops for a second and another 2 blinks and the two little green LED are flashing very fast.
when I push the run buttons on either motor they are running and I can control the rotation with the push buttons
I powered down the unit reset the switches to 01000000 powered it up and still the same error message.
How can I reset the unit or did I blow some thing on the board.


Error LEDs blink twice indicates that there is Input error.
Since the MDDS30 is configured in Analog Lock-Antiphase mode, the input voltage must be at 2.5V (Neutral voltage) for both channels when the motor driver is powered up.
Or else, the motor driver is disabled and the error LEDs will blink 2 times.
This is a safety feature to prevent the motor start running unexpectedly during power up if your joystick is not at the neutral position.
Please refer to the user manual here: https://docs.google.com/document/d/1Ost ... 613itf790x
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: Mdds30 and Adruino controlled by analog joystick and som

Postby FritzPeyerl » Tue May 11, 2021 1:45 am

I will try the idea with the resistor, that way I could eliminate the Arduino.
Also I solved my problem, it was a mistake on my side. I picket up 5V from MDDS30 and put it onto the VI on Arduino.
Then I did not get 5V output on Arduino. After I took 12V from MDDS30 input and put connected it to VI on Arduino, I got 5V output and every thing started to work.

Anyhow, thank you everybody for their help and suggestions.

Fritz
FritzPeyerl
Freshie
 
Posts: 5
Joined: Fri Apr 30, 2021 2:34 am

Re: Mdds30 and Adruino controlled by analog joystick and som

Postby FritzPeyerl » Wed May 12, 2021 3:41 am

Waiweng83, your idea with the resistors did not work out. the idea was great, maybe there is another way to solve the problem.
at this moment the y axis runs the left motor cw and ccw and the X axis runs the right motor cw and ccw.
if I want both motors running forward, I have to have the joystick moved 45 Defr. either side for cw and ccw.
FritzPeyerl
Freshie
 
Posts: 5
Joined: Fri Apr 30, 2021 2:34 am

Re: Mdds30 and Adruino controlled by analog joystick and som

Postby hawrebelo » Tue Mar 29, 2022 3:11 pm

I agree with waiweng's reply about that
hawrebelo
Fledgling
 
Posts: 1
Joined: Tue Mar 29, 2022 3:08 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 11 guests

cron