Let's Make Robots!

Red Back Spider robot controller


AttachmentSize
Spider_Controller_Instrucuction_Manual.pdf700.99 KB
Vendor's Description: 


The Red Back Spider controller is an Arduino compatible robot controller designed specifically for robots that use a large number of servos such as humanoids, Hexapods and serpents. With it's built in 3A switchmode power supply the controller can power and control up to 48 miniature servos

Features:

  • ATmega1280 MCU with 128K FLASH, 8K SRAM and 4K EEPROM
  • 3A, 5V switchmode power supply. Input voltage: 7V to 30V
  • 70 I/O pins terminated with a servo compatible 3 pin male header and a female header
  • USB interface and ISP socket
  • Power switch and reset button
  • Pin spacing allows custom sheilds to be made using standard prototype PCB's
  • Comes with Arduino bootloader installed
  • 16x 10 bit analog inputs
  • Up to 15x PWM outputs (depends on the number of servos in use)
  • 4x serial ports (1 used by USB interface)
  • 1x I²C interface
  • Can drive up to 48 servos using the Arduino servo library

Video of 48 servos: http://www.youtube.com/watch?v=SQN42dEiugk
Video of robot Spider: http://www.youtube.com/watch?v=7hG6Amnb9Mo
DAGU products support site: https://sites.google.com/site/daguproducts/

 

Now there is an optional Shield available that allows high powered servos to be driven directly from the battery or an external power supply. This smaller PCB does not block access to the Spiders pins allowing smaller servos to be driven from the Spiders 5V supply while high powered servos can be run directly from a 6V or 7.2V battery.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I almost said something similar to OddBot's post.

Attaching a zip file is one option for sharing code another option is to use GitHub which allows others to access your code easily. Another option for sharing code is to copy the code to your public DropBox folder and share the link here. I know there are lots of other ways to share code but these are the methods I've used.

Since no one has replied to your post directly, you can edit it (and please do so).

I also agree with OddBot's comment about posting a general software question in a thread about specific hardware. As you said "this question is more about my general code". So ask again but this time in the forum. There are plenty of people who are willing to try to help.

When you ask in the forum, give us some more information about your robot.

DO NOT POST YOUR CODE LIKE THAT!

Now everyone on the planet must scroll through pages of your code to read any future questions and answers. Please edit your post and delete the code!

This forum is for questions about the hardware.

If you have a question about your code and want help then you should create a separate forum and post your question there. Attach your code as a zip file. If necessary incluse a small, relavent segment of your code with the question to help clarify your question.

You will then get help from many members.

 

Hi,

As you can probably tell I'm new at this and could do with some contructive advice. I have 2 problems, 1 is that no matter how I try when I put sonar ping in the code the robot just stopps and won't move at all or the servos' just move to random positions and stops. I think that's for another time though!

But this question is more about my general code, as I think just getting it walk in a streight line is probably my first task and generally, get right, improve and make more efficient the code.

To get it to move at all, i'm having to put delays between the movement of every servo, which dosn't seem correct to me. I've been through the manual for the controller and as per IOpins.h believe got them attached so that the timers are correct.

Any help at all greatly appreciated!

IOpins.h

//============================================================== Body

// leg 1 front left

#define FLApin 32

#define FLKpin 31

#define FLHpin 30

 

// leg 2 front right

#define FRApin 37

#define FRKpin 36

#define FRHpin 35

 

// leg 3 middle right

#define MRApin 42

#define MRKpin 41

#define MRHpin 40

 

// leg 4 middle left

#define MLApin 22

#define MLKpin 23

#define MLHpin 24

 

// leg 5 rear left

#define RLApin 27

#define RLKpin 28

#define RLHpin 29

 

// leg 6 rear right

#define RRApin 50

#define RRKpin 49

#define RRHpin 48

 

//============================================================== Head

//#define TRIGGER_PIN A15 //A3

//#define ECHO_PIN A14 //A2

----------------------------------------------------------------------------------------------------------------------------------------------------------

Constants.h

//============================================================== Body

 

// leg 1 front left

#define FLAcenter      1500

#define FLKcenter      1450

#define FLHcenter      1400

// leg 2 front right

#define FRAcenter      1500

#define FRKcenter      1500

#define FRHcenter      1500

// leg 3 middle right

#define MRAcenter      1550

#define MRKcenter      1550

