Thursday, 26 April 2012

Week 14

          This week, on 24 April 2012, there is demo presentation day at Gemilang hall UniKL BMI. Demo presentation day is a importance and as a bigday fot FYP student like me. For the Demo presentation, i will be asses by  Ass. Prof. Dr. Amir from Electrical Section and Mdm. Zabariah from Medical Section.
           All the prototype have been prepared and i make some study for this day as a preparation for me to answer any question from the assessor about my project. Below is my poster and prototype for the demo presentation day. 



               
                                           Poster




Prototype

















Saturday, 21 April 2012

Week 13

It is only 1 week to go!. I am very worried. This week, i focused with the circuit and programming.For programming, i start to write a program to display the RPM and speed. Below is the coding for the programming: 


 /*
 
  The circuit:
 * LCD RS pin to digital pin 7
 * LCD Enable pin to digital pin 8
 * LCD D4 pin to digital pin 9
 * LCD D5 pin to digital pin 10
 * LCD D6 pin to digital pin 11
 * LCD D7 pin to digital pin 12
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)



 */

// 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);

int ledPin = 13;               // choose pin for the LED
float start, finished;
float elapsed, time;
float circMetric=0.04; // wheel circumference relative to sensor position (in meters)
float circImperial; // using 1 kilometer = 0.621371192 miles
float speedk, speedm;    // holds calculated speed vales in metric and imperial

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
   pinMode(2,INPUT);
   pinMode(ledPin, OUTPUT);      // declare LED as output
  attachInterrupt(0, speedCalc, HIGH); // interrupt called when sensors sends digital 2 high (every wheel rotation)
  start=millis();
  circImperial=circMetric*.62137; // convert metric to imperial for MPH calculations
 // Print a message to the LCD.
  lcd.print("    Welcome   ");
  lcd.setCursor(0, 1);
  lcd.print("  Mc-Ergocycle  "); 
}

void speedCalc()
{
  elapsed=millis()-start;
  start=millis();
  speedk=(3600*circMetric)/elapsed; // km/h
  speedm=(3600*circImperial)/elapsed; // Miles per hour
}

void loop() {
  
   if ( digitalRead(2)== HIGH)             // == digunakan bagi declare condition
   {  digitalWrite(ledPin, HIGH);  // turn LED OFF
  } else {
    digitalWrite(ledPin, LOW); // turn LED ON
  }
 
 delay (1000);
  Serial.println(elapsed);
  Serial.println(speedk);
  Serial.println(speedm);
  Serial.println();
  lcd.setCursor(0,0);
  lcd.print(int(speedk));
  lcd.print(" km/h "); 
  lcd.print(int(speedm));
  lcd.print(" MPH   ");
  lcd.setCursor(0,1);
  lcd.print(int(elapsed));
  lcd.print(" ms/rev      "); 
  delay(1000); //
   }



Then, i uploading to Atmega328P-PU through Arduino board. At first, the LCD does not display anything and just light on. I troubleshoot the circuit and found that pin 7 on Atmega which is connect to 5Volt (VCC)  pin must be jumped straight to the Vout of Voltage Regulator. The result is as follow:


Display result


Then, i make some modification on the bicycle which is change the colour from red to yellow. I spray it by using the paint spray that i have bought at Careffour Wangsa maju. 


Paint Spray

Then, i attached the display circuit to the bicycle and Below is the Video of the finiched cycle ergometer. This video has showed the cycle ergometer operation:


video



The demo and presentation of Final Year Project is on 24 April 2012 (next week).I make some preparation for next week by design the poster and troubleshoot the circuit.







Saturday, 14 April 2012

Week 12

         
       As i already sketch the PCB layout, i start to do PCB development for this week.There are some processes in PCB development part. The processes involved are PCB layout, PCB UV exposure, PCB developing, etching, drilling and soldering. Each step has needed to be careful to make sure all connection in good condition. Every process is very important because this is the first step to avoid error to occur in the future.The PCB development must be done according to its method as follows:



1. The part list is as follows:
       - Ultra Violet (UV) PCB board
       - Overhead Projector Paper (OHP paper)


