Sunday, November 1, 2009

// Use this code to test your motor with the Arduino board:

// if you need PWM, just use the PWM outputs on the Arduino
// and instead of digitalWrite, you should use the analogWrite command

// Motors
int irPin = 7; //
int irreading; // the analog reading from the analog resistor divider
int motor1speed = 10;
int motor1dir = 12;
int delayTime;
boolean state = false;

// Setup
void setup() {

Serial.begin(9600);

// Setup motors
pinMode(motor1speed, OUTPUT);
pinMode(motor1dir, OUTPUT);

pinMode(irPin, INPUT);
}

// Loop
void loop() {
irreading = analogRead(irPin);
Serial.println(irreading); // the raw analog reading

/* if (irreading > 135)
{
digitalWrite(motor1dir, LOW);
analogWrite(motor1speed, 200);
}

else if (irreading < 135)
{
digitalWrite(motor1dir, HIGH);
analogWrite(motor1speed, 200);
}*/

if(state)
{
motorForward();
} else {
motorBackward();
}


state = !state;
delayTime = random(4500, 10000);

delay(delayTime);


}

void motorForward()
{
digitalWrite(motor1dir, LOW);
analogWrite(motor1speed, 200);
}

void motorBackward()
{
digitalWrite(motor1dir, HIGH);
analogWrite(motor1speed, 500);
}

process of construction

I used a few tubes of superglue to cement the support frames onto the spacers. I made sure to only stick two large components together at a time as i wanted to be able to control the friction as best as possible when configuring it.

Peeling and sticking together


My final model is taking shape. I have 60 fins to come out so it should look pretty nice

Laser cutting

I cut out lots of the five different components i needed to make up the bot.
3 Fins to each segment.
2 Stoppers between each segment to work as a stop for the fin flicking over.
short segment 1
long segment 2 (these were off centered from each other to make it more layered
spacing segment which sat between each part.

I had some technical difficulties with the laser cutter in the begining but i soon figured out the system and it worked well.


l


freehand model development.


So after testing out my rig i discovered things that would need to be tweaked in order to work efficiently.I found an RC car and pulled it to parts. I decided i would use the axle to drive the fins up and down.

New model


After a long period of time rakking my brain over how to create my spring loaded tube i changed my scheme to something which worked on the horizontal plane.

My new concept is base on the simple mechanics of the mousetrap. I want i to spring out in a rapid motion envoking being startled.

I modeled up test on freehand and printed off a couple of ribs on the laser cutter and tested out the scheme by using a modified rat trap as the test rig.