Saturday, 27 October 2012

Week 13 FYP 2 : Poster Preparation for FYP Presentation


The contains of the poster are:


  • Abstract
  • Objectives
  • Methodology
  • Block diagram
  • Flowchart
  • Result
  • Conclusion
  • Reference
The poster for FYP presentation

Friday, 12 October 2012

Week 12 : Testing the Functionality of the Circuit

Testing the headlamp

Frontview of the headlamp



                                                                              
Arduino on servo motor control
  • The movement of servo motor will follow the direction of steering.
  • If the steering move to 20° and 60° to the right or left, the servo motor will move to 20° or 60° according to the steering direction.

Week 11 FYP 2 :Wiring the Circuit to the Car Headlamp

LDR and Phototransistor circuit

Wiring the circuit to the headlamp casing

Wiring the circuit to the headlamp casing

Friday, 5 October 2012

Week 10 FYP 2 : Soldering the Component


Phototransistor  Activated Switch Top View


Phototransistor Activated Switch Bottom View






Light Activated Relay Bottom View



Light Activated Relay Top View

Friday, 28 September 2012

Week 9 FYP 2 : Troubleshoot the Programming


Problem Occured
  • After soldering and testing the accelerometer, the degree of standing still the accelerometer is strayed from 90°. 
  • To solved the problem, the accelerometer need to be calibrated so the degree of standing still is stayed on 90 °. By doing this, the programming code need to change a bit.
#include <Servo.h> 

Servo leftServo, rightServo;

//Analog read pins
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;

//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal = 330;
int maxVal = 360;

  • The red lettering shows the value that need to be calibrated.

//to hold the caculated values
double x;
double y;
double z;

void setup(){
  Serial.begin(9600);
  leftServo.attach(9);
  rightServo.attach(8);
}

void loop(){

  //read the analog values from the accelerometer
  int xRead = analogRead(xPin);
  int yRead = analogRead(yPin);
  int zRead = analogRead(zPin);

  //convert read values to degrees -90 to 90 - Needed for atan2
  int xAng = map(xRead, minVal, maxVal, -90, 90);
  int yAng = map(yRead, minVal, maxVal, -90, 90);
  //int zAng = map(zRead, minVal, maxVal, -90, 90);

  //Caculate 360deg values like so: atan2(-yAng, -zAng)
  //atan2 outputs the value of -Ï€ to Ï€ (radians)
  //We are then converting the radians to degrees
  //x = RAD_TO_DEG * (atan2(-yAng, -zAng) + PI);
  //y = RAD_TO_DEG * (atan2(-xAng, -zAng) + PI);
  z = RAD_TO_DEG * (atan2(-yAng, -xAng) + PI);
  
  //Output the caculations
  
  //Serial.print("x: ");
  //Serial.print(x);
  //Serial.print(" | y: ");
  //Serial.print(y);
  
  Serial.print(" | z: ");
  Serial.println(z);
  //////////////////////////
  
  /*  
  Serial.print("x: ");
  Serial.print(xRead);
  Serial.print(" | y: ");
  Serial.print(yRead);
  Serial.print(" | z: ");
  Serial.println(zRead);
  */
  
  //Left motor
  if ((z <= 50) && (z > 30))
  {
     leftServo.write(50);
  }
  else if ((z <= 30) && (z > 0))
  {
    leftServo.write(30);
  }
  else if ((z >= 270) && ( z <= 360))
  {
    leftServo.write(30);
  }
  else
  {
    leftServo.write(90);
  }
  
  
  /////////////////
  //right motor
  if ((z >= 130) && (z < 150))
  {
     rightServo.write(130);
  }
  else if ((z >= 150) && (z < 270))
  {
    rightServo.write(150);
  }
  else
  {
    rightServo.write(90);
  }
  delay(100);//just here to slow down the serial output - Easier to read
}

Thursday, 13 September 2012

Saturday, 1 September 2012

Week 5 FYP 2 : Design the Programming


  • The programming is design to control the servo motor which is the servo motor acts an output while the accelerometer acts as an input.