2. First,  Print PCB Layout. 
The PCB layout for the project is drawing by using Diptrace software ( refer last week). After drawing the circuit, the layout must be print on a transparency sheets rather than any kind of paper so that the Ultra Violet (UV) can pass through the clear bits well enough to give a good exposure. Overhead Projector (OHP) paper is a transparency paper that suitable to be use as a print paper. Naturally it must ensure the printing is exactly 100% full-scale.

PCB layout on OHP paper


3.  Ultra Violet (UV) Exposure. 
  • This process have been done at PCB room at level 1 Unikl BMI.For the UV board,one of the sides is copper clad and this copper has a photosensitive coating. When the plastic film is peeled back this sensitive coating is revealed.After processing this will be the PCB.

Example 1 of how to peel off the plastic film on UV PCB board


  • The Ultra Violet (UV) box as an Ultra Violet (UV) exposure. Printed mask must dry else it will stick to the UV coating on the PCB and will ruin it. It must be careful to ensure that the PCB mask is the right way up, otherwise when the circuit is etched it will discover that the tracks are also the wrong way round.

Example 2 of how to stick the printed OHP paper to UV PCB board

  •  The Overhead Projector (OHP) paper transparency with the printed side has placed against the copper coating and the two faces has put down in the light box. Then, the cover has closed, switched on the UV box and allow 60 to 90 second exposure times. When the exposure time is end, and then switched off the UV box and PCB is remove from the box. It will not see any visible change in the coating at this point.



PCB board has been placed on UV box


4.  Printed Circuit Board (PCB) Developing

  • The developing solution is just sodium hydroxide crystals that dissolved in cold about 20 degrees Celsius and too much solution has just stripped everything from the board. Then as simply placed the UV exposed PCB in the developing solution and rocks the tray gentled for a few minutes. As a caution, the developing is avoided from direct bright sunlight. Within a few minutes the circuit has stand out dark and the exposed coating washed away. Before removing the PCB from the tray, the copper has been shiny against the dark track layout.

Sodium Hydroxide

Developing Solution


5. Printed Circuit Board (PCB) Etching
  • When the board is taken out of the developer it must be washed in clean water before transferring to the etching tank. Always use plastic tongs.The acid, Ferric Chloride (FeCl3) is used to etch away copper that is not protected by the remaining photo resist coating FeCl3 often comes in bags in its an hydrous from dried orange-brown colored crystals.



Etching machine

  •  The etchant is held in a ‘bubble etch tank’ and is heated. This solution slowly etches away the unwanted copper, leaving the tracks only. At this stage it is important to keep checking that the PCB is completed (time - 15 to 45 minutes). If it is left in the tank too long the copper tracks will also be removed or damaged. 

Example 3 of how the PCB board has been inserted to etching machine

6.  Cleaning
 The remaining UV coating has been cleaned off. Alternatively, has used the thinner to remove the dark line as in. When removed from the etching solution, the PCB is washed and a PCB eraser is used to remove any film from the tracks. This must be done carefully because the film will prevent good soldering of the components to the PCB. The tracks can be checked using a magnifying glass. If there are gaps in the tracks, sometimes they can be repaired using wire but usually a new PCB has to be etched.

Example 4 : PCB eraser

Cleaning process that i have done

7. Drilling and Soldering
Lastly, the PCB has been drilled according to the circuit. The components have been inserting on the board  and started soldering the component’s leg. 
Example 5 : Drilling Process


Component has been inserted and ready for soldering

8. Result 
The result of PCB development can be seen in figure below:


Finished PCB development

Friday, 6 April 2012

Week 11

It's already week 11 now. I'm so worried and start to design the PCB layout because it have only 3 week to go before presentation.As  a result, by using Diptrace software, the PCB layout is as figure below:


PCB layout 
Then, i go to Jln. Pasar to buy  the PCB UV board for etching next week. I'm also already print the Layout on OH paper for next week.

Saturday, 31 March 2012

Week 10

After done with stand alone arduino circuit, i start to construct the reed switch sensor to Atmega 328 with LCD display. 


Part list
1. Stand alone arduino circuit from last week (Atmega 328)
2.2x16 LCD  ( refer week 8)
3. reed switch
4. resistor 10 kohm




First step, i sketch the schematic diagram by using fritzing software like figure below:


Full schematic diagram using fritzing
Second step, i construct the connection on the breadboard like figure below:




Full connection on Breadboard





