-
Notifications
You must be signed in to change notification settings - Fork 65
Range Finding
kristopher edited this page Sep 12, 2010
·
19 revisions
A range finder is a fun little device with two small speakers, one being a transmitter and one a receiver. The transmitter sends out
an ultrasonic pulse(ping). The receiver picks the echo(reflection) of that pulse. The time from the transmission of the pulse to the reception of the echo with a bit of calculation gives you the range(distance).
It works the same way as Active Sonar if you are interested in a more in depth explanation.
- Robotics
- Sonar
- As a MIDI interface
RAD code to be uploaded to your Arduino.
class RangeFinder < ArduinoSketch
serial_begin
external_vars :sig_pin => 'int, 7'
def loop
serial_println(ping(sig_pin))
delay(200)
end
end
Simple ruby script using ruby-serialport to view the output of the range finder.
require "serialport.so"
port_str = "/dev/tty.usbserial-FTAJM79K" #may be different for you
baud_rate = 9600
data_bits = 8
stop_bits = 1
parity = SerialPort::NONE
serial_port = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)
loop do
puts serial_port.gets
end
From range finder |
From range finder |
From range finder |
You can pick one up at the Parallax website or at a local Radio Shack.