WELLCOME -----FYP S2 2011 PROJECT BLOG-----SUPERVISED BY: SIR KAMALUL FAIZIN B. MOHD SUHUT

Wednesday, March 30, 2011

DATELINE:19th APRIL 2011

Okay there is a motherlode of shock wave shocked me after I am hearing about my FYP presentation dateline. 2 weeks to go prepare for my report, presentation, logbook, posters, and yet my software is STILL NOT WORKING!!!!!!!!

I am a little bit crazy and hazy and I am sure I am not the only one. Just have to try my best...

Ugh.... :(

Saturday, March 26, 2011

Wire Identification

Motor Identification.

 One winding is on each stator pole.Unipolar motors may have 5 leads but generally have 6 or 8 wires. In all the motors we have seen, the wires for the 6 & 8 types come out in two bundles of 3 or 4 wires resp. Unipole steppers have two coils per stator pole. In the 8 lead motors the 2 leads from the 2 coils from both stators emerge from the motor. In the 6 lead motors the two coils on each stator pole are joined (opposite sense) together before they emerge from the motor. In the 5 lead  motors each of the two joined wires are themselves joined  before they leave the motor. In the 6 wire version a multimeter (set it to 200ohm resistance range) will show which is the centre lead within each group of 3 leads. 


5 wire version

6 wire version
 Typically the resistance between the centre lead to the other two will be about 40 ohms while the resistance between the outer two leads will be twice that. Call the outer two leads in each of the two bunches of wires A & B, C & D.  The centre lead in each bunch is the power lead & goes into the pad marked +.  Note that it does not matter which way around the A/B, C/D leads go onto the pads. 

 In the 5 wire motor these centre leads  are  connected internally. Note that both + pads on the PCB are connected together.So to power a 5 lead stepper just connect the common centre tap lead from both phases to one of  the + pads. The A/B, C/D leads are connected just as  in the 6 lead motors. 

STILL NOT WORKING

Okay just an update about my Xbee..Still not working... Em... I dunno wut to do so I think I'll just go writes about my report and the other 2 assignments. I dunno how to get the receiver talking to each other. Maybe it's because of I didn't use 2 UNO's. Hm.... Yeah! I think so, but if we configures it separately, it would still works just fine. 
Em, Yes, now I just rambling on and on to make the posts seems a lot more than it actually is. 

AH, now I remember. Yesterday, we went to see Sir Kamal and bring along our so called 'back up plan' for the infusion pump. And yes it works just fine (credit to my best freind Syed Akil), and we disassembled the pump and adjust it to our own stepper motor. I do not have any pictures of it yet but I'll update it just for the sake of rubbing it to your face Hahahahaha. kidding... :)

Sir Kamal also mentioned about this awesome IC for driving a stepper motor. It is 5804 and it is considered awesome because it will only USE 2 PINS TO YOUR UNO!!!! Isn't that fantastic?? XD 




Now I am at Kuala Pilah hotel, Melang Inn rambling on what to do.. Sir Kamal and my partner Hilwani are both busy with their program at Tasik Puteri, Rawang. May Allah bless them with their good doings there. I heard they going to cook as well! I hope I can go there when I get back. Insyaallah when I have done my report. :)

Thursday, March 24, 2011

EYE SORE SORRY :P

Okay... Table below is created to make my viewer's life easier. I know that it is an eye sore when everything is written in essay form.. But please remember that the other 2 red wires from the stepper motor (unipolar) is connected to 5V. Then your stepper motor is ready to go! :)
                                                                             

Wednesday, March 23, 2011

AWESOME STEPPER MOTOR!!! :D

Alhamdulillah, our prayers and hard confusing moments of stepper motor have passed! Thanx to our lecturer of medical subject, sir Zul, who has giving us hard 2 hours of agonizing torture, brainstorms and much more to use stepper motor with our UNO. Okay, I am so excited to write about this post, I don't even know where to start. XD 

Okay firstly, we have to know what is the stepper motor that we're about to use. For our project, we use unipolar stepper motor, with 6 wires, colored with 2 reds, orange, yellow, brown and black. The 2 reds is actually the power wire, so it'll be connected to Vin at Arduino. We also have to bear in mind that these color coding are different according to it's manufacturer or country where it's made. (ahah!!! I bet you're just as shocked as I am when I found out about this!) 


Figure 1: Unipolar stepper motor, schematic diagram 

Then, the other 4 wires are determined by the stepper constructions at this one blog sir Zul has given us, found by him in the internet, and can be connected to the H bridge, used to control the motions of it's sequences. I cannot find the links that my lecturer gave me, but I am sure I remember how those wire are connected to the H bridge.

The H bridge is actually transistors to control the movements of the stepper motor, forward or backwards. the H-bridge is so named because it has four switching elements at the "corners" of the H and the motor forms the cross bar. The H bridge that we used to control our stepper motor is L293. The schematic diagram is shown as the figure below. 

Image: Courtesy of Texas Instrument Datasheet. 
Figure 2: L293 (H-bridge circuit diagram). 

So, pin 3 and 6 and connected to: black and yellow and pin 11 and 14 are connected to orange and brown respectively. Then, pin 4,5,12 and 13 are joined together and connected to pin GND at UNO. Pin 16 and 2 red wires are joined and connected to 5V at UNO, and pin 8, 9 and 1 are connected to 5V. Then, lastly connect pin 7 to 11, pin 2 to 10, pin 15 to 9, and pin 10 to  at the UNO. 

After all these wires are connected, upload these sketches to your ARDUINO. 




#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 100
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);
void setup(){  // set the speed of the motor to 30 RPMs  
stepper.setSpeed(20);
}
void loop()
{
  stepper.step(1*STEPS);
  delay(2000);
  stepper.step(-1*STEPS);
  delay(2000);
}


