Sunday, February 14, 2016

FINAL BLOG POST

                                       


About Our Product

GyroThermo.90° is a water surveyor which measures water surface temperature constantly in a lawn mower pattern.

Prominent Features

GyroThermo.90° can be controlled automatically or manually with bluetooth. Under auto mode, GyroThermo.90° will move in a lawn mower pattern. Under manual mode, we can control GyroThermo.90° to go to any specific location.



Calculation

2 x Extrusion Bars                                                    =0.223kg
2 x Acrylic Base                                                       =0.210kg
2 x Motor                                                                  = 0.298kg
Electrical Casing (Tupperware)                                =0.157kg
Infrared Sensor                                                         =0.011kg
Infrared Sensor Cap                                                  =0.012kg
2 x Motor Bracket                                                     =0.090 kg
45 degree Pipe                                                           =0.021kg
Electronic Components                                             =0.412kg
TOTAL WEIGHT = 1.434kg

Using Formula:











V= 1.434/1000
   =0.001434 m^3
VOLUME NEEDED= 0.1434 cm^3

Giving 20% extra tolerance:

Volume x 120%
=1.434 x 1.2
VOLUME NEEDED =1720.8 cm^3

Pipe Radius Needed:
Πr2h=  1720.8
Πr2(23)=  1720.8
RADIUS OF PIPE NEEDED= 4.88cm



Hence, we choose the pipe with radius 4cm which is diameter 80 mm.



Our code is available here:
 http://monedgroup8.blogspot.sg/2016/02/our-code.html

Here is the latest design:
http://monedgroup8.blogspot.sg/2016/02/final-design-of-our-water-surveyor-old.html
http://monedgroup8.blogspot.sg/2016/02/infrared-sensor-throughout-lots-of.html

Here is the older design:
http://monedgroup8.blogspot.sg/2016/01/e-project-update.html
http://monedgroup8.blogspot.sg/2015/12/concept-report-after-rounds-of.html

Our Electrical Circuit and Code

Circuit diagram:


Arduino Code:

//---Tempreature Sensor---
#include <OneWire.h>
int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
OneWire ds(DS18S20_Pin); // on digital pin 2

//---cmps---
#include "Wire.h"
#include "CMPS03.h"
CMPS03 cmps03;
volatile float cmpsValue;   //compass reading
volatile float cmpsTurn;    //the turning degree

//----infra---
const int InfraredSensorPin = 8;
volatile int countTurns = 0;

//---Motors---
int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;

//---LED---
int rightLed= 13;
int leftLed= 12;
int infraLed=11;

void setup() {
 pinMode(M1, OUTPUT);
 pinMode(M2, OUTPUT);
 pinMode(E1, OUTPUT);
 pinMode(E2, OUTPUT);
 pinMode(rightLed,OUTPUT);
 pinMode(leftLed,OUTPUT);
 pinMode(infraLed,OUTPUT);
 Serial.begin(9600);
 pinMode(InfraredSensorPin,INPUT);
 Wire.begin();
 volatile char c;
 volatile int a = 0;
 while(Serial.available()){
     c = Serial.read();
  }
  while(a !=1){
    stopBoat();
    c = Serial.read();
    if(c == 'r'){
      a=1;
    }
    if(c=='l'){
      a=1;
    }
  }
  if(c=='r'){
    while(digitalRead(InfraredSensorPin) == HIGH){
    forward();
  }
  Serial.println("wall");
  digitalWrite(infraLed,HIGH);
  reverseRight();
  turnRight();
  digitalWrite(infraLed,LOW);
  digitalWrite(rightLed,LOW);
  shortForward();
  turnRight();
  digitalWrite(rightLed,LOW);
  countTurns++;
  forward();
}
if(c=='l'){
  while(digitalRead(InfraredSensorPin) == HIGH){
    forward();
  }
  Serial.println("wall");
  digitalWrite(infraLed,HIGH);
  reverseLeft();
  turnLeft();
  digitalWrite(infraLed,LOW);
  digitalWrite(leftLed,LOW);
  shortForward();
  turnLeft();
  digitalWrite(leftLed,LOW);
  forward();
}
}


