Skip navigation
2015

77625492233d07cdc6f0cfcb1a94d9eb.jpg

After completing my last project, the "Rice Krispies Loader", I thought that a further use for my robotic arm could be turning it upside so that it became a robotic leg.

 

If you could print four of these and attach them then you'd have a quadruped "spider" robot. Though there is value in improving my version of the Rice Krispies Loader, so it could be a walking device of sorts; in the interest of time, I printed this compact and quick 3D print found on Thingiverse.

 

When printed the pieces look like this:

FullSizeRender (3).jpg

I then purchased these servos from Amazon.com. Click HERE.

 

When everything assembled:

FullSizeRender (2).jpg

This mini robot chassis is affordable and you can see how the 3D printed sheets (prior to assembly) are compact and could be easily produced for a classroom of students in a school which has at least one 3D printer.

 

Of course you need to add a micro controller to get the robot moving and for this I chose the Adruino Mega. The reason is that the device has enough digital pins to handle the 8 servo motors plus room for additional sensors. During the early stages of me programming the robot it was tethered to my desk as follows:

IMG_1826.JPG

On a cable "leash,"  the spider robot could be programmed in the Arduino IDE and then tested on the table. This was only possible because the feet of the robot would slip on the table's surface prevening it from dashing away.

 

If you had the robots set up in exactly this tethered manner; students could study bio-mimicracy; specifically programming the gait of a 4 legged animal. This would combine the subject areas of biology with technology (programming).

 

The following code could be shared with students so they could experiment with the variables and function construction and function parameters.

 

Testing the robot is easy with this code; just open the Arduino serial Monitor and use 'w' to go forward, 'a' to go left, 's' backward, 'd' right:

#include <Servo.h>
#include <SPI.h>


Servo myservo;
Servo myservo2;
//front right joins

Servo myservo3;
Servo myservo4;
//front left joins


Servo myservo5;
Servo myservo6;
/////back left joints


Servo myservo7;
Servo myservo8;
///back right joins


int pos;    // variable to store the servo position
int incomingByte;


int dspeed = 55;


void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo.write(80);
//this is the left knee

  myservo2.attach(8);
  myservo2.write(150);
  //this is the left hip
  //------------------------------

  myservo3.attach(14);  // attaches the servo on pin 9 to the servo object
  myservo3.write(170);
//this is the right knee

  myservo4.attach(15);
  myservo4.write(30);
  //this is the right hip
  //--------------------------------------

    myservo5.attach(6);  // attaches the servo on pin 9 to the servo object
  myservo5.write(40);
//this is the back left hip

  myservo6.attach(7);
  myservo6.write(80);
  //this is the back left hip
//-----------------------------------------

    myservo7.attach(21);  // attaches the servo on pin 9 to the servo object
  myservo7.write(160);
//this is the back right hip

  myservo8.attach(20);
  myservo8.write(140);
  //this is the back right leg
//-----------------------------------------




  Serial.begin(19200);



}




void loop() {
  if (Serial.available()>0) {
    // read the oldest byte in the serial buffer:

    int val = Serial.read(); // read it and store it in val

  switch(val){

    case 'w':
      Forward();
      break;


    case 's':
    Backward();
    break;

    case 'a':
    Left();
    break;

    case 'd':
    Right();
    break;

    case 'y':
    Bow();
    break;

    case 'h':
    Rise();
    break;

      case 't':
    Sit();
    break;

    case 'g':
    Stand();
    break;

    case 'c':
    Snake();
    break;

      case 'r':
    Roll();
    break;

    case 'f':
    Jump();
    break;

      case 'v':
    Tip();
    break;






  }



  }
}








  void RightOut(){
  myservo.write(30);
}


void RightIn(){
  myservo.write(120);
}


void RightUp(){
  myservo2.write(40);
}
void RightDown(){
  myservo2.write(170);
}


void LeftOut(){
  myservo3.write(110);
}


void LeftIn(){
  myservo3.write(170);
}