The above sketches is from sir zul also... Check out the video below, You'll understand what it's doing.




So, there you go, our stepper motor for infusion pump configures... Only next we have to determine what is the flow rate and connects the motor to a gear to push the tube. I hope we can get this all done by the end of the month. Wish us all the luck in the world!!! Insyaallah!!! :)

Saturday, March 19, 2011

VIDEO OF MY LOVABLE LCD


This is the only love I have for my software gutlessness. Oh.....why.....why none of everything's working..? Oh well, at least you guys know that your LCD works fine as long as u follows the examples on Arduino software just like mine :)

p/s: The song from the background is from Hati Yang Telah Kau Sakiti - Rossa. :p

THE OTHER LCD

Check out the other LCD that we've bought. We did exactly the same with the blue one, but what came out is nothing... We uploads the same programs as the blue one had, here's the picture.


Notice the one horizontal empty lines at the contrast test?Yeah, I was wondering about that too. Maybe one of the lines got stuck with each other. I have to solder them again but now I don't have the digital multimeter with me. 


THE PLAN

1. Bubble detected from infusion pump (Part 1)
2. The Xbee from the infusion pump system part  sends a specific code to Arduino at monitoring system (Part 2).
3. The Xbee from monitoring system receives that code, and the arduino reads the code and conveys actions such as:

       i. Sends data to LCD
      ii. Sends data to 7 segment to display which bed or infusion pump have problems.
     iii. Sends data to Buzzer.

Okay now I am sure u all have an idea how my project works, the thing is the xbee won't communicate with each other!!! Click below to view what I've gone through to done the configuration, 


yeah, it works for some people but for us, it's not...maybe we didn't update our X-CTU software, but I've already ask my lecturer, he said that he did'nt need the X-CTU at all.. How mysterious.... 

                                                                        

LCD SKETCH

Well for those who's been asking my LCD skecth here u go..This is the only thing that worked real good with my arduino.. :( 


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Monitoring: OK");
  delay(1000);
}

void loop() {
  // scroll 13 positions (string length) to the left 
  // to move it offscreen left:
  for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayLeft(); 
    // wait a bit:
    delay(250);
  }

  // scroll 29 positions (string length + display length) to the right
  // to move it offscreen right:
  for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
    // scroll one position right:
    lcd.scrollDisplayRight(); 
    // wait a bit:
    delay(250);
  }
  
    // scroll 16 positions (display length + string length) to the left
    // to move it back to center:
  for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayLeft(); 
    // wait a bit:
    delay(250);
  }
  
  // delay at the end of the full loop:
  delay(1000);

}


It's fun to see it scrolling out like that but I am really bummed with my Xbee and 7 segment..

SKETCHES... T_T

I am fading....Oh...So help me..here guys, this are my sketches for my project..I upload the one that is broken for u guys to try it out...and maybe u guys can figure this thing out for me..


//Pin connected to ST_CP of 74HC595
int latch = 3; //14 green
//Pin connected to SH_CP of 74HC595
int clock = 2; //12 yellow
////Pin connected to DS of 74HC595
int data = 6;  //11 blue
byte dataArrayRED[8];
void setup() //runs once 
{ 
pinMode(data, OUTPUT);
pinMode(clock, OUTPUT); 
pinMode(latch, OUTPUT);
Serial.begin(9600);
}
void loop() // run over and over again
{
digitalWrite(latch, HIGH);
delay(1000);
digitalWrite(latch, LOW);
delay(1000);
}


When I upload it, it doesn;t blink as I had hoped it would be, it just stays "on" without any fades or blink. Hm.....


The only part that lights up now, is that one part. Oh no~~ when I try uploaded some other programs that I've alter from the internet, it shows the same results. How could that be???

//Pin connected to ST_CP of 74HC595
int latchPin = 3;
//Pin connected to SH_CP of 74HC595
int clockPin = 2;
////Pin connected to DS of 74HC595
int dataPin = 6;

//holder for infromation you're going to pass to shifting function
byte data = 0; 