void loop() {
  volatile char c;   // incoming data from phone
  int toggle =0;     // Keep track of whether its in auto or manual
    while(Serial.available()){
     c = Serial.read();
  }
  if(c == 'm'){
    toggle =1;
    while( toggle == 1){
    switch(c){
   
      case'a':manForward();
      c= Serial.read();
      break;
   
   
      case'c':manRight();
      c= Serial.read();
      break;
   
      case'd':manLeft();
      c= Serial.read();
      break;

      case'u':toggle = 0;
      //Serial.println("Now going to automatic mode");
      break;

      default: stopBoat();
      c= Serial.read();
      break;
    }
  }
  }
 else{
  c = Serial.read();
  if(c == 'm'){
    toggle = 1;
  }
  /*if(digitalRead(InfraredSensorPin) == HIGH){
    forward();
  }
  else{
    if(countTurns%2 == 0){
    reverseLeft();
    digitalWrite(infraLed,HIGH);
    turnRight();
    digitalWrite(rightLed,LOW);
    digitalWrite(infraLed,LOW);
    shortForward();
    turnRight();
    digitalWrite(rightLed,LOW);
    forward();
    }
    else{
      reverseRight();
      digitalWrite(infraLed,HIGH);
      turnLeft();
      digitalWrite(leftLed,LOW);
      digitalWrite(infraLed,LOW);
      shortForward();
      turnLeft();
      digitalWrite(leftLed,LOW);
      forward();
    }
  }*/
}
}




void forward(){
  volatile char c;
  int stopcount = 0;
  c = Serial.read();
    if(c == 'r'){
      stopcount = 1;
    }
  while(stopcount==1){
    stopBoat();
    c = Serial.read();
    if(c=='l'){
      stopcount=0;
    }
  }
  digitalWrite(M1,LOW);
  digitalWrite(M2, LOW);
  analogWrite(E1, 88);
  analogWrite(E2, 120);
  digitalWrite(leftLed,LOW);
  digitalWrite(rightLed,LOW);
  /*float temperature = getTemp();
  Serial.print("The Water is ");
  Serial.print(temperature);
  Serial.println("°C");*/
  Serial.println("forward");
  delay(1000);
}

void shortForward(){
  digitalWrite(M1,LOW);
  digitalWrite(M2, LOW);
  analogWrite(E1, 88);
  analogWrite(E2, 120);
  float temperature = getTemp();
  /*Serial.print("The Water is ");
  Serial.print(temperature);
  Serial.println("°C");*/
  Serial.println("shortforward");
  delay(5000);
}

void turnRight() {
  for(int turnTimer=0; turnTimer <6; turnTimer++){
    digitalWrite(rightLed,HIGH);
    digitalWrite(M1,LOW);
    digitalWrite(M2, HIGH);
    analogWrite(E1, 88);
    analogWrite(E2, 120);
    /*float temperature = getTemp();
    Serial.print("The Water is ");
    Serial.print(temperature);
    Serial.println("°C");*/
    Serial.println("right");
    delay(500);
  }
  countTurns++;
  }

void turnLeft() {
  for(int turnTimer=0;turnTimer<6;turnTimer++){
    digitalWrite(M1,HIGH);
    digitalWrite(M2, LOW);
    analogWrite(E1, 88);
    analogWrite(E2, 120);
    digitalWrite(leftLed,HIGH);
    /*float temperature = getTemp();
    Serial.print("The Water is ");
    Serial.print(temperature);
    Serial.println("°C");*/
    Serial.println("Left");
    delay(500);
  }
  countTurns++;
  }