#define MRHcenter      1450

// leg 4 middle left

#define MLAcenter      1500

#define MLKcenter      1500

#define MLHcenter      1480

// leg 5 rear left

#define RLAcenter      1500

#define RLKcenter      1400 

#define RLHcenter      1550

// leg 6 rear right

#define RRAcenter      1500

#define RRKcenter      1550

#define RRHcenter      1550

 

 

//=============================================================Head

 

//#define PANcenter      1500    // Pan  servo center position 

//#define TILcenter      1500    // Tilt servo center position

------------------------------------------------------------------------------------------------------------------------------------------------

Sipiderbot-maincode

#include <Servo.h>

#include <NewPing.h>

#include "IOpins.h"

#include "Constants.h"

 

// define global variables and servos here

 

// Power HD HD-1501MG pulse width range 800>2200 / neutral position center

// Using 1000 - 2000 with center neautral - Counterclockwise (when center-2000 μsec) 

 

int svc[18]={                                              // servo center positions (typically 1500uS)

FLAcenter, FLKcenter, FLHcenter, FRAcenter, FRKcenter, FRHcenter,

MRAcenter, MRKcenter, MRHcenter, MLAcenter, MLKcenter, MLHcenter,

RLAcenter, RLKcenter, RLHcenter, RRAcenter, RRKcenter, RRHcenter};

 

Servo sv[18];                                              // servos array

 

int Time=80; 

int Rotate=250; // 300

int Raise=250; // 300

int BigRaise=450; //450

 

int leftDistance;

int rightDistance;

int fwdDistance;

int DistanceCm;

int dist;

 

#define TRIGGER_PIN A15 //A3

#define ECHO_PIN A14 //A2

#define MAX_DISTANCE 200

 

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

 

void setup()

{

 

 

//============================================== attach body servos

 

 // leg 1 front left

  sv[0].attach(FLApin,800,2200);                              // FLA

  delay(40);

  sv[1].attach(FLKpin,800,2200);                               // FLK

  delay(40);

  sv[2].attach(FLHpin,800,2200);                               // FLH 

  delay(40);

 

  // leg 2 front right 

  sv[3].attach(FRApin,800,2200);                               // FRA

  delay(40);

  sv[4].attach(FRKpin,800,2200);                               // FRK

  delay(40);

  sv[5].attach(FRHpin,800,2200);                               // FRH

  delay(40);

 

  // leg 3 middle right

  sv[6].attach(MRApin,800,2200);                               // MRA

  delay(40);

  sv[7].attach(MRKpin,800,2200);                               // MRK

  delay(40);

  sv[8].attach(MRHpin,800,2200);                               // MRH

  delay(40); 

 

  // leg 4 middle left

  sv[9].attach(MLApin,800,2200);                              // MLA

  delay(40);

  sv[10].attach(MLKpin,800,2200);                               // MLK

  delay(40);

  sv[11].attach(MLHpin,800,2200);                               // MLH

  delay(40);

 

  // leg 5 rear left

  sv[12].attach(RLApin,800,2200);                              // RLA

  delay(40);

  sv[13].attach(RLKpin,800,2200);                              // RLK

  delay(40);

  sv[14].attach(RLHpin,800,2200);                               // RLH

  delay(40);

 

   // leg 6 rear right

  sv[15].attach(RRApin,800,2200);                              // RRA

  delay(40);

  sv[16].attach(RRKpin,800,2200);                              // RRK

  delay(40);

  sv[17].attach(RRHpin,800,2200);                               // RRH

  delay(40);

 

  //============================================== attach head servos

 

  //sv[18].attach(PANpin,1000,2000);                               // head

  //delay(40);

 

  // =============================================initialize servos

 

  for(int i=0;i<18;i++)

  {

    sv[i].writeMicroseconds(svc[i]);                       // initialize servos

  }

 

  delay(1000); 

 

}

//============================================================== Main Loop

void loop() 

{

  // put your main code here, to run repeatedly:

ping();

 

// delay(50);

 

// dist = sonar.ping_median(5); //median off 5 values

// dist = sonar.convert_cm(dist); //convert that to cm, replace "cm" with "in" for inches

 

// DistanceCm = dist;

 

 while (DistanceCm >= 0) // & dist != 0) // If nothing within 30cm,

 {

  walk();

 }

 

// {

   center();

 

// }

 

 

//walk(); //168

//reverse(); //313

//turnleft();

//turnright();

//getbig();

//croutch(); //271

//center(); // 158

//waycheck(); //679

//decide();

}

 