void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);

}

void loop() {

  //function that blinks all the LEDs
  //gets passed the number of blinks and the pause time
  blinkAll_2Bytes(1,500); 

  // light each pin one by one using a function A
  for (int j = 0; j < 8; j++) {
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, 0);
    //red LEDs
    lightShiftPinA(7-j);
    //green LEDs
    lightShiftPinA(j);
    //return the latch pin high to signal chip that it 
    //no longer needs to listen for information
    digitalWrite(latchPin, 1);
    delay(1000);
  }

  // light each pin one by one using a function A
  for (int j = 0; j < 8; j++) {
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, 0);
    //red LEDs
    lightShiftPinB(j);
    //green LEDs
    lightShiftPinB(7-j);
    //return the latch pin high to signal chip that it 
    //no longer needs to listen for information
    digitalWrite(latchPin, 1);
    delay(1000);
  } 

}

//This function uses bitwise math to move the pins up
void lightShiftPinA(int p) {
  //defines a local variable
  int pin;

  //this is line uses a bitwise operator
  //shifting a bit left using << is the same
  //as multiplying the decimal number by two. 
  pin = 1<< p;

  //move 'em out
  shiftOut(dataPin, clockPin, pin);   

}

//This function uses that fact that each bit in a byte
//is 2 times greater than the one before it to
//shift the bits higher
void lightShiftPinB(int p) {
  //defines a local variable
  int pin;

  //start with the pin = 1 so that if 0 is passed to this
  //function pin 0 will light. 
  pin = 1;

  for (int x = 0; x < p; x++) {
    pin = pin * 2; 
  }
  //move 'em out
  shiftOut(dataPin, clockPin, pin);   
}


// the heart of the program
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first, 
  //on the rising edge of the clock,
  //clock idles low

  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);

  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);

  //for each bit in the byte myDataOut�
  //NOTICE THAT WE ARE COUNTING DOWN in our for loop
  //This means that 000001 or "1" will go through such
  //that it will be pin Q0 that lights. 
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result 
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000 
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {
      pinState= 0;
    }

    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin  
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  }

  //stop shifting
  digitalWrite(myClockPin, 0);
}


//blinks both registers based on the number of times you want to 
//blink "n" and the pause between them "d"
//starts with a moment of darkness to make sure the first blink
//has its full visual effect.
void blinkAll_2Bytes(int n, int d) {
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, 0);
  shiftOut(dataPin, clockPin, 0);
  digitalWrite(latchPin, 1);
  delay(200);
  for (int x = 0; x < n; x++) {
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 255);
    shiftOut(dataPin, clockPin, 255);
    digitalWrite(latchPin, 1);
    delay(d);
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    digitalWrite(latchPin, 1);
    delay(d);
  }
}

Okay I give up. Maybe I'll try this after zohor prayer. Bye~~

Monday, March 14, 2011

XBEE TO TALK TO EACH OTHER


Above is the link that I've found. Hope tomorrow I can try it with Hilwani that is now busy with her keypads and pumps. LOL!! She got so much to do it is cruel for me to laugh about is but it is fun to know your partner is that panic!!
Well I got presentations and 3 reports to write so I am off to do that today! :)

TSUNAMI IN JAPAN...

Just an update for this week.I think I should say something. There's been another Tsunami in Japan last Friday, and it sure shakes our self and our little hearts. It takes me back where I begin, pondering about my mistakes that I've made, sins that I commit. Ah, will ALLAH forgive us?
Sure, he will if we ask him to. We just never had time for ALLAH. Poor humans like me, always busy wasting my time. Astaghfirullah.
Here is a blog that I visit through my freind's facebook page, this week's post is not about FYP guys, it's about another post of TANBIHUL GHAFILIN. (for those who forgets)
Click on this link to view the disaster created by this 10 m waves. 
Subhanallah, we created everything in His world, doing everything in his world, forget who we are in His world, all of our creations, gone just in seconds. This catastrophic incident is caused and being banish, burns to ground, only by.... water.

Monday, March 7, 2011

THE COMING..BE AFRAID.BE VERY VERY AFRAID...

                  8th week!!!!Oh my!!!I never thought I would have this crazy busy!!!I haven't got the time to write what I've been doing in the past days..So to summerize it, here we go:
                  1. I've checked my LED 7 segment, turns out I got the whole colour coding of the resistors wrong!!!No wonder the LED's in a very crazy mood!Then I changed the connections to the new resistors, it works just fine, no need extra IC for driving currents like I discovered before.hehehehehe :D
                  2. I've done the LCD of the patient's part. (Same like the one in the monitoring.)
                  But...I still can't figure out how to work on the keypad. I have to get the IC first, but until now I didn't know what is the function of the IC..maybe still, to reduce the input to arduino connection. I am getting tired and cramped, with my hopes are all burns to dust and my future is in jepordy. Arghhhhhhhhh~!!!!!!!!!!!!