Introduction: Jansen Linkage Robot

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).

The design parameters for this project were that the project must implement 3D printed parts in the design, that it must make use of a 7.62 x 4.62 x 2.25 in project box enclosure, have moving parts, and use an arduino to control the functionality of the project.

This instructable will show the general process for creating a walking robot that implements a Strandbeest style Jansen linkage based walking system.

Step 1: Parts/Materials

For this project you will need:

-to 3d print the files provided

-a set of 2 1/2-20 threaded rods and 4 1/2-20 nuts

-2 standard size continuous rotation servos

-an arduino

-2 ps2 style joystick modules

-assorted wires to make the electrical connections

-1 arduino touch pad button module

-a 7.62 x 4.62 x 2.25 in. project box enclosure

-power which provides 5v to the arduino and the servos

Step 2: Print the Parts

3d print these files

Step 3: Drill Holes to Mount Servos and Threaded Rods

Use the 3D printed component "strandbeest spine v2" as a template to drill 3 holes in each side of the project box enclosure (approximate hole locations indicated by the arrows in the picture), the holes should be positions such that the right and left sides of the box are symmetrical, the two threaded rods can pass all the way through the two outer holes, and the two servos (with servo horns off) can be mounted and function through the center hole. Also, drill holes accordingly for the 4 mounts to attach the servos.

Step 4: Upload the Arduino Sketch

Upload the provided sketch to the arduino.

This sketch is is set up to put the arduino to sleep if the touch pad is not being pressed, and the y-axis of each of the joysticks remapped to control the operate rotation servos accordingly.

//Purpose: To operate two servos using two joysticks, which will be used to operate two legs for a robot. In association MAKE Course, offered by the University of South Florida.
//Created by: Brian Cantler //Date: 12/01/2014

#include #include //this AVR library contains the methods that controls the sleep modes #define interruptNumber 0 //since pin 2 is used for the external interrupt, in is attached to interrupt number 0 #define TouchPadPin 2 //connect touch sensor output (pin "S") to D2 (and pin "G" to GND and pin "V" to 5V)

volatile byte TouchPadEventFlag;//all variables that are changed within an ISR need to be dimensioned as 'volatile' //this variable will be used to tell the main loop that an interrupt event occurred.

const int servo1 = 3; //identifies the first servo as being connected to digital pin 3 const int servo2 = 10; //identifies the second servo as being connected to digital pin 10 const int joy1 = 3; //identifies the first joystick as being connected to analog pin 3 const int joy2 = 4; //identifies the second joystick as being connected to analog pin 4

int servoVal; //variable used to read the values from the analog pin

Servo myservo1; //creates servo object to control the first servo Servo myservo2; //creates servo object to control the second servo

void setup() {

// Servos myservo1.attach(servo1); //attaches the first servo myservo2.attach(servo2); //attaches the second servo

// Initialize Serial Serial.begin(9600); pinMode(13,OUTPUT); //sets pin 13 as an output so we can use the built in LED on the arduino to monitor when the arduino is powered on digitalWrite(13,LOW); //turns pin 13, one of the built in LEDs on the arduino, off pinMode(TouchPadPin, INPUT); //defines the interrupt pin as an input digitalWrite(2,HIGH); //activates the internal pull-up resistor to pull it to high when the touch pad is not being pressed

}

void loop(){

//Displays the joystick values using the serial monitor outputJoystick();

//Read joystick one's value (value between 0 and 1023) servoVal = analogRead(joy1); servoVal = map(servoVal, 0, 2500, 70, 180); //scales the joystick values to be able to use it with the servo (result between 90 and 180)

myservo2.write(servoVal); //sets the 360 servos' speed according to the scaled value

//Read joystick two's value (value between 0 and 1023) servoVal = analogRead(joy2); servoVal = map(servoVal, 0, 2500, 70, 180); //scales the joystick values to be able to use it with the servo (result between 90 and 180)

myservo1.write(servoVal); //sets the 360 servos' speed according to the scaled value

delay(15); //waits for the servo to speed up to the scaled value sleepSetup(); //remains at ~27 mA until the touch pad is pressed on pin 2

}

/** * Displays the joystick values in the serial monitor */ void outputJoystick(){

Serial.print(analogRead(joy1)); //displays the joystick values for the first joystick in the serial monitor Serial.print ("-joystick_one-----"); //identifies the values displayed are for the first joystick Serial.print(analogRead(joy2)); //displayes the joystick values for the second joystick in the serial monitor Serial.println ("-joystick_two-------------"); //identifies the values displayed are for the second joystick }

void sleepSetup() { sleep_enable(); attachInterrupt(0, pinInterrupt, LOW); //Sets pin 2 as an interrupt and attaches Interrupt Service Routine (ISR) set_sleep_mode(SLEEP_MODE_PWR_DOWN); //define power down sleep mode digitalWrite(13,LOW); //turns the LED off to indicate sleep mode sleep_cpu(); //Set sleep enable (SE) bit, this puts the ATmega to sleep Serial.println("strandbot is powered on"); //When it wakes up due to the interrupt the program continues with the instruction following sleep_cpu() digitalWrite(13,HIGH); //turns the built in LED on the arduino to indicate that the arduino has awoken }

void pinInterrupt() //ISR { sleep_disable(); //this is important. It is possible that the interrupt is called between executing "attachInterrupt(...)" and sleep_CPU() in the main loop //if that happens without the sleep_disable() in the ISR, the ISR would be called, the interrupt detached and the device put to sleep. //since the interrupt would be disabled at that point, there would be no way to wake the device up anymore. //by putting sleep_disable() in the ISR, sleep_cpu() would not be effective during that loop, i.e. the main loop would run one more time //and then properly attach the interrupt before hitting the sleep_cpu() a second time. At that point the device would go to sleep, but //the interrupt would now be activated, i.e. wake-up can be induced. detachInterrupt(0);//disable the interrupt. This effectively debounces the interrupt mechanism to prevent multiple interrupt calls.

}

Step 5: Assemble Electrical Components

Connect the joysticks, touch pad, servos, and the arduino to an appropriate 5V power source and ground.

Connect one of the servos to digital pins 3&10.

Connect the touch pad to digital pin 2.

Connect the joysticks to analog pins 3&4.

Step 6: Assemble the 3D Printed Components

Assemble the 3D printed components as shown in the diagrams

(note: some components may require sanding/drilling out holes further for proper tolerances, and some components of the crankshaft assembly may need to be glued into place depending upon tolerances after printing)

Step 7: Mount Electrical Components

Mount the two servos inside the project box, then fasten on their servo horns accordingly, and secure the arduino, along with a 5v supply for power inside the project box enclosure, lead wires for the joysticks and touch pad out of the box.

Step 8: Assemble 3D Printed Components Onto the Box

Place the 2 threaded rods through the 2 outermost drilled out holes on the project box, such that the amount of threaded rods coming out of both sides of the box are equidistant.

Slide the each of the leg assemblies onto the threaded rods, and fasten the crankshaft components to the servo horns. (note some components may require some fine tuning of spacing and tolerances for proper operation)

Add 1/2-20 nuts to the end of each end of the threaded rods, such that the components will remain in place.

Step 9: Test It Out!

Test it out!

Comments

author
peppypickle (author)2014-12-11

thanks for sharing this with us, and for providing such great documentation!

author
tomatoskins (author)2014-12-11

I love anything that implements any sort of anything from the Strandbeest's. Such an amazing design! Great job!

About This Instructable

2,495views

16favorites

License:

More by bcantler:Jansen Linkage Robot
Add instructable to: