Description
Rather than create a single-leg crawler for this project, I wanted to try something a little different. I attached an axle to the Servo motor and placed the motor within a wheel. I cut "teeth" into the edge of one side of the wheel.
The idea of the machine was to rotate the axle in the direction of the teeth, then in reversing the direction of the motor spin, allow the axle to catch on the teeth. The axle would thereby rotate the entire machine. Repeating the rotations would allow steady motion.
Unfortunately, it didn't work quite as I would have hoped. While the axle did move well enough despite flaws in the teeth, the central problem for the design was anchoring the Servo inside the wheel. Rather than efficiently rotating the entire machine, axle rotation pulled the Servo out of position, often negating the intended rolling effect.
With some improvements to the device, I do believe that this could be an effective model for movement.
Components
- breadboard
- wires
- Arduino board
- USB cable
- rubber bands
- 1 potentiometer
- Servo motor
- empty duct tape roll, modified with "teeth"
- axle formed from piece of wire coat hanger
- tape
- bobby pins for anchoring the Servo inside the wheel
Code
The code was reused from the Lab exercise.
/*
* Servo with Potentiometer control
* Theory and Practice of Tangible User Interfaces
* October 11 2007
*/
int servoPin = 7; // Control pin for servo motor
int potPin = 0; // select the input pin for the potentiometer
int pulseWidth = 0; // Amount to pulse the servo
long lastPulse = 0; // the time in millisecs of the last pulse
int refreshTime = 20; // the time in millisecs needed in between pulses
int val; // variable used to store data from potentiometer
int minPulse = 500; // minimum pulse width
void setup() {
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
pulseWidth = minPulse; // Set the motor position to the minimum
Serial.begin(9600); // connect to the serial port
Serial.println("servo_serial_better ready");
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
if (val > 0 && val <= 999 ) {
pulseWidth = val*2 + minPulse; // convert angle to microseconds
Serial.print("moving servo to ");
Serial.println(pulseWidth,DEC);
}
updateServo(); // update servo position
}
// called every loop().
void updateServo() {
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() - lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH); // Turn the motor on
delayMicroseconds(pulseWidth); // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW); // Turn the motor off
lastPulse = millis(); // save the time of the last pulse
}
}
Photos
Flickr:
http://www.flickr.com/photos/46877131@N00/1683803150/
http://www.flickr.com/photos/46877131@N00/1683793450/
http://www.flickr.com/photos/46877131@N00/1682933939/