void reverseLeft(){
  digitalWrite(M1,HIGH);
  digitalWrite(M2, LOW);
  analogWrite(E1, 150);
  digitalWrite(E2, LOW);
  Serial.println("reverse left");
  delay(10000);

}

void reverseRight(){
  digitalWrite(M1,LOW);
  digitalWrite(M2, HIGH);
  digitalWrite(E1, LOW);
  analogWrite(E2, 150);
  Serial.println("reverse right");
  delay(10000);
}

void manForward(){
  digitalWrite(M1,LOW);
  digitalWrite(M2, LOW);
  analogWrite(E1, 88);
  analogWrite(E2, 110);
  float temperature = getTemp();
  Serial.print("The Water is ");
  Serial.print(temperature);
  Serial.println("°C");
  delay(3000);
}

void manRight(){
  digitalWrite(M1,LOW);
  digitalWrite(M2, HIGH);
  analogWrite(E1, 120);
  analogWrite(E2, 80);
  digitalWrite(rightLed,HIGH);
  float temperature = getTemp();
  Serial.print("The Water is ");
  Serial.print(temperature);
  Serial.println("°C");
  delay(3000);
  digitalWrite(rightLed,LOW);
  }

void manLeft(){
  digitalWrite(M1,HIGH);
  digitalWrite(M2, LOW);
  analogWrite(E1, 120);
  analogWrite(E2, 87);
  digitalWrite(leftLed,HIGH);
  float temperature = getTemp();
  Serial.print("The Water is ");
  Serial.print(temperature);
  Serial.println("°C");
  delay(3000);
  digitalWrite(leftLed,LOW);
  }

void stopBoat(){
  digitalWrite(M1,HIGH);
  digitalWrite(M2, HIGH);
  digitalWrite(E1, LOW);
  digitalWrite(E2, LOW);
  float temperature = getTemp();
  Serial.print("The Water is ");
  Serial.print(temperature);
  Serial.println("°C");
  delay(1000);
  }

float getTemp(){
 //returns the temperature from one DS18S20 in DEG Celsius

 byte data[12];
 byte addr[8];

 if ( !ds.search(addr)) {
   //no more sensors on chain, reset search
   ds.reset_search();
   return -1000;
 }

 if ( OneWire::crc8( addr, 7) != addr[7]) {
   Serial.println("CRC is not valid!");
   return -1000;
 }

 if ( addr[0] != 0x10 && addr[0] != 0x28) {
   Serial.print("Device is not recognized");
   return -1000;
 }

 ds.reset();
 ds.select(addr);
 ds.write(0x44,1); // start conversion, with parasite power on at the end

 byte present = ds.reset();
 ds.select(addr);
 ds.write(0xBE); // Read Scratchpad


 for (int i = 0; i < 9; i++) { // we need 9 bytes
  data[i] = ds.read();
 }

 ds.reset_search();

 byte MSB = data[1];
 byte LSB = data[0];

 float tempRead = ((MSB << 8) | LSB); //using two's compliment
 float TemperatureSum = tempRead / 16;

 return TemperatureSum;

}

Saturday, February 13, 2016

INFRARED SENSOR

Throughout lots of discussions and testings, we have make a serious decision, changing the ultrasonic sensor to an infrared sensor.



So, what is an infrared sensor? An Infrared sensor is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view.



We plan to use the sensor to detect the wall or banks of our water body. This allows our boat to know when to turn. Using this knowledge combined with our compass the boat is able to achieve a 90° turn for both left and right hence completing the lawn mower pattern.


On the other side, we had figured out how to mount the infrared sensor onto our boat. Firstly we purchased some pipes, we got an one-side threaded connector and 45° connector.Then, we cut the pipe into 2 pieces, one is 20mm long and another is 10mm. We drilled a hole on one end of the 20mm long of pipe.


We also designed and 3D printed a bracket to hold the pipe.


The bracket is mounted on top of the cover of the tupperware and secured with screws and nuts.