#include <Servo.h>

Servo leftServo, rightServo;

//Analog read pins
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;

//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal = 300;
int maxVal = 440;

//to hold the caculated values
double x;
double y;
double z;

void setup(){
  Serial.begin(9600);
  leftServo.attach(9);
  rightServo.attach(8);
}

void loop(){

  //read the analog values from the accelerometer
  int xRead = analogRead(xPin);
  int yRead = analogRead(yPin);
  int zRead = analogRead(zPin);

  //convert read values to degrees -90 to 90 - Needed for atan2
  int xAng = map(xRead, minVal, maxVal, -90, 90);
  int yAng = map(yRead, minVal, maxVal, -90, 90);
  //int zAng = map(zRead, minVal, maxVal, -90, 90);

  //Caculate 360deg values like so: atan2(-yAng, -zAng)
  //atan2 outputs the value of -Ï€ to Ï€ (radians)
  //We are then converting the radians to degrees
  //x = RAD_TO_DEG * (atan2(-yAng, -zAng) + PI);
  //y = RAD_TO_DEG * (atan2(-xAng, -zAng) + PI);
  z = RAD_TO_DEG * (atan2(-yAng, -xAng) + PI);

  //Output the caculations

  //Serial.print("x: ");
  //Serial.print(x);
  //Serial.print(" | y: ");
  //Serial.print(y);
  Serial.print(" | z: ");
  Serial.println(z);

  /*
  Serial.print("x: ");
  Serial.print(xRead);
  Serial.print(" | y: ");
  Serial.print(yRead);
  Serial.print(" | z: ");
  Serial.println(zRead);
  */

  //Left motor
  if ((z <= 40) && (z > 20))
  {
     leftServo.write(50);
  }
  else if ((z <= 20) && (z > 0))
  {
    leftServo.write(30);
  }
  else
  {
    leftServo.write(90);
  }
  /////////////////
  //right motor
  if ((z >= 120) && (z < 140))
  {
     rightServo.write(130);
  }
  else if ((z >= 140) && (z < 180))
  {
    rightServo.write(150);
  }
  else
  {
    rightServo.write(90);
  }
  delay(100);//just here to slow down the serial output - Easier to read
}





  • This is the arduino software that used to design a program. 
  • The software can be downloaded at www.arduino.cc


Arduino software to design a program



Saturday, 25 August 2012

Week 4 FYP 2 : Design the Flowchart


  • Flowchart for Arduino




Details on the component
Arduino Dueminalove

  • Arduino can sense the environment by receiving an input from a variety of sensors and can affect its surroundings by controlling lights, motors and other actuators.

Servo Motor                      
  • The nature of Servo motor which allow user to control its rotation angle
  • In this project, the servo motor will attached to the car's headlight in order to rotate the car headlight to a desired angle. 
  • The servo motor as an output



  •  It can measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion
  • In this project, the accelerometer use as a motion sensor which it will attached to the car steering.
  • The accelerometer as an input.
                                                                     















Friday, 17 August 2012

Week 3 FYP 2 : Purchasing the Component


LIGHT ACTIVATED RELAY
Item No.
Product
Qty
Unit Price  
     Amount
1
RELAY 9V DC
1 PC
RM6.50
RM   6.50
2
RESISTOR :1K, 1K5 1/4W
3 PCS
RM0.10
RM   0.30
3
DIODE IN4007
1 PC
RM0.50
RM   0.50
4
ZENER DIODE 8.2V
1 PC
RM1.00
RM   1.00
5
TRANSISTOR BC547
1 PC
RM2.00
RM   2.00
6
TRANSISTOR BC557
1 PC
RM2.80
RM   2.80
7
NTC THERMISTOR
1 PC
RM8.00
RM   8.00
8
TRIMMER 100K
1 PC
RM5.00
RM   5.00
9
IC REGULATOR 7806
1 PC
RM2.50
RM   2.50
10
ELECTROLYTIC CAP 1000uF
1 PC
RM3.00
RM   3.00
11
SCREW BLK CONNECTOR 2 WAY
  1 PC
