MD30C causing Arduino to hang/freeze

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

MD30C causing Arduino to hang/freeze

Postby neuroclast » Sun Sep 04, 2016 9:23 am

Hi,
I am using the MD30C to control a rather large motor powered by a 12VDC battery. The battery also powers an Arduino Uno. The problem I'm having is when the motor uses very much current, it causes the Arduino to hang and the motor just continuously outputs the same speed.

I am using a PWM pin from the Uno to control the PWM pin on the MD30C, a digital output for DIR and the ground is linked to the Uno ground.

Any help would be appreciated!
neuroclast
Greenhorn
 
Posts: 3
Joined: Sun Sep 04, 2016 9:20 am

Re: MD30C causing Arduino to hang/freeze

Postby Idris » Sun Sep 04, 2016 9:51 am

Hi neuroclast,

What type/spec of battery and motor do you used? If you don't mind, could you share your hardware setup photo/video and Arduino program?
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: 368
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang

Re: MD30C causing Arduino to hang/freeze

Postby neuroclast » Mon Sep 05, 2016 1:47 am

Idris wrote:Hi neuroclast,

What type/spec of battery and motor do you used? If you don't mind, could you share your hardware setup photo/video and Arduino program?


Thanks for responding! It's a 12V 12Ah SLA battery. The motor is 12VDC, 17A. The "chuck" stuff is just an I2c interface to a wireless Wii Nunchuck.

Here is the code:

Code: Select all
#include "Wire.h"
#include "WiiChuck.h"

WiiChuck chuck = WiiChuck();

void setup() {
  Serial.begin(115200);
  chuck.begin();
  chuck.update();

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
}

void loop()
{
  delay(20);
  chuck.update();

  int speedVal = chuck.readJoyY();

  Serial.print("Speed: ");
  Serial.print(speedVal);
  Serial.println();

  int speedPWM = abs(speedVal * 2);
  if(speedPWM > 255)
    speedPWM = 255;

  if(speedVal < -5)
  {
    digitalWrite(2, LOW);
    analogWrite(3, speedPWM);
  }
  else if(speedVal > 5)
  {
    digitalWrite(2, HIGH);
    analogWrite(3, speedPWM);
  }
  else
  {
    digitalWrite(2, LOW);
    analogWrite(3, 0);
  }
}


And here is the circuit setup:
circuit.png
neuroclast
Greenhorn
 
Posts: 3
Joined: Sun Sep 04, 2016 9:20 am

Re: MD30C causing Arduino to hang/freeze

Postby neuroclast » Sun Sep 11, 2016 10:21 am

Tried putting a 1000uF decoupling cap on the Arduino power inputs, and a 0.1uF cap on my motor to help with noise.

Didn't help unfortunately.

Any advice would be appreciated!
neuroclast
Greenhorn
 
Posts: 3
Joined: Sun Sep 04, 2016 9:20 am

Re: MD30C causing Arduino to hang/freeze

Postby Idris » Sun Sep 11, 2016 12:57 pm

12V 17A is quite powerful motor. Could you share the link?

My suggestion is try to use different power supply for Arduino. Means you need 2 batteries, 1 for Arduino and another for motor. For Arduino, low spec 12V battery is enough (e.g 12V 1A).
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: 368
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 9 guests