Assalamualaikum w. b.t
So for today, I had assemble the circuit. I had build the circuit for avoiding object.
For the testing, I had used this code:
//author: rabia'tul adawiyah roslan
//projects name: ultrasonic path planning for the blind person
// variables to take x number of readings and then average them
// to remove the jitter/noise from the DYP-ME007 sonar readings
const int numOfReadings = 10; // number of readings to take/ items in the
array
int readings[numOfReadings]; // stores the distance readings in an array
int arrayIndex = 0; // arrayIndex of the current item in the
array
int total = 0; // stores the cumlative total
int averageDistance = 0; // stores the average value
// setup pins and variables for DYP-ME007 sonar device
int echoPin = 2; // DYP-ME007 echo pin (digital 2)
int initPin = 3; // DYP-ME007 trigger pin (digital 3)
unsigned long pulseTime = 0; // stores the pulse in Micro Seconds
unsigned long distance = 0; // variable for storing the distance (cm)
// setup pins/values for LED
int redLEDPin = 9; // Red LED, connected to digital PWM
pin 9
int redLEDValue = 0; // stores the value of brightness for the
LED (0 = fully off, 255 = fully on)
//setup
void setup() {
pinMode(redLEDPin, OUTPUT); // sets pin 9 as output
pinMode(initPin, OUTPUT); // set init pin 3 as output
pinMode(echoPin, INPUT); // set echo pin 2 as input
// create array loop to iterate over every item in the array
for (int thisReading = 0; thisReading < numOfReadings; thisReading++) {
readings[thisReading] = 0;
}
// initialize the serial port, lets you view the
// distances being pinged if connected to computer
Serial.begin(9600);
}
// execute
void loop() {
digitalWrite(initPin, HIGH); // send 10 microsecond pulse
delayMicroseconds(10); // wait 10 microseconds before turning off
digitalWrite(initPin, LOW); // stop sending the pulse
pulseTime = pulseIn(echoPin, HIGH); // Look for a return pulse, it should be high
as the pulse goes low-high-low
distance = pulseTime/58; // Distance = pulse time / 58 to convert to
cm.
total= total - readings[arrayIndex]; // subtract the last distance
readings[arrayIndex] = distance; // add distance reading to array
total= total + readings[arrayIndex]; // add the reading to the total
arrayIndex = arrayIndex + 1; // go to the next item in the array
// At the end of the array (10 items) then start again
if (arrayIndex >= numOfReadings) {
arrayIndex = 0;
}
averageDistance = total / numOfReadings; // calculate the average distance
// if the distance is less than 255cm then change the brightness of the LED
if (averageDistance < 255) {
redLEDValue = 255 - averageDistance; // this means the smaller the distance the
brighterthe LED.
}
analogWrite(redLEDPin, redLEDValue); // Write current value to LED pins
Serial.println(averageDistance, DEC); // print out the average distance to the
debugger
delay(100); // wait 100 milli seconds before looping
again
}
Thursday, September 20, 2012
Wednesday, September 5, 2012
Week 3 ( FYP 2)
Assalamualaikum.
On this week, I just upgrade the looks of my project. I add the light at the robotic base. my purpose to put this light is to make the people around the blind people alert that he or she exist in the surrounding. I am still thinking whether it suitable to put some sound like buzzer or not.
On this week, I just upgrade the looks of my project. I add the light at the robotic base. my purpose to put this light is to make the people around the blind people alert that he or she exist in the surrounding. I am still thinking whether it suitable to put some sound like buzzer or not.
Week 2 (FYP 2)
Assalamualaikan w.b.t.
Alhamdulilah, my ultrasonic sensor was received! Yeay me! Thank you Mr Azmi from Myduino.com. So I can continue to test my sensor and start build the circuit and combined it with the sensor. If I have done this circuit and sensor completely, InsyaAllah my project automatically done.. So now I need to study, learn, practice and do the programming process.
Alhamdulilah, my ultrasonic sensor was received! Yeay me! Thank you Mr Azmi from Myduino.com. So I can continue to test my sensor and start build the circuit and combined it with the sensor. If I have done this circuit and sensor completely, InsyaAllah my project automatically done.. So now I need to study, learn, practice and do the programming process.
Week 1 (FYP 2)
Assalamualaikum.
On July 29th I was registered as semester 7 student also automatically as FYP 2 student. For this 1st week I just bought the add on hardware to complete the framework of my project.
On July 29th I was registered as semester 7 student also automatically as FYP 2 student. For this 1st week I just bought the add on hardware to complete the framework of my project.
the plastic cover to hide wires or to makes it orderly.
the black box which to create orderly switch
Subscribe to:
Posts (Atom)