This is a another sample demonstrating Arduino MEGA, LCD screen and SRF05 ultrasonic range finder. The distance measurement from SRF05 is displayed on the LCD screen in centimetres.
[youtube]http://www.youtube.com/watch?v=VNJu6oR69Zs[/youtube]
Different from Infra Red range finder witch uses IR light to measure distance, ultrasonic range finder sends short high pitch sound pulses and measures the time for the echo to come back to the microphone. Here is a very good comparison of the two types of range finders. The code running on the Arduino:
// include the library code: #include <LiquidCrystal.h> #define echoPin 6 // the SRF05's echo pin #define initPin 7 // the SRF05's init pin unsigned long pulseTime = 0; // variable for reading the pulse // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of rows and columns: lcd.begin(16, 2); // make the init pin an output: pinMode(initPin, OUTPUT); // make the echo pin an input: pinMode(echoPin, INPUT); } void loop() { digitalWrite(initPin, HIGH); delayMicroseconds(10); digitalWrite(initPin, LOW); pulseTime = pulseIn(echoPin, HIGH); lcd.setCursor(0,0); lcd.print(pulseTime / 58, DEC); lcd.print("cm"); delay(100); lcd.clear(); }
Another application for SRF05 is a basic theremin by LuckyLarry. You can see it in action here:
[flickrvideo]http://www.flickr.com/photos/peplop/4083266594[/flickrvideo] [flickrvideo]http://www.flickr.com/photos/peplop/4083675920[/flickrvideo]
Read on here: