The Sonar Phidget is a distance sensing Phidget. It uses ultrasonic pulses to detect objects up to 10 metres away. You can use it in your projects to detect objects and measure distances.
In this tutorial you will :
- Connect your Phidget to your computer.
- Learn about data collected from your Phidget.
- Practice using your Phidget in a mini-project.
Using the Phidget
In order to connect your Sonar Phidget to your computer you will need the following:
Connect your DST1200 to your VINT Hub using the Phidget cable and connect your VINT Hub to your computer with the USB Cable.
When all components are connected, open the Phidget Control Panel on your computer and find the Sonar Phidget entry.
Double-click on the Sonar Phidget entry to ensure the Phidget is connected. Leave these windows open for the next section.
Distance / Sonar Reflections
In order to measure distance, the Sonar Phidget sends out ultrasonic pulses and receives multiple reflections back. It ranks the reflections from closest to farthest (8 maximum) and returns them to your program in an array, called the Sonar Reflections Array.
If you simply want to get the closest reflection (recommended), you can use the Distance property/event. The Distance property is always set to the closest reflection (or the 0th element in the Sonar Reflections Array).
When Quiet Mode is on, the device will be less audible, however, the range will be reduced. Point the sonar towards you and try toggling the Quiet Mode checkbox to hear the difference.
Now that you have your DST1200 connected and working, the next step is writing some code. Write a program in the language of your choice that outputs the distance that the DST1200 is measuring. Your code should have the following flow:
You have completed the DST1200 - Sonar Phidget Tutorial. You are now ready to use your Phidget in a project.