Wednesday, October 3, 2018

NEW MEDIA TECH : FINAL ASSIGNMENT

THE MOBILE TRASH BIN


As for final project, i have made a mobile trash bin which can move by a mobile device and open on its own  

Designing.


upon sketching i first see what i  find  thing are available  and what i can purchased to build with,  after that i begin the sketch to visualize what i it will be.



Development.

when it come to build the machine, its wasnt the hardest part until i reach the certain  point which i explain later. but for now, here what the material i used build:

ROVER 5
KS0007 motor shield driver
Arduino uno
Ultrasonic sensor
Micro servo 9g
Battery box 6 platform
Bluetooth hc-05 

once we have the material now its time too build . 

step 1: wiring the chassis rover


might jumble up in your point of view but here  how the wiring will look like




step 2: wiring the servo and the sensor

both servo and sensor are in place

and connected to the  bread board

 this here the basic on how it connect the sensor and the servo along with the arduino


CODING

coding is one of the hardest part for as i had multiple trial and error through out my mid and late  development as if now here the code.

this is coding for the Servo and sensors

#include<Servo.h>                //Adding the Servo library

Servo myservo;            //Define an object named MyServo
const int eko=8;        
const int trig=7;        
int mesafe;
int sure;

void setup() {
  myservo.attach(9);           // arduino to the servo motor
  pinMode(trig,OUTPUT);        
  pinMode(eko,INPUT);          
}

void loop() {
  myservo.write(0);       
  Serial.begin(9600);     
  

   
  digitalWrite(trig, LOW);         
  delayMicroseconds(10);
  digitalWrite(trig, HIGH);       
  delayMicroseconds(20);
  digitalWrite(trig, LOW);         
  sure = pulseIn(eko, HIGH);      
  mesafe= (sure/29.1)/2;  
  

  if(mesafe<=5){
    myservo.write(160);
    delay(5000);   
  }
  
   
  if(mesafe>200)
mesafe=200;
Serial.print("mesafe");
Serial.println(mesafe);
delay(500);
}

and here for the motor 


#include <AFMotor.h>

AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor1(1, MOTOR12_64KHZ);
int state = 0;

void setup() 
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Welcome: Forward = 1 Left = 2 Right = 3 Backwards = 4 Stop = 0");
  motor2.setSpeed(1100);     // set the speed to 200
  motor1.setSpeed(1100);     // set the speed to 200
}

void loop(){   //if some data is sent, read it and save it in the state variable

if(Serial.available() > 0)
  {
    state = Serial.read();
    Serial.print("I received: ");
    Serial.println(state);
    delay(10);
if (state == '0') 
    {
      motor2.setSpeed(200);     // set the speed to 200/255
      motor1.setSpeed(200);     // set the speed to 200/255
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      Serial.println("Stopped");
      delay(100);
      state = 0; 
    }
else if (state == '1')      // If 1 Forwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(200);     // set the speed to 200
      motor1.setSpeed(200);     // set the speed to 200
      motor2.run(FORWARD);      // turn it on going forward
      motor1.run(FORWARD);      // turn it on going forward
      Serial.println("Forward");
      delay(100);
      state = 0; 
    }
else if (state == '2')      // If 2 Turn Left
    { 
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward  
      motor1.setSpeed(255);     // set the speed to 200/255
      motor1.run(FORWARD);
      //motor2.run(BACKWARD);      
      Serial.println("Left");
      delay(100);
      state = 0;     
    }
else if (state == '3') {    // If 3 Turn Right
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(255);     // set the speed to 255
      motor2.run(FORWARD);      
      //motor1.run(BACKWARD);    
      Serial.println("Right");
      delay(100);
      state = 0;  
    }
else if (state == '4')       // If 4 Backwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(200);      // set the speed to 200
      motor1.setSpeed(200);      // set the speed to 200
      motor2.run(BACKWARD);      // Motor 2 backwards
      motor1.run(BACKWARD);      // Motor 1 backwards
      Serial.println("Backward");
      delay(100);
      state = 0;   
    }
else if (state == '5') 
    {
      motor2.run(RELEASE);      // turn it on going release
      motor1.run(RELEASE);      // turn it on going release
      motor2.setSpeed(255);     // set the speed to 255
      motor1.setSpeed(140);     // set the speed to 140
      motor2.run(FORWARD);      // Motor 2 forward
      motor1.run(FORWARD);      // Motor 1 forward
      Serial.println("Forward Right");
      delay(100);
      state = 0;   
     }
else if (state == '6') 
    {
      motor2.run(RELEASE);      // turn it on going release
      motor1.run(RELEASE);      // turn it on going release
      motor1.setSpeed(255);     // set the speed to 255
      motor2.setSpeed(140);     // set the speed to 140
      motor2.run(FORWARD);      // Motor 2 forward
      motor1.run(FORWARD);      // Motor 1 forward
      Serial.println("Forward Left");
      delay(100);
      state = 0;   
     }
else if (state == '7')       // If 4 Backwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor1.setSpeed(255);     // set the speed to 255
      motor2.setSpeed(140);     // set the speed to 140
      motor2.run(BACKWARD);      // Motor 2 backwards
      motor1.run(BACKWARD);      // Motor 1 backwards
      Serial.println("Backward Right");
      delay(100);
      state = 0;   
    }
else if (state == '8')       // If 4 Backwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(255);     // set the speed to 255
      motor1.setSpeed(140);     // set the speed to 140
      motor2.run(BACKWARD);      // Motor 2 backwards
      motor1.run(BACKWARD);      // Motor 1 backwards
      Serial.println("Backward Left");
      delay(100);
      state = 0;   
    }
else if (state >= '9')
    {
      Serial.println("Invalid");
      delay(100);
      state = 0; 
    }
  }
}


note; some of these will not work without AFmotor library which use to made the motor functional.


Now for the next part make the remote control using android or any mobile phone which created using html, css or javascript.


this is the most challenging and difficult to do alone and mostly struggle understanding using of CSS and javasript which i have no basic knowledge of css and javacript.


for my easy way for me to create a simple remote control is by using a APP inventor

below here is how i create the button and functions.



overall  based on my development , most of the coding i have use are sometime able to control the trash bin using the app inventor .
due to my zero knowledge of basic html,css, and javaScript i had to use the apps inventor which i had failed too meet the requirement for my lecturer.

as for now i really need to learn more in basic CSS and JavaScript.


Tuesday, October 2, 2018

NEW MEDIA ART 1 : assignment 1

LIFE GROW ALONG


above is inaccurately based for the psychical replica

Description -
For  my final assignment for  MA1 ,i have  created a Sculpture using a  clay 
Creating the Creation -
based on the artwork above i have to creating it with large amount of hard clay and wax color,
in order to form the shape i have design it the frame with copper wire and cardboard box fer the shape.
later on cover the frame with clay and add wiring to the sculpture along with it.
The hard part of development-
as for hardest part is to maintain the clay in shape when it starting to dry, unfortunately once it dry it quite brittle, so i had to redo the modeling and add more metallic wire inside the modeling as it dry along. later on i had to create a wiring circuit .
Expression-
base on the sculpture, it represent the tree and fruit it bear on the tree and glow ever brightly
the tree represent the growth and the fruit represent the effort it bear such as hope ,future and happiness.
The sculpture
the psychical sculpture has been given to madam Tengku puteri  for submission , which have no image to represent the original sculpture . this assignment was such a old work which i have no data to preserve it.