void LeftUp(){
  myservo4.write(150);
}


void LeftDown(){
  myservo4.write(20);
}


void BackLeftOut(){
  myservo6.write(70);
}


void BackLeftIn(){
  myservo6.write(140);
}


void BackLeftUp(){
  myservo5.write(150);
}


void BackLeftDown(){
  myservo5.write(20);
}


void BackRightOut(){
  myservo7.write(90);
}


void BackRightIn(){
  myservo7.write(170);
}


void BackRightUp(){
  myservo8.write(50);
}


void BackRightDown(){
  myservo8.write(160);
}


void SlowForward(){
    LeftUp();
  delay(dspeed);
  BackRightIn();
  delay(dspeed);
  LeftOut();
  delay(dspeed);
  LeftDown();
  delay(dspeed);

BackLeftUp();
delay(dspeed);
LeftIn();
delay(dspeed);
BackLeftOut();
delay(dspeed);
BackLeftDown();
delay(dspeed);

RightUp();
delay(dspeed);
BackLeftIn();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);

BackRightUp();
delay(dspeed);
RightIn();
delay(dspeed);
BackRightOut();
delay(dspeed);
BackRightDown();
delay(dspeed);
}








void Backward(){

RightUp();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);
RightIn();
delay(dspeed);


LeftUp();
delay(dspeed);
LeftIn();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftOut();
delay(dspeed);


BackRightUp();
delay(dspeed);
BackRightIn();
delay(dspeed);
BackRightDown();
delay(dspeed);
BackRightOut();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftOut();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftIn();
delay(dspeed);


}


void Forward(){

RightUp();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);
RightIn();
delay(dspeed);


BackRightUp();
delay(dspeed);
BackRightIn();
delay(dspeed);
BackRightDown();
delay(dspeed);
BackRightOut();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftOut();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftIn();
delay(dspeed);


LeftUp();
delay(dspeed);
LeftIn();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftOut();
delay(dspeed);










}


void Right(){
RightUp();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);
RightIn();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftOut();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftIn();
delay(dspeed);




BackRightUp();
delay(dspeed);
BackRightIn();
delay(dspeed);
BackRightDown();
delay(dspeed);
BackRightOut();
delay(dspeed);


LeftUp();
delay(dspeed);
LeftIn();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftOut();
delay(dspeed);
}


void Left(){


LeftUp();
delay(dspeed);
LeftIn();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftOut();
delay(dspeed);


BackRightUp();
delay(dspeed);
BackRightIn();
delay(dspeed);
BackRightDown();
delay(dspeed);
BackRightOut();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftOut();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftIn();
delay(dspeed);

RightUp();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);
RightIn();
delay(dspeed);




}


void Bow(){


  RightDown();
  delay(dspeed);
  LeftDown();
  delay(dspeed);
  RightIn();
  delay(dspeed);
  LeftIn();
  delay(dspeed);
}


void Rise(){
  LeftUp();
  delay(dspeed);
  RightUp();
  delay(dspeed);
  LeftIn();
  delay(dspeed);
  RightIn();
  delay(dspeed);
}


void Sit(){
  BackRightDown();
  delay(dspeed);
  BackLeftDown();
  delay(dspeed);


}


void Stand(){
  BackLeftUp();
  delay(dspeed);
  BackRightUp();
  delay(dspeed);
}


void Snake(){
  BackRightUp();
  delay(dspeed);
  BackRightIn();
  delay(dspeed);
  BackRightDown();

  BackLeftIn();
  delay(dspeed);
  BackLeftOut();
  delay(dspeed);
  BackLeftIn();
  delay(dspeed);

  RightDown();
  delay(dspeed);
  RightIn();
  delay(dspeed);
  RightUp();
  delay(dspeed);

  LeftOut();
  delay(dspeed);
  LeftIn();
  delay(dspeed);
  LeftOut();
  delay(dspeed);
  LeftDown();
  delay(dspeed);
}


