Wednesday, June 12, 2013

Explanation of the prototype

As for my assigned role for this group is together with Olivia to build up a prototype according to the design we have conducted. My main focus was to use Arduino to control a mechanic system for this automated shelf. The input of control for the motion of the servo and motor will be control by push button as a purpose to demonstrate the working mechanic, the interaction and automatic part will be demonstrate through Crysis environment.

However a few thing went wrong. The prototype and arduino did not 100% working due to the device we have chosen and the ability of it to pull of lift up an object in the prototype.

To come up with this final design, things that we considered to conclude this mechanic design was mainly the availability of the equipment we used, and the cost of the equipment. To make our prototype working perfectly our thought was to use a linear motor which can control the exactly position of  the moving plate.

Video below to show example of a linear motor.


Animation created by olivia

Due the the cost the size of this device we then thought of using something that is simple and low cost but then following up with the problem that it would not able to handle a curtain weight. Which was the problem in our design and we did not realise that in an earlier stage.

As the prototype is not the main element of the project. The aim for this prototype is to establish a brief understanding of our basic concept and basic ideas toward the design of mechanic system.

Summary of the mechanic system 

 So this is the mechanic system that is installed on the top place of the prototype. It consists of 2 DC motors, full rotation servo, electromagnet and the battery

The 2 wires from electromagnet is twined on the full rotation servo, those wires needed to connect to the battery to enable the electromagnet. The wires must pair up with the right core to enable to electromagnet. (positive with positive, negative with negative)


The servo control the length of the wire connected to the electromagnet. (servo is controlled to rotate in two direction)


 The two motor is used to pull the car left and write, the direction is controlled by L293D IC motor driver.


The electromagnet is made out of the piece of metal, wired around by very thing insulated copper wire. This needed to wire a number of time to strengthen the electromagnet to attract a steel better. (steel which is attached to the boxes) The copper wire then need to be connect to an insulated flexible wire to be able to twin into the servo.

Mechanic design with arduino

Taking the prototype into parts, the main mechanic that was included in this prototype is as followed;

1. The motor pulling the car (which has a full rotation servo and the electromagnet attach on top) left and right along the top rail of the prototype.

In terms of coding and making to to move left and right, I am able to assign code and control arduino to control the two DC motors to move left and right. The car was moving left and right according to the button pushes shown in below video.


To allow to arduino to control direction of the two motors and L293D IC was a best option available to me. As first, L293D does not cost mush it was only $3-5 a piece. With the option that I could have gone through is to use motor driver shield but that would cost us more to purchase. I did a research on how the L293D would work and came up with this two moving DC motors control by 2 set up of L293D to control each motor separately using 2 push buttons.

2. The full rotation servo

This is the part where it sit on the moving car. It is attached with the electromagnet and wire. to pull it up and down according to the two push button. Again I was successfully control to direction of the servo to go backward and forward. As in followed video


As in the demonstration in the presentation, this part of the prototype was working.

As consulting with Russell in the last week before a presentation he mentioned to me to use a stepper motor instead of the dc motor. I then did attempt to try get the stepper motor work.


But it did not seem to rotate in both direction. Please refer back to my previous post for the code and the circuit diagram. http://tharidarattanajaturonarch1392-2013.blogspot.com.au/2013/06/week-13-experiment-on-new-mechanic.html

As a lack of time and experience of using stepper motor I then decided not to put them into the prototype.

3. The boxes and the railing


The boxes were able to move quite smoothly along the rail. Thing that we did not mention in our presentation was why the rail was there and how is it constructed.

As the purpose of our design, the rail was to hold the box still, as we did not want the box to be freely lift in the air which a high chance for it to swing, the rail is there to keep boxes in place .

The way the rail and the boxes constructed is guided in olivia's design and interpretation of the technical drawing as followed;




Saturday, June 8, 2013

Blog summary

Weekly Progress


Week 1:
Curriculum Vitae (First week of the course)

Week 2:
Group allocation and roles (Assigned to group, project and roles)

Week 3:
Feedback on group back brief

