Ultrasonic Range Finder
Submitted by mohawk software on Sun, 2012-07-01 13:38
The TS601 Ultrasonic Range Finder is a common and cheap sonar based system, at about $15.00 its a pretty good bargain. It's interface is simple, a single pin. You apply a digital pulse for a little bit more than 5us, then wait for a pulse who's width represents the time it takes the sound to hit an object and bounce back.
The initial implementation is complete and reports the response in millimetres.
A sample Arduino test program looks like this:
#include "Arduino.h" void setup (){} void loop () { while(1){ pinMode(7, OUTPUT); digitalWrite(7, 1); unsigned long us = micros(); while(1){ unsigned long now = micros(); if( (now-us) > 20) break; } digitalWrite(7, 0); pinMode(7, INPUT); unsigned long ms = millis(); while(1){ unsigned long now = millis(); if( (now-ms) > 30) break; } } }
Updates to come....