Notifications
Clear all

Adeept Hexapod kit ADA033, thirteenth servo will not attach

54 Posts
4 Users
12 Likes
5,419 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro Yes, and your point is?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

Perhaps this forum doesn't support BB code. Try the <> link in the editor.

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro Ok, but that doesn't change the fact your original code needed the middle else to be (servoData-1) 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro I don't know what the <> link in the editor. means.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

Right, I did change the statement, but the thirteenth servo still doesn't move (attach). The other test code was just to prove there is nothing wrong with the servo or the connection to pin D14 on the Pixie board. I posted a notation from the servo.h file previously. Could there be an issue with how the chip timers are seized in groups of 12 servos? 

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

I also tried creating another instance of a Servo object just for the head servo, thinking that servos had to be in groups of 12. Didn't work. Also tried detaching one of the leg servos and attaching the head servo in the code. That didn't work ether.

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

The code link is between the " and the + symbols. Hover the pointer over the tools in the editor to see the tool name. Click the <> tool to add code. 

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro How is 'code' <> and 'source code' {;} different?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro Yes, that comment is concerning. What I would do if it was my code, is fix the 'off by one' statement (2nd elseif sb max-1 instead of max) and reduce the entire collection to total 11 thus keeping it below 12.

The 13 you have is 1 head, 6 L and 6R. I wouold try 1 head, 5 L, and 5 R. Give that a try and if it works then 12 is the limit.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro Another test you could do is make the head element 0. That way it should work but one leg will fail. If the head still doesn't work, then it's some other kind of problem other than indexing.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

If I can't resolve this using the Adeept Pixie board, I may try using an Arduino Nano and a 16-channel PWM servo driver board (l2C interface PCA9685) both very small. This would overcome the 12-servo limit. 

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

Still playing with the code. I commented out the 'if' test in the botHead_Sweep() function and added an output to the serial monitor if there is a call to the botHead_Sweep() function. Each time through the routine, the function prints to the monitor "Servo 12 is not attached". Servo 12 is the thirteenth servo. The leg movement pauses for the length of time it would take to perform the head sweep, and then starts over. So, at least I got the main loop right with the if/else if/else statements. Here's the code as it is now:

/*
* Adeept Hexapod test code written to test each of 
* thriteen servos.
*/
#include 
#define servoData 13  //Number of servos
#define numSweeps 2 //Number of spider bot head sweeps left and right
const int MIN_ANGLE = 10;  //Minimum sweep angle of bot head
const int MAX_ANGLE = 170; //Maximum sweep angle of bot head
int angle[servoData] = {90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90};
Servo myServo[servoData];//Create servo object.Indecies 0 through 12 (13 servos)

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < servoData; i++) { //Attach servos to pins 2 through 14
    myServo[i].attach(i + 2);
  }
  for (int i = 0; i < servoData; i++) { //Set all servos to 90 degree angle
    myServo[i].write(angle[i]);
  }
  delay(1000);//wait for a second
}
void loop() {
  for (int index = 0; index < servoData; index++) {
    if (index <= 5) {                          //Move servos on left side
      move_Servo_L(index);
    }
    else if (index > 5 && index < (servoData - 1)) { //Move servos on right side
      move_Servo_R(index);
    }
    else {
      botHead_Sweep(index); //Move head servo
    }
  }
}
//Functions
int move_Servo_L(int servo) { //Left side pivot and claw servos
  if (myServo[servo].attached()) { //If the servo is attached, proceed with the function
    myServo[servo].write(60);
    delay(500);
    myServo[servo].write(90);
    delay(500);
    myServo[servo].write(120);
    delay(500);
    myServo[servo].write(90);
    delay(500);
  } //End if
} //End function
int move_Servo_R(int servo) { //Right side pivot and claw servos
  if (myServo[servo].attached()) { //If the servo is attached, proceed with the function
    myServo[servo].write(120);
    delay(500);
    myServo[servo].write(90);
    delay(500);
    myServo[servo].write(60);
    delay(500);
    myServo[servo].write(90);
    delay(500);
  } //End if
} //End function
int botHead_Sweep(int servo) {         //Head servo pivots
  //if (myServo[servo].attached()) { //If the 13th servo is attached, proceed with the function
  Serial.print("Servo ");  
  Serial.print(servo);
  Serial.println(" is not attached");
    for (int count = 0; count < numSweeps; count++) { //The head sweeps left and right twice
      static int sweep = 10; //initialize bot head angle to 10 degrees
      while (sweep < MAX_ANGLE) {
        myServo[12].write(sweep);
        sweep = sweep + 2;
        delay(10); //wait
      }
      while (sweep > MIN_ANGLE) {
        myServo[12].write(sweep);
        sweep = sweep - 2;
        delay(10); //wait
      }
    } //End for loop
  //} //End if
}//End function

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6985
 

@zoolandermicro Why not try with 11 servos, that way if the head responds you know the issue is the 12 rule.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ZoolanderMicro
(@zoolandermicro)
Member
Joined: 4 years ago
Posts: 144
Topic starter  

Yes, I have tried that. It seems there is a limit of 12 servos per timer. It may be an issue with the Pixie board, or the Mega328P chip, or how the servo.h and timers.h files are meant to work. There is probably something I need to add in the code to enable the use of a second timer. 

ZoolanderMicro, where small ideas are a big deal


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2533
 

@zoolandermicro 

I'm curious why you're declaring the move_servo_R and _L and botHead_Sweep as int, they don't return any value and the loop doesn't seem to expect a value back from them.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Page 2 / 4