Week 4:
Research on idea for electronic shelf
Group discussion and problems on design approach

Week 5:
Code Planning
Group meeting: New idea for mechanic system

Week 6:
Team discussion on new design approach
Group 1 review on PLANNING

Week 7:
Coding Idea
Group 2 review on COMMUNICATION

Week 8:
Group 3 and 4 review on INTELLECTUAL PROPERTY
Prototype progress (first draft)
Prototype progression
Individual Major Milestone

Week 9:
Feedback for Milestone and Presentation Preparation

Week 10:
Group 5 review on CONFLICT
Feed back for group presentation on 'Conflict'
Working with Kinect
Research on L293D IC

Week 11:
Progress on Arduino
Group 6 review on REMUNERATION

Week 12:
Project progress and problem
Working with Arduino
Prototype and Arduino

Week 13:
Experiment on STEPPER MOTOR
Video demonstrate mechanic system and prototype

Navigation



Group Wiki Page: http://kinectingtheboxes.wikispaces.com/Welcome

Group Review:
Group 1 review on PLANNING
Group 2 review on COMMUNICATION
Group 3 and 4 review on INTELLECTUAL PROPERTY
Group 5 review on CONFLICT
Feed back for group presentation on 'Conflict'
Group 6 review on REMUNERATION

Individual Major Milestone:
Individual Major Milestone
Feedback for Milestone and Presentation Preparation

Research:
Research on idea for electronic shelf
Research on L293D IC

Project contribution and progress:
Group discussion and problems on design approach
Coding Idea


Thursday, June 6, 2013

Week 13: Experiment on New Mechanic System: STEPPER MOTOR

As the mechanic system of our prototype does not work properly due to the limitation control on the DC motor. As at the early stage we were all agree on using DC motor as it save on cost and I do have a bit of knowledge of how to use DC motor however Russell advice us to use STEPPER motor for to drive to car on the top rail.

After discussing with the rest of the group we decided to create a new mechanic system using stepper motor. According to Russell advice email, he provided us a link to a tutorial as followed; http://garagelab.com/profiles/blogs/tutorial-controlling-the-displacement-of-a-stepper-motor-with-the and we realized that to control a stepper we need to have an "EASY DRIVER" which is needed to control the motor.

Russell has ordered the easy driver for us and predicted to be delivered by this Friday.

Meanwhile I have attempted tried to control the stepper motor with the L293D that I have as I found on this tutorial, http://itp.nyu.edu/~gg964/blog/archives/1369. As I have no idea how to control stepper motor I then search for a tutorial, I found the forum that contain the code that I need from this forum (http://forum.arduino.cc/index.php/topic,152747.0.html)


I then tried to wire up stepper motor to Arduino board and used the code in the forum as a guide but it did not seem to work properly.

This is the diagram of Arduino circuit that I made.



And this is the video of stepper motor that is control by the two push buttons. What it is meant to do is rotate in two opposite direction when the different button is pressed. But at the moment it is still going into the same direction.


And this is the code that I used:

// 4 wire bipolar stepper motor driver code for L293D which controlls the direction of the motor with two push buttons for each clockwise and counter clockwise direction. After completing the predefined steps in 'motorstep' waits for the new direction command will come from one of the push buttons

const int CW = 2;
const int CCW = 3;
const int ENA = 8;
const int ENB = 13;
const int black = 9;  // IN1 pin of L293D
const int brown = 10;  // IN2 pin of L293D
const int orange = 11;  // IN3 pin of L293D
const int yellow = 12;  // IN4 pin of L293D
int valA = 0; // counter clockwise button vallue
int stateA =0; // state of the counter clockwise button
int valB = 0;  // clockwise button value
int stateB = 0; //state of the clockwise button
int pause = 10; //delay between each step for slow rotation
int motorstep = 48; // number of steps when the buttons are once pressed

void setup(){
  pinMode(black, OUTPUT);
  pinMode(brown, OUTPUT);
  pinMode(orange, OUTPUT);
  pinMode(yellow, OUTPUT);
  pinMode(CW, INPUT);
  pinMode(CCW, INPUT);
}