Besides that we designed and 3D printed a shelter for the infrared sensor to prevent the excess infrared light from the sun which may affect the reading. The infrared sensor is inserted into the one-side threaded connector and sealed with transparent silicon sealant.


After that, we assemble the pipes and connectors as shown in the photo where the pipe with hole attached to the bracket and secured with a screw and nut while the other pipe connect both the pipe connectors.

Saturday, February 6, 2016

Motor Stalling, Jerkng or Skipping Solution



                Hello everyone welcome back to our blog. A lot of groups have been affected by this problem and our group is no exception. But what is this problem I am talking about? The problem is motors suddenly not turning or suddenly jerking or skipping. Now this is a huge problem as almost all of our projects are relying on motors to turn propellers to provide thrust for movement. Originally we set our motors PWM to 255 ( The maximum pulse width modulation) this means we are supplying our motors with the maximum amount of voltage our power supply can provide, in our case we are using a 12v LiPO battery. This provided much speed in air but when we put it in to the water our motors started stalling and skipping. We asked around and found out that alot of other groups were facing the same problem and were stumped. We researched online and found out that propellers for airplanes are able to turn very fast as air resistance is quite small compared to water resistance hence the propellers in water needs to turn slower. However this does not mean that the motors become less powerful. They actually become more powerful as the lesser the speed the greater the torque. We then set our PWM to 100 and voila our motors started to turn without Stalling Jerking or Skipping. PWM is a tool by Arduino to change the output voltage. PWM or pulse width modulation means controlling the pulse width to achieve a lower voltage. The formula is (Max Voltage) x (The time the wave is HIGH / The Period of a wave). The image below shows a example of pulse width modulation in action.




Thank you for reading and we hoped that this blog post have helped you solve your problem.


Tuesday, February 2, 2016

FINAL DESIGN



Final Design of our Water SurveyorFINAL Design.png

Old Design of our Water Surveyor


We have made several changes to our design. Firstly, we have excluded the keel as after a few experiments conducted, it does not really ensure our boat move in a straight line on water. On the contrary, the keel affects the turning of our boat when our boat is trying to achieve a lawn mower pattern on water.


Secondly, we have replaced the acrylic body structure with a tupperware. This is because we found out that the acrylic structure is not necessary and hard to be waterproof. Not to mention that it is time consuming to make, we decided to replace it with a tupperware which is waterproof and big enough to hold our circuits and electronic devices.


Thirdly, we have modified our body structure which is entirely made of acrylic by adding 2 pieces of aluminium extrusion bars below our downsized acrylic plates. Our previous design which is shown below has the problem of withstanding the weight acting on it and it will bend in middle. Hence, we have created a skeleton for it by supporting it with aluminium extrusion bars.  





To mount the motors, we have designed special motor brackets using Autodesk Inventor and 3D printed them out. Then, we laser cut 2 pieces of acrylic board and the motor brackets are attached to the acrylic base.

After a few of experiments, we noticed that the boat still tilted backward due to the weight of the powerbank in the tupperware. Thus, we add a float on the back part of our boat. It is to provide buoyancy force to our boat to stabilise our boat. The addition of the float has significantly increased the stability of our boat and ensure it balance when moving on water.

