MDC 2250C PWM Problem

6 years 10 months ago - 6 years 10 months ago #29528556 by Martinkim
I have MDC2250C with Firmware v1.3 10/10/2013 running on Roboteq Motor Control Utility Rev 1.2 10/7/13.
serial number 1261.

When MDC 2250 is connected off RC receiver, it works fine, but when it is connected Arduino Mega 2560 with PWM output, it doesn't.
What's even more strange is this;

A: in Run Screen, PWM pulse is correctly represented (up and down count of pulses between 1000 to 2000. (in this screen motor is not running by using PWM input, but it works by moving Command Joystick slider from screen). is that normal? same thing happens when I use analog input (potentiometers), I would expect command actually drives motor, so I can compare input signals with motor movement.
they both works in configuration screen only, and I can not compare signals vs motor movement.

B: With Arduino Mega 2560 with PWM signal as an Input, from Configuration Screen (Only way to activate PWM output to drive Motors), as soon as Motor start, Motor stops and no longer responding, and Run screen PWM signal showing only 1 or 2 numeric changes in value (it showed correct value changes in Run screen)
When I restart MDC 2250, same thing happen.

C: When servo motors (Both Analog and Digital) connected to Arduino Mega 2560, they worked just fine in full PWM range. so I assume there is some bug in controller.

Am I using correct firmware?

Please help me.

Motor is 12volt 5amp regular windshield wiper motor with additional gear box configured with 250 cpr optical encoder,
Motor 1 encoder setting (range) is -75000 to 75000 (1 rotation on output shaft)
Motor 2 encoder setting (range) is -50000 to 50000 (3/4 rotation on output shaft)

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528557 by Griffin Baker
Replied by Griffin Baker on topic MDC 2250C PWM Problem
In the Run screen, there is a "Mute" button to the left of the slider. When that is check marked, this mutes the serial commands allowing the next priority to be seen and used. Whether it is the pulse or the analog, that is determined by the priority settings and what is current detected by the controller. If the mute button is not selected, only the RS232 commands can tell the motors to take action.

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528558 by Martinkim
Replied by Martinkim on topic MDC 2250C PWM Problem
Thank you very much for fast response, would you kindly help me to solve my major problem with B (Arduino PWM output not working).

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528559 by Griffin Baker
Replied by Griffin Baker on topic MDC 2250C PWM Problem
We do not specialize in the Arduino so our help on that is limited.

arduino.cc/en/Reference/HomePage

As suggested, if the RS232 is not muted, you can't control the PWM from the Arduino or the controller in the Run tab.

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528560 by fnick2812
Replied by fnick2812 on topic MDC 2250C PWM Problem
i am just curious to ask. From what you say, the scenario C works because the servo is run directly by PWM from Arduino. The scenerio B should work by using Arduino'PWM to control Roboteq and make RBT create PWM pulse to control the motor. Thus, in the case B, the profile of Arduino's pulse should follow the profile indicated in the RBT manual to make the RBT understand what u ask it to do. This is that the pulse width should be from 1ms(min) to 2ms(max). Lets say the period of PWM cycle is 5ms
--> ur PWM frequency = 200Hz with PWM duty cycle ranges from 20%(min) to 40%(max).
Then why you said smt about the PWM of 2000Hz?!! and did not say anything about duty cycle???
I have not tried using RC yet but do I understand the problem correctly?

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528566 by Martinkim
Replied by Martinkim on topic MDC 2250C PWM Problem
Here is little more detail & some code for Arduno Mega 2560 that I'm having trouble.

What works is this; Arduino Mega can control Regular RC Servo (I think PWM signal from Arduino code is compatible with standard RC PWM signal.
Roboteq MDC 2250 works, when it is connected to directly with RC Receiver by using PWM pulse as an input source. (so they must be compatible signal)

What doesn't work is Arduino PWM signal is not driving MDC 2250, even it shows correct PWM count within 1000 to 2000 pulse in Roboteq Run screen. (So my assumption is PWM signal that I'm generating from code below may not 100% compatible with DDC 2250, or RC Standard RC PWM signal although it worked with RC Servo), and I'm trying to find what is wrong.
and I tried Duty Cycle method, and same thing. (read pulse count ok, but as soon as start Arduino Freezes, just like in PWM input method.

Same wiring method was used (from controller's RS 232 port providing 5V output, and PWM input wires by using Roboteq's), no other ground was used.

Project is to stabilize 3 axis heavy duty (100 pound and more) mount (MDC 2250 driving 2 DC motor for Pan & Tilt & another RC servo handling Roll), and able to control that stabilized base by using head orientation using stabilized AHRS input from Arduino Mega with 9 dof sensor.
Objective is to precision aiming by using human head (Arduino Mega), and following that same object automatically by using PC Image recognition, and tracking program.


Code detail (Arduino Mega Generating PWM signal for my application, and additional detail)

From Arduino mega board, The timer counts clock ticks derived from the CPU clock. Using 16MHz CPU clock
and a prescaler of 8 gives a timer clock of 2MHz, one tick every 0.5?s. This
is timer resolution.
- The timer is used as cyclic upwards counter, the counter periode is set in the
ICRx register. IIRC periode-1 has to be set in the ICRx register.
- When the counter reaches 0, the outputs are set
- When the counter reaches OCRxy, the corresponding output is cleared.
In the code below, the periode shall be 20ms, so the ICRx register is set to
40000 ticks of 0.5?s/tick.
The high time shall be 1500?s, so the OCRxy register is set to 3000. A change of
the timer periode does not change this setting, as the clock rate is still one
tick every 0.5?s. If the prescaler was changed, the OCRxy register value would
be different.

This code drives three RC Channels (Set to Output Mega Port-Pin PB5-11, PB6-12, PB7-13)
Timer Sample

*/
// Init PWM Timer 1
DDRB = DDRB | B11100000; //Set to Output Mega Port-Pin PB5-11, PB6-12, PB7-13
//WGMn1 WGMn2 WGMn3 = mode 14 Fast PWM, TOP = ICRn ,Update of OCRnx at BOTTOM
TCCR1A =((1<<WGM11)|(1<<COM1A1)|(1<<COM1B1)|(1<<COM1C1)); //Clear OCRnA/OCRnB/OCRnC outputs on compare match, set OCRnA/OCRnB/OCRnC outputs at BOTTOM (non-inverting mode).
TCCR1B = (1<<WGM13)|(1<<WGM12)|(1<<CS11); //Prescaler set to 8, that give a resolution of 0.5us
ICR1 = 40000; //50hz freq (standard servos) 20ms = 40000 * 0.5us
}

void mountControlMove(int servoPitch, int servoRoll, int servoYaw) {
OCR1A = servoPitch * 2;
OCR1B = servoRoll * 2;
OCR1C = servoYaw * 2;
}

#endif

//Output Sample

DDRE = DDRE | B00111000; //Set to Output Mega Port-Pin PE4-2, PE5-3, PE3-5
TCCR3A =((1<<WGM31)|(1<<COM3A1)|(1<<COM3B1)|(1<<COM3C1));
TCCR3B = (1<<WGM33)|(1<<WGM32)|(1<<CS31);
ICR3 = 40000; //50hz freq (standard servos)
}