void loop(){
  valA = digitalRead(CW); //reads the CW button value and writes to 'valA'
  if(valA ==HIGH){
    stateA = 1- stateA;
    delay(1000); // to get rid of button bouncing (arduino reads the buttons really fast!!)
    stateB = 0;
    reverse(motorstep); 
  }
 
  valB = digitalRead(CCW); //reads the CCW button value and writes to 'valB'
  if (valB == HIGH){
    stateB = 1- stateB;
    delay(1000); // to get rid of button bouncing (arduino reads the buttons really fast!!)
    stateA = 0;
    forward(motorstep);   
  }
} // end loop

void reverse(int i){
  // Pin 8 Enable A Pin 13 Enable B on
  digitalWrite(ENA, HIGH);
  digitalWrite(ENB, HIGH);
 
  while (1)   {
    digitalWrite(black, 0);
    digitalWrite(brown, 1);
    digitalWrite(orange, 1);
    digitalWrite(yellow, 0);
    delay(pause); 
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;

    digitalWrite(black, 0);
    digitalWrite(brown, 1);
    digitalWrite(orange, 0);
    digitalWrite(yellow, 1);
    delay(pause);
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;

    digitalWrite(black, 1);
    digitalWrite(brown, 0);
    digitalWrite(orange, 0);
    digitalWrite(yellow, 1);
    delay(pause); 
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;

    digitalWrite(black, 1);
    digitalWrite(brown, 0);
    digitalWrite(orange, 1);
    digitalWrite(yellow, 0);
    delay(pause);
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;
  }

  // all outputs to stepper off
  digitalWrite(ENA, LOW);
  digitalWrite(ENB, LOW);

}  // end reverse()



void forward(int i){

  // Pin 8 Enable A Pin 13 Enable B on
  digitalWrite(ENA, HIGH);
  digitalWrite(ENB, HIGH);

  while (1){

    digitalWrite(black, 1);
    digitalWrite(brown, 0);
    digitalWrite(orange, 1);
    digitalWrite(yellow, 0);
    delay(pause);
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;

    digitalWrite(black, 1);
    digitalWrite(brown, 0);
    digitalWrite(orange, 0);
    digitalWrite(yellow, 1);
    delay(pause); 
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;

    digitalWrite(black, 0);
    digitalWrite(brown, 1);
    digitalWrite(orange, 0);
    digitalWrite(yellow, 1);
    delay(pause);
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;

    digitalWrite(black, 0);
    digitalWrite(brown, 1);
    digitalWrite(orange, 1);
    digitalWrite(yellow, 0);
    delay(pause); 
    i--; // reduces the remaining 'motorstep' value as "motorstep-1" for each step
    if (i < 1) break;
  }

  // all outputs to stepper off
  digitalWrite(ENA, LOW);
  digitalWrite(ENB, LOW);

}  // end forward()

At the moment I think the part that is control the direction of the motor is the number 0 and 1 which is disable and enable the pin output from L293D. It is somehow need to be set correctly to find the right direction for the motor.


I still cannot find the right value for the motor to go forward and reserve but I think this could be the right track to go as when I change these value the motor seem to do different movement.

Saturday, June 1, 2013

Week 12: Prototype and Arduino

Setting up Arduino on the Protoype

Now we have put all the part of the prototype together and I have now set up the Arduino board to the prototype.


This is the front view of the prototype. The rail doe the motors and car is placed at the top of the timber and is covered by balsa wood and texture to tidy up for the clean look of the prototype.


The shelf is made for the Arduino board to be placed as well as other mechanic component for the prototype. The box is attached at the bottom is balance the prototype to stand on its own.


This is when the Arduino board is placed. There are 4 wires from the board attached to the two motors. Two 9 V batteries and a ser are place on the stand. The full rotation servo will be installed on the car.


Arduino will be plug into my laptop for the power source and to upload a code for the board.

Friday, May 31, 2013

Week 12: Working Arduino