RM2.00
RM   2.00
12
SCREW BLK CONNECTOR 3 WAY
1 PC
RM3.00
RM   3.00
13
JUMPER WIRE & POWER  CABLE
1 PKT
RM5.00
RM   5.00
                                        TOTAL  :
RM   36.60


 PHOTOTRANSISTOR ACTIVATED SWITCH
1
RELAY 12V DC
1 PC
RM6.50
RM   6.50
2
DIODE IN4007
1 PC
RM0.50
RM   0.50
3
RESISTOR 1K, 2M7, 3K9,
4 PCS
RM0.10
RM   0.40
4
LED
1 PC
RM0.30
RM   0.30
5
TRANSISTOR  C1815
2 PCS
RM2.00
RM   4.00
6
TRIMMER 1M
1 PC
RM5.00
RM   5.00
7
PHOTOTRANSISTOR  PT-334-6C
1 PC
RM18.00
RM 18.00
8
SCREW BLK CONNECTOR 2 WAY
2 PCS
RM2.00
RM   4.00
9
SCREW BLK CONNECTOR 3 WAY
3 PCS
RM3.00
RM   9.00
11
JUMPER WIRE & POWER  CABLE
1 PKT
RM5.00
RM   5.00
                                        TOTAL  :
RM   52.70



1
ARDUINO DUEMILANOVE
1 PC
RM87.00
RM   87.00
2
SERVO MOTOR CYTRON C36R
2 PCS
RM40.00
RM   80.00
3
ACCELEROMETER-ADXL335
1 PC
RM120.00
RM   120.00
4
CAR BATTERY 12V 40A
1 PC
RM150.00
RM   150.00
                               TOTAL  :
RM   437.00



  • The total cost for all the component is RM526.30

Wednesday, 8 August 2012

Week 2 FYP 2 : Purchasing Proton Waja Headlamp



Waja Headlight
  • Bought Proton Waja headlamp for right side and left side
  • Each of the headlamp have 2 mentols
  • The mentols of the headlamp use 100 Watt for each mentol.
  • The total cost of the headlamp including mentols are RM 340

Thursday, 2 August 2012

Week 1 FYP 2 : Assign the circuit



Automatic Headlight Dimmer


  • Automatically switch from high to low beam when traffic approach to save others sight
  • With Q1 in moderate darkness the variable resistor must be adjusted to generate no base current through Q2 
  • This system is triggered by headlights from other car 
  • The high-beam lights on when there is no approaching headlights 
  • Headlights will be switched to low beams when the phototransisor receives lights from other car coming from the opposite direction



Automatic Light Controller


  • During night time, when no light falls on LDR1, it offers a high resistance at the base junction of transistor T1
  • So the bias is greatly reduced and T1 doesn’t conduct 
  • Effectively, this removes the common terminal of IC1 from ground and it directs the full input DC to the output 
  • Transistor T2 conducts and the relay energises to light up the bulb as mains connection completes through the relay contacts


Friday, 13 April 2012

Presentation Day (Week 12)

 During the presentation day, the assessor advised to me that the project should be divided into two parts. The first part is the operation of the headlight according to the ambient of light and the second part is the movement of the headlight according to the steering. The assessor advised me that the first part should be finished first before completing the second part. This is because the second part is involved with mechanical operation which   it will take more time to complete and deal with the mechanical problem.

Thursday, 5 April 2012

Prepare for the Presentation (Week 11)

 The presentation of FYP 1 is in week 12. The presentation should be consist of :


  • Introduction
  • Problem Statement
  • Objectives
  • Methodology
  • Benefits/ Contribution
  • Workplan
  • Conclusion

Thursday, 22 March 2012

Study on Arduino (Week 10)



Introduction

Arduino is a popular open-source single-board microcontroller, descendant of the open-source Wiring platform, designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open hardware design for the Arduino board with an Atmel AVR processor and on-board input/output support. The software consists of a standard programming language compiler and the boot loader that runs on the board.
Arduino hardware is programmed using a Wiring-based language (syntax and libraries), similar to C++ with some slight simplifications and modifications, and a Processing-based integrated development environment.
Current versions can be purchased pre-assembled; hardware design information is available for those who would like to assemble an Arduino by hand. Additionally, variations of the Italian-made Arduino—with varying levels of compatibility—have been released by third parties; some of them are programmed using the Arduino software.

