I don't understand...

I am using an Arduino Mega R3 board to control 3 Hitec digital servos (HS-5645MG) using an analog input. The program is in Mathwork's Simulink (2012b). -Arduino powered through USB -Motors powered with 5V external power ~800 mA and common ground with Arduino -Input analog pin 4 using 'Arduino Analog Input' block. -Simulink blocks used to process input signal and determine motor angle based on thresholds. -Output digital pin 10 using 'Arduino Standard Servo Write' block.

The above setup is working great using some old analog servos that I had laying around, but when I try to do the exact same thing with the digital motors - NOTHING happens at all.

-If I use Simulink's Arduino Servo Sweep example model, the digital motors will sweep back and forth 180 degrees, using same power supplies described above. I am truly baffled as to what the problem could be!

Any ideas out there?

Thanks!

Need to see code and wiring diagrams.

First assumption is that something isn't wired the same.

All of the wiring is the exact same, because the only thing that I am doing in unplugging the analog servo (which is working) and plugging in the digital servo (which is not working). This is done while the model is running.

This is a picture of the entire project setup.
https://mail.google.com/mail/u/0/?ui=2&ik=7d7ec9fffc&view=att&th=13dd20bc20946c60&attid=0.1&disp=thd&zw

The analog servo (HS-300) is hooked up and the digital servo (HS-5645MG) is not.
The circuit board on the left is primarily for the analog input to the Arduino board. It contains 3 muscle sensors from Advancer Technologies (only the top one is in use at the moment) The 9V batteries are only powering the muscle sensors. The servo motors are being powered with a 5V ~800mA supply through an old cell phone charger AC-DC adapter through the 2 ‘plugs’ under the muscle sensors (1 from the power supply and 1 to the motor).

Picture of Arduino during operation:
https://mail.google.com/mail/u/0/?ui=2&ik=7d7ec9fffc&view=att&th=13dd20cdd63726b6&attid=0.1&disp=thd&zw

Picture of Circuit Board (close-up)
https://mail.google.com/mail/u/0/?ui=2&ik=7d7ec9fffc&view=att&th=13dd20d673c61bd7&attid=0.1&disp=thd&zw

My ‘code’ is generated automatically through Simulink. The block diagram is attached as a word document.

Thanks for help.

setup_4_3_13.docx (44.3 KB)

Servo test code you can try using the arduino serial monitor to see if the digital servo can be controlled. 5v is the low end for servo operation, and a big servo under load may use more than 800ma. Check the voltage when the digital servos are operating.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}