Paja

Icon

Rapid prototyping for music, art and design work

The SonarHat

The Sonar Hat consists of a hat with a Parallax Board of Education tied on top. A forward facing PING))) ultrasonic sensor measures distances and a piezo speaker plays a tone based on the distance. The idea was, of course, to see if one could – at least in part – substitute vision by ultrasound navigation akin to what bats do.

The SonarHat from Poika Isokoski on Vimeo.


SonarHat

SonarHat by Poika Isokoski

The hat worked just fine in the sense that the distance was turned into a tone and the tones could be discriminated. The problem with this kind of systems is that a simple ultrasound sensor is blind to certain kinds of surfaces. For example a wall approached from a large angle is almost invisible because very little of the ultrasound is reflected back to the sensor. Also, the operating frequency should be higher than what could be achieved with the Basic Stamp 2 doing both input and output.

You will notice some similarities between this project and the “Vibrotactile Radar” by Jukka Raisamo and Jussi Rantala. I undertook this project after hearing of their plans. So this is the rip-off and theirs is the original within the UCIT workshop.

The Basic Stamp code for the Sonar Hat is below.

'{$STAMP BS2}
'{$PBASIC 2.5}

' This code reads data from the ultrasonic sensor and plays a tone through
' a speaker. The pitch of the tone is low (~0) when the distance measured is
' long (~3m). The pitch is HIGH (up TO 5000Hz) when the distance measured
' by the ultrasound sensor is short (a few centimeters).

' Poika Isokoski 2009. Using code from examples online at:
' 2008 mlab.taik.fi/paja
' PING))) Ultrasonic sensor

' ---[ I/O Definitions ]---
pPing    PIN  7
pPiezo   PIN  6

' ---[ Variables ]---
wTime    VAR  Word
wDistance VAR Word

' ---[ Constants ]---
cTrigger     CON     5    ' trigger pulse = 10 uS for BS2

' ---[ Initialization ]---
'DEBUG CLS, "--- PING))) Ultrasonic Sensor", CR

' ---[ Main Code ]---
Main:
  DO
    GOSUB ReadPing
    IF wTime >10000 THEN
      wTime=10000
    ENDIF
    wDistance = (10000-wTime)/200
    'DEBUG DEC5 wTime, " ", DEC5 wDistance, " ", DEC5 (wDistance*wDistance),CR
    FREQOUT pPiezo, 100, (wDistance*wDistance)
    'PAUSE 100
  LOOP
END

' ---[ Subroutines ]---
ReadPing:
  ' PULSOUT Pin, Duration
  ' pin: Pin number (0-15)
  ' Duration: specifies the duration of the pulse. (BS2: a unit = 2us)
  PULSOUT pPing, cTrigger
  ' PULSIN Pin, State, Variable
  ' Pin: Pin number (0 - 15)
  ' State: Specifies whether the puse to be mesured is low(0) or high(1)
  ' Variable: the measured pulse duration will be stored.
   PULSIN pPing, 1, wTime
RETURN

vib

Facebook Twitter Email

Category: Graduate School in User-Centered Information Technology, Student Projects

Tagged:

Comments are closed.

Social links powered by Ecreative Internet Marketing