`


Ta daaaaa!!! This is how the water surveyor will look like:




Monday, January 18, 2016

E&D Project Update

Time flies, our MST break had came to the end  and we are looking forward to start our second term of semester two. Now, we would like to share with you what had done by us for the project during the holiday. Our project is to make a vehicle which can move on water in lawn mowing pattern and able to detect obstacles. We also made a phone app to receive the value from the temperature sensor of the vehicle. For the electrical part, we had done with the temperature sensor during the previous activity in class but we need to test it again to make sure it works.
IMG_20151019_104522_HDR.jpg
Temperature Sensor

The second thing that we did was the ultrasonic sensor. We need ultrasonic sensor to avoid our vehicle to hit the obstacles when it move by itself automatically. We search about the ultrasonic sensor online and also how to connect it to arduino. The image below is the simple connection which we used to test our ultrasonic sensor.
image.jpg
Ultrasonic Sensor

Besides that, we also create a phone app to receive data from our vehicle through the bluetooth. At first, we do not know how to do these because we never done this before. So, we do some research and we managed to find a website which can be used to make the app. The image below is the is the app and bluetooth connection that we make to test the data received.
app1.JPG
App for receiving data



image (1).jpg
Bluetooth

After that, we make some improvements to the apps in order to meet the requirements of our project. Here is the app after modify:


image.jpg


The videos below are the testing of our bluetooth:


Besides receiving data from our vehicle, we want to control the movement of our vehicle manually by pressing the button on our phone. We also want to change it to automatic movement using the phone app. For the automatic part, we use compass with arduino code to control the movement of our vehicle, so that it can move in lawn mowing pattern. The image below is our circuit for compass and temperature sensor. The sensor will be put 2 cm below the surface of the water as the actual surface temperature will not be accurate due to sunlight rays heating the surface increasing the value as compared to the actual value.

Last but not least, we would like to talk about the arduino code that we had done and combined so far, the idea behind the code was to combine the ultrasonic sensor and compass together for the auto part. We used a bit of math combine with coding logic as the base of our code. When the ultrasonic sensor detects an obstacle it will stop moving and take the compass reading. Then it will refer to a counter which counts the number of turns it has made already. If the number is even it will make a right turn. It does this by taking the compass reading and adding 90 degrees to it. Then it will move forward for a bit before turning right again. For left turns it minus 90 degrees instead. Using this idea we are able to achieve the lawn mower pattern. We also included a manual over take function which allows the user to manually control the boat using the app.

As for mechanical side, we have made some modification to our previous concept design in order to make our product as simple but efficient as possible. We have changed the aeroplane-like acrylic body structure by replacing it with a tupperware as Mr. Tune has suggested us. The acrylic and tupperware serve the same function which is to hold and protect the electrical components from water.

IMG_1280.JPG

Not only that, we have also done the most important job of our product, which is to waterproof the motor. Firstly, we cover the small holes of the motor with epoxy and big holes with insulator tape. Epoxy and tape covering the holes allow the silicon sealant to be applied around the motor. After that, we apply the silicon sealant all around the motor. Without the epoxy and tape, the silicon sealant sealant would flow into the motor which may jam the motor. Silicon sealant is a white substance used to block the passage of fluids through the surface or joints or openings in the materials, a type of mechanical seal. Do take notes that the silicon sealant cannot be in touch with the contact of the motor case and the shaft, otherwise the shaft is not able to rotate. After that, we attach the propeller to the motor shaft by using the epoxy. At last, we seal the contact of the shaft and motor case with the grease. Applying grease must be the last step as after that, we cannot apply other sealant as the sealant will not stick on the surface anymore.

Silicon Sealant
AB Epoxy

First try : Attach the propeller to the motor using hot glue
Second try : Attach the propeller to the motor using AB epoxy
Waterproofed water is clamped in a 3D printed motor bracket

Furthemore, we have made calculations to make sure our product float on water. Getting the volume of water displaced needed, we buy the size of of pipes that we need from the hardware shop in Clementi. We have also purchased 4 pipe brackets hold the pipes and 4 caps to conceal the pipes.

After we assemble the pipes, motors and tupperware to the base, we noticed that there are some design flaws we may need to put more concerns:
  1. The prototype is tilted forward when floating on the water as the pipe is located off the middle. This is a serious issue because if the prototype runs in a tilted direction, the prototype will move inwards to the water instead of moving forward on the water. This issues can be solved by adjusting the location of the pipe on the bracket .
  2. The middle part bends downwards. This may cause the prototype to break in the middle part and reduce the lifetime of the prototype.
That’s all for now. Thanks for reading our blog. We will show you how to solve the design flaws in the next post. So stay tune! :D