Then, i  upload the programmed by Arduino board to Atmega328P-PU :



/*
  
  The circuit:
 * LCD RS pin to digital pin 7
 * LCD Enable pin to digital pin 8
 * LCD D4 pin to digital pin 9
 * LCD D5 pin to digital pin 10
 * LCD D6 pin to digital pin 11
 * LCD D7 pin to digital pin 12
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)




 */


// 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);


int ledPin = 13;               // choose pin for the LED




void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
   pinMode(2,INPUT);
   pinMode(ledPin, OUTPUT);      // declare LED as output
 // Print a message to the LCD.
  lcd.print("    Welcome   ");
  lcd.setCursor(0, 1);
  lcd.print("  Mc-Ergocycle  ");  
}






void loop() {
   
   if ( digitalRead(2)== HIGH)             // == digunakan bagi declare condition
   {  digitalWrite(ledPin, HIGH);  // turn LED OFF
  } else {
    digitalWrite(ledPin, LOW); // turn LED ON
  } 
  
   }
   
  

After uploading the programmed, i has testing the circuit and get the result as show in figure below : 






Video for the testing :




video






Saturday, 24 March 2012

Week 9

During Arduino Workshop last week, sir Zulkifli has recommend us to build stand alone arduino rather than use Arduino board for fyp.For this week, by refer to Setting up an Arduino on a breadboard website, i start to sketch the stand alone arduino circuit by using fritzing software. Then, i start to construct on the breadboard. 


Atmega 328 & Arduino pin mapping
Stand alone arduino on Fritzing

Part list:
1) 2 capacitor 10uF 
2) 1 7805 voltage regulator
3) 2 Led
4) 2 resistor 220ohm
5) 1 resistor 10kohm
6) 1 push button switch
7) 1 clock crystal 16 MHz
8) 2 ceramic capacitor 22pF





Construct stand alone arduino on breadboard

Video below show the testing of stand alone arduino with Atmega328:



video


Monday, 19 March 2012

Arduino Workshop

On 17 March 2012, i had attended Arduino workshop that organised by Medical Electronic Club. This workshop has been held from 8.30 a.m to 5 p.m  at training room, Level 6 Unikl BMI.


Banner of Arduino Workshop
This workshop is conducted for the beginners like me and relayed by Sir Zulkifli who is known as a lecturer that really adept in Arduino field. The main objective for me to be participate in this workshop is to gain more knowledge about Arduino and to get some idea for my fyp. From this workshop, i have learn how to use Arduino, operation of Arduino, basic coding and the application that i can use for my fyp.



Arduino Workshop 

Friday, 16 March 2012

Week 8

After mid term break,i start to find component that i needed to construct a circuit.First, i sketch it like below:



I do not have chance to go to Jalan Pasar yet,but i have 16x2 LCD display in my toolbox, so i decided to construct circuit from Arduino to LCD display first.


LCD display is great way to display output from  arduino when it not connected to my computer. The common display used in arduino projects is 16×2 parallel LCD display which compatible with the Hitachi HD44780 driver. It can easily recognize with it 16 pin interface.


I try to print out text message “welcome mc-ergocycle” .


Parts List that i needed :


1) 1x 16×2 parallel LCD display
2)  Arduino board
3) 1x 10kΩ potentiometer
4) Jumper wire
5) Breadboard


Procedure:
1) I constructed a circuit as shown on below:
(refer from arduinoprojects101 )






2) The potentiometer use for adjusting the contrast of the LCD character.
3) Then i edit some part of code of 'hello world' then upload to my arduino as below:




4)As a result, i succeed to display welcoming message as shown below:


Friday, 2 March 2012

Week 7

This week is phase test week, i have problem to balance my time  between fyp and phase test. I am also did not get chance to go to see madam Naszariah. But, after my last paper on 29 march , i manage to go to Jalan Pasar with my friends to buy Arduino kit  as picture below:
Arduino Uno R3
I am also make some tutorial to test Arduino board that i have bought with led blinking as below:
First, before i start to test my arduino , i need to setup the connection between my PC and arduino board. I need arduino board and USB cable as below:




Arduino board
USB cable


 Arduino Environment Software  


Step to be done on my laptop:
1) Connected arduino board with USB cable and USB port at my laptop



2) Select my arduino board type: Tools>Boards>Arduino UNO


