Page 1 of 1

MD30C causing Arduino to hang/freeze

PostPosted: Sun Sep 04, 2016 9:23 am
by neuroclast
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!

Re: MD30C causing Arduino to hang/freeze

PostPosted: Sun Sep 04, 2016 9:51 am
by Idris
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?

Re: MD30C causing Arduino to hang/freeze

PostPosted: Mon Sep 05, 2016 1:47 am
by neuroclast
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_CODE
#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

Re: MD30C causing Arduino to hang/freeze

PostPosted: Sun Sep 11, 2016 10:21 am
by neuroclast
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!

Re: MD30C causing Arduino to hang/freeze

PostPosted: Sun Sep 11, 2016 12:57 pm
by Idris
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).