void ping()

//======================================================ping

{

delay(50);

 

 dist = sonar.ping_median(5); //median off 5 values

 dist = sonar.convert_cm(dist); //convert that to cm, replace "cm" with "in" for inches

 

 DistanceCm = dist;

}

//======================================================Ping

 

 

void center()

//======================================================center

{

delay(Time);

 

  // raise first set 3 legs

      sv[1].writeMicroseconds(FLKcenter);  

  delay(Time/2);

          sv[0].writeMicroseconds(FLAcenter);

  delay(Time/2);

      sv[7].writeMicroseconds(MRKcenter);

  delay(Time/2);

          sv[6].writeMicroseconds(MRAcenter);

  delay(Time/2);

      sv[13].writeMicroseconds(RLKcenter);

  delay(Time/2);

          sv[12].writeMicroseconds(RLAcenter);

 

// Center second hips

  delay(Time/2); // 100

      sv[5].writeMicroseconds(FRHcenter); 

  delay(Time/2);

      sv[11].writeMicroseconds(MLHcenter);

 delay(Time/2);

      sv[17].writeMicroseconds(RRHcenter); 

 

 // Lower first set 3 legs

  delay(Time/2);  // 100   

      sv[1].writeMicroseconds(FLKcenter); 

  delay(Time/2);

          sv[0].writeMicroseconds(FLAcenter);  

  delay(Time/2);

      sv[7].writeMicroseconds(MRKcenter);

  delay(Time/2);

         sv[6].writeMicroseconds(MRAcenter);

  delay(Time/2);

      sv[13].writeMicroseconds(RLKcenter);

  delay(Time/2);

          sv[12].writeMicroseconds(RLAcenter);

 // delay(Time/2); 

 

//raise second set 3 legs

 

   delay(Time/2); // 100

      sv[4].writeMicroseconds(FRKcenter);             

   delay(Time/2);

        sv[3].writeMicroseconds(FRAcenter); 

   delay(Time/2);

      sv[10].writeMicroseconds(MLKcenter);

   delay(Time/2);

         sv[9].writeMicroseconds(MLAcenter);

   delay(Time/2); 

      sv[16].writeMicroseconds(RRKcenter);

   delay(Time/2); 

          sv[15].writeMicroseconds(RRAcenter);

  // delay(Time/2); 

 

   // Center first hips

   delay(Time/2);   // 100

      sv[2].writeMicroseconds(FLHcenter); 

   delay(Time/2);

      sv[8].writeMicroseconds(MRHcenter);

   delay(Time/2);

      sv[14].writeMicroseconds(RLHcenter);

  // delay(Time/2);

 

   // Lower second set 3 legs

   delay(Time/2);  // 100 

      sv[4].writeMicroseconds(FRKcenter); 

   delay(Time/2);

          sv[3].writeMicroseconds(FRAcenter);

   delay(Time/2);

      sv[10].writeMicroseconds(MLKcenter);

   delay(Time/2);

           sv[9].writeMicroseconds(MLAcenter);

   delay(Time/2);

      sv[16].writeMicroseconds(RRKcenter); 

   delay(Time/2);     

            sv[15].writeMicroseconds(RRAcenter);

   delay(Time/2);

 

}

 

 

void walk()

//======================================================walk

 