At this stage I now set up a new Arduino circuit and wrote up a new code to control separate 2 DC motors and also to control a full rotation servo.
What I have now is the 2 L293D motor driver to control each motor by the push button. There are two push button to control each motor. While one motor is rotating the other will be disabled and while the other is push will work other wise. The reason to separate the two DC motor is becasue of the power supply. In this circuit the power from 9V battery is supplied separately. (See below Diagram)

There are also another push button to control the direction of the full rotation servo. Once the button is pressed servo will rotate clockwise after a set time it will then rotate counter clockwise for a certain seconds

Video below shows how to servo works with the push button.


Another push button is also installed to control the standard servo this one will act as a switch for electromagnet. At this stage we can not find the way to make a magnet stronger. Therefore we will not be putting it in the prototype.

The following is the code applied in the Arduino Application.

#include <Servo.h> //include servos in the code

Servo servoMain; //identify servo as a main servo
Servo servoSwitch; //identify servo as a switch servo for eletromagnet

int switchPin = 1; //push button pin for motor to go left
int switch2Pin = 2; //push button pin for motor to go right

int servoSwitchPin = 4; //push button pin for electrmagnet switch
int mainServoLongPin = 7; //push button pin for main servo to move down
int mainServoUpPin = 8; //push button pin for main servo to move up

//pin for L293D H-bridge motor drive
//left motor
int motor1Pin1 = 6; // pin 2 on L293D
int motor1Pin2 = 11; // pin 7 on L293D
int enablePin = 5; // pin 1 on L293D

//right motor
int motor2Pin1 = 10; // pin 2 on L293D
int motor2Pin2 = 9; // pin 7 on L293D
int enable2Pin = 3; // pin 1 on L293D

void setup() {
 
   pinMode(switchPin, INPUT); //set left push button as an input
   pinMode(switch2Pin, INPUT); //set right push button as an input
  
   pinMode(servoSwitchPin, INPUT); //set main servo push button as an input
   pinMode(mainServoLongPin, INPUT); //set main servo push button to move down as an input
   pinMode(mainServoUpPin, INPUT); //set main servo push button to move up as an input
 
  //set L293D pins as output pins for left motor
   pinMode(motor1Pin1, OUTPUT);
   pinMode(motor1Pin2, OUTPUT);
   pinMode(enablePin, OUTPUT);
  
   //set L293D pins as output pins for right motor
   pinMode(motor2Pin1, OUTPUT);
   pinMode(motor2Pin2, OUTPUT);
   pinMode(enable2Pin, OUTPUT);

   //set the enable pin from IC to motors as an 'off'/ disable motors
   digitalWrite(enablePin, LOW); //disable left motor
   digitalWrite(enable2Pin, LOW); //disablr right motor
}

