Wednesday, January 25, 2012

Washington Prep uses a short day to make long strides...






Tuesday January 24th was a short day in the Los Angeles Unified School District, which means the students around the city got out early.  But three intrepid young men and women in our PORPOISE initiative  stayed long after school ended, showing that they have "the right stuff" for putting America back on its feet -- and for getting their feet wet and wetter in this landmark aquatic robotics program.

When most of their friends left school around lunchtime, Erica Ponce, EZMoney Harper and Luis Camacho stayed on, awaiting PORPOISE team leader Dr. T.H. Culhane's arrival from Motion Picture Marine in Venice.

Culhane, who spent a decade as a science teacher in the  Los Angeles inner city back in the early 90s, returned to his old stomping grounds in the U.S.  from another decade working on science and technology training issues overseas (in Europe and the Middle East) to continue the crusade to improve education for all. And true to his eco-tech credentials, Culhane continued his tradition of taking public transit, which is notoriously time consuming in a city famed for its car culture.  This, however, meant that he couldn't arrive at the school any earlier than the usual 3:00 meeting time.

The students were patient though, and stayed until nearly 6:00 to bring the Sea Perch hack they had started the previous week to completion.
They took the Boatduinode.pde file contributed by a young man in Texas who is generously helping us develop our program (Andy 'Tuna' Harris, who, in true Tom Sawyer fashion,  developed the code so people around the world could control his mom's pool skimmer from their web browsers and help him clean the family pool!) and mashed it together with the Adafruit Motor Test sketch and came up with the following code:
____________________________________________________________

#include <AFMotor.h>

AF_DCMotor motor1(1, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor3(3, MOTOR12_64KHZ); // create motor #3, 64KHz pwm
void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
  motor1.setSpeed(200);     // set the speed to 200/255, use motor1 on shield as left Sea Perch motor
   motor2.setSpeed(200);     // set the speed to 200/255, use motor2 on shield as up-down Sea Perch motor
   motor3.setSpeed(200);     // set the speed to 200/255, use motor3 on shield as right Sea Perch motor
}
void loop() {
 
   if (Serial.available() > 0) {
      switch(Serial.read()) {
        case 'l':
         motor1.run(FORWARD);      // turn on motor1, which is left motor going forward
         motor2.run(RELEASE);     // stop motor2, the up-down motor
         motor3.run(RELEASE);     //stop motor3 which is right motor
         Serial.println("You sent 'l' = Left motor forward, Right motor off, turning left");
         break;
          case 'r':
          motor1.run(RELEASE); // stop motor1
          motor2.run(RELEASE);      // stop motor2, the up down motor
          motor3.run(FORWARD);     //turn on motor3, the right motor, going forward
          Serial.println("You sent 'r' = left motor off, right motor forward, turning right");
          break;
           case 'L':
         motor1.run(FORWARD);      // turn on motor1 forward
         motor2.run(RELEASE);     // turn  motor2, the up down motor, off
         motor3.run(BACKWARD);     //turn on  motor3 which is right motor, spinning backward
         Serial.println("You sent 'L' = left motor forward, right motor backward, spinning left");
         break;
          case 'R':
          motor1.run(BACKWARD); //turn on motor1 backward
          motor2.run(RELEASE);     //stop motor2 which is up down motor
          motor3.run(FORWARD);  //turn on motor3, the right motor on Sea Perch, forward 
          Serial.println("You sent 'R' = left motor backward, right motor forward, spinning right");
          break;
        case 'f':
         motor1.run(FORWARD);
         motor3.run(FORWARD);
          Serial.println("You sent 'f' = Both motors forward, full steam ahead");
          break;
        case 'b':
          motor1.run(BACKWARD);
          motor3.run(BACKWARD);
          Serial.println("You sent 'b' = Both motors reverse, moving backward");
          break;
        case 's':
          motor1.run(RELEASE);      // stopped
          motor2.run(RELEASE);      // stopped
          motor3.run(RELEASE);
          Serial.println("You sent 's' = Boat stopped");
          break;
        case 'd':
           motor2.run(FORWARD);
          Serial.println("You sent 'd' = dive motor activated, diving");
          break;
        case 'u':
         motor2.run(BACKWARD);
          Serial.println("You sent 'u' = dive motor activated, surfacing");
          break;       
      }
   }

}




_________________________________________________________________




This enabled Erica, Luis and EZ to use the serial monitor of the Arduino IDE on EZ's laptop to control all three Sea Perch motors using an Arduino Uno with an Adafruit Motorshield mounted on it. EZ explains what they are doing in the following videos:



 In the above video EZ explains the code and how it controls the motors.


 In the video above EZ explains how the Arduino motor controller is connected to the Sea Perch Controller.


 After we had explored the code and how it works with the Sea Perch motors we started soldering the new MIT Sea Perch Sensor Suite PCB boards to start giving sense and sensibility to the little ROV.  Good times ahead!












No comments:

Post a Comment