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( {
        case 'l':;      // turn on motor1, which is left motor going forward;     // stop motor2, the up-down motor;     //stop motor3 which is right motor
         Serial.println("You sent 'l' = Left motor forward, Right motor off, turning left");
          case 'r':
; // stop motor1
;      // stop motor2, the up down motor
;     //turn on motor3, the right motor, going forward
          Serial.println("You sent 'r' = left motor off, right motor forward, turning right");
           case 'L':;      // turn on motor1 forward;     // turn  motor2, the up down motor, off;     //turn on  motor3 which is right motor, spinning backward
         Serial.println("You sent 'L' = left motor forward, right motor backward, spinning left");
          case 'R':
; //turn on motor1 backward
;     //stop motor2 which is up down motor
;  //turn on motor3, the right motor on Sea Perch, forward 
          Serial.println("You sent 'R' = left motor backward, right motor forward, spinning right");
        case 'f':;;
          Serial.println("You sent 'f' = Both motors forward, full steam ahead");
        case 'b':
          Serial.println("You sent 'b' = Both motors reverse, moving backward");
        case 's':
;      // stopped
;      // stopped
          Serial.println("You sent 's' = Boat stopped");
        case 'd':
          Serial.println("You sent 'd' = dive motor activated, diving");
        case 'u':;
          Serial.println("You sent 'u' = dive motor activated, surfacing");



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