void mountControlMove(int servoPitch, int servoRoll, int servoYaw) {
OCR3A = servoPitch * 2;
OCR3B = servoRoll * 2;
OCR3C = servoYaw * 2;
}



#endif // #if defined (__AVR_ATmega1280__) || defined(__AVR_ATmega2560__

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528567 by roboteq
Replied by roboteq on topic MDC 2250C PWM Problem
If you can read the value, this means the capture works.

If can't drive your motor, this could be because you have the PC utility running and it takes priority over the arduino pulses. Click on the mute checkbox to silence the PC slider commands.

Or you may not be sending pulses often enough. Below 50Hz, pulse are not recognized as valid commands.

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528568 by Griffin Baker
Replied by Griffin Baker on topic MDC 2250C PWM Problem
Let's clarify a few things. So here is a checklist of what I am looking for that I didn't specify earlier. My apologies.

The Arduino is interfaced to the MDC2250 through the RS232. This is most likely done through a TTL to RS232 converter.
The baud rate is set for 115200 on the Arduino.
The pwm signal from the Arduino is connected to the MDC2250 in the pulse inputs pins.

From your post:

The Arduino can run servo motors by itself.
The MDC2250 can run the Pulse motor command when connected to the RC receiver.

The Arduino can't get the RC signal to be applied when it is connected to the MDC2250 on the Pulse inputs, but you can see the values 1000 to 2000 in the pulse inputs section of the run tab.

When all is connected, is your "Mute" button check marked in the run tab? Left of the slider. This mutes the serial connection and moves on to the pulse command input.

The run tab shows pulse inputs active, but is the Pulse LED lit red (on)?

What is the desired pulse input you are looking to use for your signal applied? Pulse width, freq., duty cycle?

Please Log in or Create an account to join the conversation.

6 years 10 months ago #29528569 by Martinkim
Replied by Martinkim on topic MDC 2250C PWM Problem
Exactly as you described, I need to use Pulse width of 50 Hz and the pulse Led is on and counting 1000 to 2000 as I'm moving sensor attached to Arduino and powered MDC 2250 is powered by controller backup power only, but as soon as motor start move (by moving sensor on Arduino, or applying power to the motor ---Emergency switch on running with main power--), Arduino freezes and pulse counting stop, and Arduino USB connection to PC is lost.

and I just received this post "Or you may not be sending pulses often enough. Below 50Hz, pulse are not recognized as valid commands." and that may be why & long way to go for me if so.


Thank you,

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.189 seconds