void Roll(){
RightDown();
delay(dspeed);
RightOut();
delay(dspeed);
RightUp();
delay(dspeed);
RightIn();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftIn();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftOut();
delay(dspeed);




BackRightDown();
delay(dspeed);
BackRightIn();
delay(dspeed);
BackRightUp();
delay(dspeed);
BackRightOut();
delay(dspeed);


LeftUp();
delay(dspeed);
LeftOut();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftIn();
delay(dspeed);
}


void Jump(){
BackRightIn();
delay(dspeed);
BackRightDown();
delay(dspeed);
BackRightUp();
delay(dspeed);
BackRightIn();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftIn();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftUp();
delay(dspeed);




RightUp();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);
RightOut();
delay(dspeed);


LeftUp();
delay(dspeed);
LeftOut();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftOut();
delay(dspeed);
}


void Tip(){

  BackRightOut();
delay(dspeed);
BackRightDown();
delay(dspeed);
BackRightUp();
delay(dspeed);
BackRightIn();
delay(dspeed);


LeftUp();
delay(dspeed);
LeftOut();
delay(dspeed);
LeftDown();
delay(dspeed);
LeftOut();
delay(dspeed);


BackLeftUp();
delay(dspeed);
BackLeftOut();
delay(dspeed);
BackLeftDown();
delay(dspeed);
BackLeftUp();
delay(dspeed);




RightUp();
delay(dspeed);
RightOut();
delay(dspeed);
RightDown();
delay(dspeed);
RightOut();
delay(dspeed);




}


















 

Activity Sequence:

1. Students assemble the robot with the micro servos. In this way they learn about the joins of the robot. This can be compared and contrasted with biology of the limbs/muscular structure of a cheetah. Look at the angles for all those limbs:

o-CHEETAH-facebook.jpg

You could then relate this to what Boston Dynamics has created. Therefore, situating students in the context of professional robotics designers in the classroom:

 

Task: Line 33 and down in the void setup()- each student must adjust the servo.write parameter so the the robot can stand. The standing position of the robot will be it's posture/stance when not moving. It is important that the robot is at least able to balance when first starting.

 

Task 2: Line 327 Experiment with the forward() function specifically, the sequence of movement for each limb. For example, should the robot raise it's leg and then extend out with the knee or extend the knee and then rotate outwards. The 2 degrees of freedom for each servo in the mini quadruped allow for quite a few combinations of movements; the ideal of which I have yet to figure out.

 

Task 3: This could be to create a forward, right, left backward movement for the robot. None of the functions for these in the code above is perfect and would be great material for students to refine.

 

Task 4: The robot could be turned into an obstacle avoiding robot which is not tied to a computer by cables. For this to happen students would have to also design and 3D print a housing unit to snap onto the mini quadruped to hold batteries and the micro-controller. In the picture below it is the purple housing unit attached to the robot. Additional, each student would have to learn about programming the ultrasonic sensor:

FullSizeRender (4).jpg

 

Power management is definitely an issue to figure out. The batteries were heavy and the inclusion of lipo-batteries would make the profile of an obstacle avoiding spider robot sleeker than what I produced.

 

Below is my first attempt at an obstacle avoiding Spider robot set to the tune of Jamaican dance hall music (a personal favorite), Jah bless!

 

There is plenty of value in running an activity like the one I outlined above. For one, the advantage on learning programming with a spider robot as opposed to a robot chassis is that a wheeled chassis needs more space to run and is no fun when "leashed" to a computer.

 

Bio-mimicry tied to programming really helps put the activity in a greater contexts and challenges students to replicate the physical world (the bounding gait of a cheetah) into the mechanical context of the mini-quadruped robot. In my opinion, this creates powerful connection for learners.

 

I hope that this concept for a classroom project inspires some of you to try something like this. Additionally, maybe this post will generate some discussion for how technology, programming, and biology can be interwoven into an innovative instructional design which challenges traditional conceptions of a classroom.