{

 

  delay(Time);

 

  // raise first set 3 legs

      sv[1].writeMicroseconds(FLKcenter+Raise);  

  delay(Time/2);

          sv[0].writeMicroseconds(FLAcenter-Raise);

  delay(Time/2);

      sv[7].writeMicroseconds(MRKcenter+Raise);

  delay(Time/2);

          sv[6].writeMicroseconds(MRAcenter-Raise);

  delay(Time/2);

      sv[13].writeMicroseconds(RLKcenter-Raise);

  delay(Time/2);

          sv[12].writeMicroseconds(RLAcenter+Raise);

 

// Center second hips

  delay(Time/2); // 100

      sv[5].writeMicroseconds(FRHcenter); 

  delay(Time/2);

      sv[11].writeMicroseconds(MLHcenter);

 delay(Time/2);

      sv[17].writeMicroseconds(RRHcenter); 

 

   // Move first hips forwards

  delay(Time/2); // 100

      sv[2].writeMicroseconds(FLHcenter+Rotate); 

  delay(Time/2);

      sv[8].writeMicroseconds(MRHcenter-Rotate);

  delay(Time/2);

      sv[14].writeMicroseconds(RLHcenter+Rotate);            

  //delay(Time/2); 

 

 // Lower first set 3 legs

  delay(Time/2);  // 100   

      sv[1].writeMicroseconds(FLKcenter); 

  delay(Time/2);

          sv[0].writeMicroseconds(FLAcenter);  

  delay(Time/2);

      sv[7].writeMicroseconds(MRKcenter);

  delay(Time/2);

         sv[6].writeMicroseconds(MRAcenter);

  delay(Time/2);

      sv[13].writeMicroseconds(RLKcenter);

  delay(Time/2);

          sv[12].writeMicroseconds(RLAcenter);

 // delay(Time/2); 

 

//raise second set 3 legs

 

   delay(Time/2); // 100

      sv[4].writeMicroseconds(FRKcenter-Raise);             

   delay(Time/2);

        sv[3].writeMicroseconds(FRAcenter+Raise); 

   delay(Time/2);

      sv[10].writeMicroseconds(MLKcenter-Raise);

   delay(Time/2);

         sv[9].writeMicroseconds(MLAcenter+Raise);

   delay(Time/2); 

      sv[16].writeMicroseconds(RRKcenter+Raise);

   delay(Time/2); 

          sv[15].writeMicroseconds(RRAcenter-Raise);

  // delay(Time/2); 

 

   // Center first hips

   delay(Time/2);   // 100

      sv[2].writeMicroseconds(FLHcenter); 

   delay(Time/2);

      sv[8].writeMicroseconds(MRHcenter);

   delay(Time/2);

      sv[14].writeMicroseconds(RLHcenter);

  // delay(Time/2);

 

  // Move second hips forwards

   delay(Time/2); // 100

      sv[5].writeMicroseconds(FRHcenter-Rotate); 

   delay(Time/2);

      sv[11].writeMicroseconds(MLHcenter+Rotate);

   delay(Time/2);

      sv[17].writeMicroseconds(RRHcenter-Rotate);            

   delay(Time/2); 

 

   // Lower second set 3 legs

   delay(Time/2);  // 100 

      sv[4].writeMicroseconds(FRKcenter); 

   delay(Time/2);

          sv[3].writeMicroseconds(FRAcenter);

   delay(Time/2);

      sv[10].writeMicroseconds(MLKcenter);

   delay(Time/2);

           sv[9].writeMicroseconds(MLAcenter);

   delay(Time/2);

      sv[16].writeMicroseconds(RRKcenter); 

   delay(Time/2);     

            sv[15].writeMicroseconds(RRAcenter);

   delay(Time/2);

 

}

How do I add switches to Red Back Spider Robot Controller with Heavy Duty Servo Shield so that I can control the servos using push-button switches?

You will need to learn how to control servos. Look here: http://www.arduino.cc/en/Reference/Servo

Then write a program to read the switches connected to the Spider controller.

Just connect your switches between the pins you want to use and ground. Enable the pullup resistors on those pins and your done.

How do I add switches to Red Back Spider Robot Controller with Heavy Duty Servo Shield so that I can control the servos using push-button switches?

Hi! I have a problem uploading sketch, I'm getting "programmer is not responding" error. I'm working on mac. I've already installed latest FTDI drivers. Upload to UNO works as expected. Any ideas? Thanks in advance & hope it's the right place for my question.

I am confused why it says "programmer not responding" as you should not be using a programmer.if you are using the USB cable then you should just select the correct board, the correct serial com port and hit the upload button.

The new versions will let you upload directly to the ISP socket using a programmer but you should not be using that option unless you are using a seperate programmer connected to the ISP socket of the Spider controller.

Please note: the original Spider controller came with the ATmega1280 but recently the cost of ATmega2560 chips came down. The newest boards use the ATmega2560 processor.

You will need to look at the processor to see which version you have and then select the board type as either Arduino Mega (1280) or Arduino Mega2560.

Thanks! You are right, it's 2560 & I selected 1280 at first.

From what I can judge from looking at images on google I would guess I need a Mini B usb cable. Is this correct?