3) Select my serial port: Tools>Serial Port>COM 25. Serial Port selection is depending on what COM port is free during setup. 


4)Open sketch example, File>Examples>1.Basics>Blink









5) Click upload button to upload the code to
arduino. Wait until “Done Uploading” message status appear. 

6) This video show LED was blinking and i have succesfully install my arduino.
video

Friday, 24 February 2012

Week 6

Microcontrollers are low power devices "embedded" inside some other device so that they can control the features or actions of the device.A microcontroller also is often small and low cost.


After doing some research, i decided to use Arduino software as microcontroller for my circuit. I have my own reason why i choose this software and will give an explanation later. How i know about this sofware? I was introduce to this software when i have to do a mini project using this software in semester 5 for Medical Instrumentation subject.For this semester also i have  learned to built a programme of motor system with Arduino in Electromechanics of Drives and Actuators in Medical Applications subject. So that, it will give me advantages because i have used it before and i can refer to my lecturer if i have any problem with this microcontroller.                                                                                                              


Some information about Arduino :


Arduino Uno
What is Arduino?
- A physical piece of hardware
- A programming environment
- A community & philosophy
- Open Source Hardware Development Platform
- USB Programmable Microcontroller (MCU)


Description :
 - It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.
- Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.)
- The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free.


                                                                                    
                                            Atmega328 Information:

Microcontroller use?  
- Processor, Storage and RAM all in one tiny   package!
- Atmel Microcontroller (MCU), typically Atmega328                  







Why i choose Arduino ?
- Simplifies the process of working with microcontrollers
- Inexpensive
- Cross platform – runs on windows, mac and Linux
- Simple, clear programming environment
- Open source and extensible

Runs on: Windows, Mac OS X, Linux
Languages: Wiring/Arduino, C/C++
Getting Started guides: Clear step-by-step instructions, from download to blinking LED.
Knowledge base
• Many simple examples included with download
• Good reference guide to the commands
• Large knowledge base on Arduino site and elsewhere
Pros:
• Can be run as I/O board, using Firmata firmware
• Very large knowledge base
• Simple language, but expandable using C/C++
• Multiple models, for shields, breadboards,wearables, extra I/O pins
• Many shield modules
• Large number of open source derivative boards
Cons:
• C language constructs (semicolons, brackets, case sensitivity) are confusing



Friday, 17 February 2012

Week 5

     I have successfully completed hardware part. Now I can concentrate on the software part where i need to construct the circuit for display. The cycle ergometer will display on LCD the information about  revolution per minute (RPM), distance,speed and time . Anything device that have LCD will use the microcontroller. 

Block Diagram for Sofware Part

 For this week, i was concentarte to Sensor.After some research, i found that magnet and reed switch  will be attach to the bicycle and use as a sensor. What i have to find out is the suitable microcontroller that i can use to built a programmed for RPM, distance,speed and time to be display on LCD. 

Some information about Reed switch : 
        What is a reed switch ?
        The basic reed switch consists of two identical flattened ferromagnetic reeds, sealed in a dry inert-gas atmosphere within a glass capsule, thereby protecting the contact from contamination. The reeds are sealed in the capsule in cantilever form so that their free ends overlap and are separated by a small air gap.  A reed sensor is a device built using a reed switch with additional functionality like ability to withstand higher shock, easier mounting, additional intelligent circuitry, etc.
Reed switch

        How does a reed switch work ?
       When a magnetic force is generated parallel to the reed switch, the reeds become flux carriers in the magnetic circuit. The overlapping ends of the reeds become opposite magnetic poles, which attract each other. If the magnetic force between the poles is strong enough to overcome the restoring force of the reeds, the reeds will be drawn together.

Reed switch operation

What are the advantages in using reed switches ?
- Hermetically sealed in glass environment.
- Free from contamination. 
- Safe to use in harsh industrial and explosive environments. 
- Immune to electrostatic discharge (ESD) .
- Do not require any external ESD protection circuits. 
- The isolation resistance between the contacts is as high as 1015ohms. 
- Contact resistance is as low as 50 milli-ohms.
- Directly switch loads as low as a few micro-watts without needing external amplification circuits, to as high as 120W.
- When used in combination with magnets and coils, they can be used to form many different types of relays.
- Low Price.