Sunday, December 14, 2014

Final Design Test - On Water

Here a demonstration of the completed 'Air Boat' performing as intended. Enjoy!

Thursday, December 11, 2014

Final Setup

Here we have the final setup of the project. We completed the objective and we are happy with the outcome of the project. The airboat work perfectly in water (video coming soon), but we kind the hope it would work on a regular floor. But the boat is too heavy for the propellers.





Have to give props to Aaron since he figure out how to code the Arduino so that the thumbstick was working with the propeller. Here we have the complete code for the airboat. 
NOTE: some of the code was not used, but it is inactive.

PS2 wireless airboat arduino code

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
#include <PS2X_lib.h>  //for v1.6
#include <Servo.h>
 PS2X ps2x; // create PS2 Controller Class
 //right now, the library does NOT support hot pluggable controllers, meaning
 //you must always either restart your Arduino after you conect the controller,
 //or call config_gamepad(pins) again after connecting the controller.

 Adafruit_MotorShield AFMS = Adafruit_MotorShield();
 Adafruit_DCMotor *motor1 = AFMS.getMotor(1);
 Adafruit_DCMotor *motor2 = AFMS.getMotor(4);

 int pos = 90;
 int servoInput = 128;
 int motorSpeed = 0;
 int motorInput = 128;
 Servo myservo;

 void setup(){
  Serial.begin(9600);
  AFMS.begin();
  motor1->setSpeed(motorSpeed);
  motor2->setSpeed(motorSpeed);
 
  myservo.attach(9);
  ps2x.config_gamepad(13,11,10,12, true, true);
}
 void loop(){
    /* You must Read Gamepad to get new values
    Read GamePad and set vibration values
    ps2x.read_gamepad(small motor on/off, larger motor strenght from 0-255)
    if you don't enable the rumble, use ps2x.read_gamepad(); with no values
  
    you should call this at least once a second
    */
     ps2x.read_gamepad();
    
     /*if(ps2x.Button(PSB_PAD_UP)) // Props ON -> Forward
     {
       motor1->run(FORWARD);
       motor2->run(FORWARD);
       Serial.println("Forward");
     }
     else if(ps2x.ButtonReleased(PSB_PAD_UP)) // Props OFF
     {
       motor1->run(RELEASE);
       motor2->run(RELEASE);
     }
     if(ps2x.Button(PSB_PAD_DOWN)) // Props ON -> Backward
     {
       motor1->run(BACKWARD);
       motor2->run(BACKWARD);
       Serial.println("Reverse");
     }
     else if(ps2x.ButtonReleased(PSB_PAD_DOWN)) // Props OFF
     {
       motor1->run(RELEASE);
       motor2->run(RELEASE);
     }
     */
     /*if(ps2x.Button(PSB_L1)) // Turns Fins LEFT
     {
       pos += 5;
       Serial.println(pos);
     }
     if(ps2x.Button(PSB_R1)) // Turns Fins RIGHT
     {
       pos -= 5;
       Serial.println(pos);
     }
     else if(ps2x.ButtonPressed(PSB_BLUE)) // CENTERS The Fins
     {
       pos = 90;
     }
     if(pos >= 180) // Servo MAX RIGHT, pos = 180
     {
       pos = 175;
     }
     else if(pos <=0) // Servo MAX LEFT, pos = 0
     {
       pos = 5;
     }
     */
     motorInput = ps2x.Analog(PSS_LY), DEC;
    
     if(motorInput >= 0 && motorInput < 100)
     {
       motorSpeed = map(motorInput,0,128,255,0);
       motor1->setSpeed(motorSpeed);
       motor1->run(FORWARD);
       motor2->setSpeed(motorSpeed);
       motor2->run(FORWARD);
     }
     if(motorInput > 150 && motorInput <= 255)
    
       motorSpeed = map(motorInput,128,255,0,255);
       motor1->setSpeed(motorSpeed);
       motor1->run(BACKWARD);
       motor2->setSpeed(motorSpeed);
       motor2->run(BACKWARD);
     }
     if(motorInput >= 100 && motorInput <= 150)
     {
       motor1->run(RELEASE);
       motor2->run(RELEASE);
     }
    
     servoInput = ps2x.Analog(PSS_RX), DEC;
     pos = map(servoInput,0,255,180,0);
    
     if(pos >= 120 && pos <= 136) //Stops the servo from 'twitching'
     {
       myservo.write(90);
     }
     else
     {
       myservo.write(pos);
     }
    
     Serial.println(motorInput);
    
     delay(5);
 }

Code and Servo

We've been working on the code and wiring the servo in the design. Coding the arduino was complicated for us since collectively as a group never had exposure to an arduino processor before. But we have manage to get it somehow working.

Coding the Arduino


Connecting the Servos

Roberto Dabbas, Aaron Choi, Jovany Mira

We are are almost done. We just have to complete minor details in the air boat to make it more appealing and also work on the arduino code.

Air boat Running


Progress

Roberto Dabbas, Aaron Choi, Jovany Mira


We have completed the design and it is fully assemble. We are now working on the code to have it properly working with a PlayStation Bluetooth remote control. Here are some videos of our progress.

Getting the fins working with PS2 buttons

360 View if the Airboat



Thursday, December 4, 2014

Materials gained.. Nearly completed

Roberto Dabbas, Aaron Choi, Jovany Mira






Here, we have all the materials needed to construct and create our airboat. 
These are the materials that are going to be used:

  • Foam
  • Servo motors
  • DC motor
  • Propellers 
  • Wooden fins
  • Battery Adapter
  • 9V Battery 
  • PS2/3 controller