Arduino interfacing SRF05 rage finder with LCD screen

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:

Arduino and LCD screen

This was one of my first projects to try out various features of Arduino. I got this 2×16 LCD screen from Oomlout. The breadboard schematics came together with the LCD screen and is relatively simple.

Here is the sample code I uploaded to the controller:

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

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

void loop() {

 lcd.print("                 arvydas.net");

 lcd.setCursor(16,1);
 lcd.autoscroll();

 for (int thisChar = 0; thisChar &lt; 28; thisChar++) {
 lcd.print(" ");
 delay(250);
 }
 lcd.noAutoscroll();

 lcd.clear();
}

Just a simple scrolling text and here is the video:

[youtube]http://www.youtube.com/watch?v=hTJQqKEdKlE[/youtube]