Hardware

An Arduino board consists of an 8-bit Atmel AVR microcontroller with complementary components to facilitate programming and incorporation into other circuits. An important aspect of the Arduino is the standard way that connectors are exposed, allowing the CPU board to be connected to a variety of interchangeable add-on modules known as shields. Official Arduinos have used the megaAVR series of chips, specifically the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560. A handful of other processors have been used by Arduino compatibles. Most boards include a 5 volt linear regulator and a 16 MHz crystal oscillator (or ceramic resonator in some variants), although some designs such as the LilyPad run at 8 MHz and dispense with the onboard voltage regulator due to specific form-factor restrictions. An Arduino's microcontroller is also pre-programmed with a boot loader that simplifies uploading of programs to the on-chip flash memory, compared with other devices that typically need an external programmer.
At a conceptual level, when using the Arduino software stack, all boards are programmed over an RS-232 serial connection, but the way this is implemented varies by hardware version. Serial Arduino boards contain a simple inverter circuit to convert between RS-232-level and TTL-level signals. Current Arduino boards are programmed via USB, implemented using USB-to-serial adapter chips such as the FTDI FT232. Some variants, such as the Arduino Mini and the unofficial Boarduino, use a detachable USB-to-serial adapter board or cable, Bluetooth or other methods. (When used with traditional microcontroller tools instead of the Arduino IDE, standard AVR ISP programming is used.)




Arduino


Thursday, 15 March 2012

Study on Accelerometer ADXL-345 (Week 9)


  • ADXL 345 will be use as a sensor to  detect the angle of movement at the steering.

ADXL 345



An accelerometer is part of a family of motion sensors consisting of accelerometers, gyroscopes and compasses.The accelerometer is a device which measures acceleration. Simple enough, but there are two different types of acceleration: static acceleration (tilt) and dynamic acceleration (movement). he accelerometer outputs a measurement telling the user in what direction on its axis force is being applied.

Thursday, 1 March 2012

Thursday, 23 February 2012

Determine the Liquid Crystal Display(LCD) (Week 6)


  • the objective of the LCD is to show the degree of change in direction of the headlight
     A liquid crystal display (LCD) is a flat panel display, electronic visual display that uses the light modulating properties of liquid crystals.
     It is an electronically modulated optical device made up of any number of segments filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome




Example of 2x20 LCD

Thursday, 16 February 2012

Identify the Type of Motor (Week 5)


  • to identify electrical motor to move the direction of headlight
For this project I choose Servo motor to move the headlight. The advantages of the servo motor are 



  1.  High output power relative to motor size and weight
  2. Encoder determines accuracy and resolution
  3. High efficiency. It can approach 90% at light loads.
  4. High torque to inertia ratio. It can rapidly accelerate loads.
  5. Has "reserve" power. 2-3 times continuous power for short periods.
  6. Has "reserve" torque. 5-10 times rated torque for short periods.
  7. Motor stays cool. Current draw proportional to load.
  8. Usable high speed and torque. Maintains rated torque to 90% of NL RPM.
  9. Audibly quiet at high speeds.
  10. Resonance and vibration free operation.

Example of Servo Motor

Thursday, 9 February 2012

Determine the type of light sensor (Week 4)


  • to determine the sensitivity of light sensor to the ambient of light
  • to determine the input voltage of the sensor
The ambient light sensors that I have researched were TEPT 5600 and TEMT 600X01








Thursday, 2 February 2012

Thursday, 12 January 2012

Selection of Project Title (Week 2)


  • Selection of Project title in rps.bmi.edu.my
  • Project title was approved by advisor
  • The project title is Automatic Car Headlight Controller
     The aim of this project is to design a headlight that can adjust the light according to ambient of light and can change direction according to the direction of car.