void loop() {
 
  //if this button is pressed
  //the switch servo rotate to 0/ 180 position
  if (digitalRead(servoSwitchPin) == HIGH) {
   
  servoSwitch.attach(13);  //activate switch servo
                        
  servoSwitch.write(180); //tell servo to go to 180 position
  delay(3000); //stay for 5 seconds
  }
 
  //if the button is not pressed
  else {
       servoSwitch.write(0); //servo go back to 0 position
  }
 
  //if this button is pressed
  //main servo rotate clockwise
  //goes down and stop
  if (digitalRead(mainServoLongPin) == HIGH) {
 
  servoMain.attach(12); //activate main servo
  servoSwitch.detach();
 
  servoMain.writeMicroseconds(1700); //main servo rotate clockwise
  delay(100);
  }
 
  //if the button is not pressed
  else {
  servoMain.detach(); //deactivate main servo 
  }
 
  //if this button is pressed
  //main servo rotate anti-clockwise
  //goes up and stop
   if (digitalRead(mainServoUpPin) == HIGH) {
 
  servoMain.attach(12); //activate main servo
 
  servoMain.writeMicroseconds(1300); //rotate anti-clockwise
  delay(100);
  }
 
  //if the button is not pressed
  else {
    servoMain.detach(); //deactivate main servo 
  }
 
  //if this button is pressed
  //enable left motor
  //rotate for 2 seconds and stop
   if (digitalRead(switchPin) == HIGH) {
      digitalWrite(motor1Pin1, LOW); // set pin 2 on L293D low
    
      digitalWrite(motor1Pin2, HIGH); // set pin 7 on L293D high
   
      digitalWrite(enablePin, HIGH); // set pin 1 on L293D high
     
    }

//if this button is not pressed
//disable all the pins
//deactivate motor
    else {
        digitalWrite(motor1Pin1, LOW); // set pin 2 on L293D low
        digitalWrite(motor1Pin2, LOW); // set pin 7 on L293D low
        digitalWrite(enablePin, LOW); // set pin 1 on L293D low
    }
   
  //if this button is pressed
  //enable right motor to rotate in opposite direction
  //rotate for 2 seconds and stop
    if (digitalRead(switch2Pin) == HIGH) {
     
       digitalWrite(motor2Pin1, HIGH); // set pin 2 on L293D high
    
       digitalWrite(motor2Pin2, LOW); // set pin 7 on L293D low
    
       digitalWrite(enable2Pin, HIGH);// set pin 1 on L293D high
     
    }
   
  //if this button is not pressed
  //disable all the pins
  //deactivate motor
    else {
        digitalWrite(motor2Pin1, LOW); // set pin 2 on L293D low
        digitalWrite(motor2Pin2, LOW); // set pin 7 on L293D low
        digitalWrite(enable2Pin, LOW); // set pin 1 on L293D low
    }
}

Thursday, May 30, 2013

Week 12: Progress and Problem

The Prototype

This week we finally got the laser cut and now we assembled the prototype. This is what we have established so far in comparing the to original prototype the structure is keep the same. Only few changes in dimension and thickness of material.



The problem that we have with the prototype is that. The pieces were cut so perfectly that the chip(part that will be installed into the rail and attach to the box) lines up perfectly to the rail and leave no gap for it to move along the rail. Therefore we needed to use sand paper to sand it down to the size where it can move along the rail smoothly.

The other problem that we had was the glue used to stick the pieces together. Janu tried to find glue that could stick wood to plastic and plastic to plastic. The problem is that the glue dry out very slow and it ended up was not placed properly, that result in the box couldn't not move through the rail properly.

The Arduino


After trying to get the motors to work now I have faced a problem with Arduino and DC motors. At the moment I can get the motor to move into 2 opposite direction however it does not always work all the time. Sometime the motor seem to stop rotating and sometime it seem to rotate really fast. The problem that I can identify is the power supply to the motor. Motor seem to rotate really weak after button is pressed for a while.

The problem is that the motor require a higher voltage then Arduino can supply. Especially two DC motors require much higher voltage. 

The solution that I can think of now is to supply separate power source to the two motors. To do this that means the motor need to be controlled separately by the 2 L293D IC and to work more efficiently on the two separate breadboard.

I would like to get rid of the LEDs as well as I might take up power from both Arduino and the battery, even a little amount but still something.

Friday, May 24, 2013

Week 11: Progress on Arduino

At this stage I now have a working 2 DC motors and a full rotation servo to rotate in both direction.


Basicly what I have on the arduino board are:
-Arduino Board
-Wires
-Breadboard
-Resistors
-Push buttons
-Dc motors

-L293D IC
-9V battery

How the code work is that  there is 2 push buttons, one to control two DC motors to rotate clockwise correspondingly and another button to rotate in opposite direction. The two motors will not be enabled if the button is not pressed.

 

The video above show the motion of the car what is pulled by the two DC motors. The two DC motors is control by one L293D IC. This is used to control the direction of the motor. The Two motor is pinned into the same input pin of L293D as to enable it to rotate in the same direction at the same time with the same push button.


This is the circuit of Arduino with the Two motors and two push button. I actually put in an LEDs light to indicate to motion of the motors.

At this stage we have a basic mechanism system of the prototype to work but it still needed to be test out when is used to lifted the boxes along the rail.