Header banner
Revain logoHome Page
Kevin Taharka photo
1 Level
1267 Review
54 Karma

Review on Advanced Ultrasonic Distance Rangefinder Sensor by Virtuabotix by Kevin Taharka

Revainrating 5 out of 5

Noob problems with 4 pins, library install and serial monitor

I'm new to Arduino so it took me a while to get this working. I am using a Mac with OS X 10.6.8. The first problem was that this sensor has 4 pins instead of the usual 3. For 3-pin models, the input and output use the same pin. Luckily the contacts are labeled so it was easy to figure out. Connect GND to ground and Vcc to the Arduino's 5V supply. Trg must be a digital output. I used pin 11. The echo should be an analog input. I used A0. The hardest part was figuring out where to put the library files I downloaded from the virtuabotix website. I never store files in my documents folder. In [user]/Documents/Arduino I had to create a new folder called _libraries_ and put the _Ulrasonic_ folder I downloaded from virtuabotix inside this newly created _libraries_ folder (you need to decompress it first if you disable auto decompression to have). After exiting the Arduino and restarting, the library was recognized. Finally, Serial Monitor took a while to open due to a misleading forum post. You can find the Serial Monitor in the _Tools_ menu in the Arduino app or use SHIFT-COMMAND-M. It is NOT on the icon in the sketch window. **CORRECTLY. THE SKETCH WINDOW HAS A SERIAL MONITOR ICON. THIS IS IN THE UPPER LEFT OF THE WINDOW - LIKE MAGNETIC GLASS. Now it works great. I took some code from the example file and mixed it with my code and I can detect objects within X inches of the detector. The *Defend-Porch-Peeing-Cat* mission is in full swing. CONTINUED: I installed the sensors with hot glue and they don't work very well. The problem could be the length of the cable I'm using between the Arduino and the sensors (about 2 meters) or a bad pin connection (making 4-pin 0.1" Molex sockets wasn't easy _insert curse here_) . I've hot glued or wetted the sensors, ordered two more distance sensors and will test them on my connectors to see if the hot glue or connector/wiring causes any problems.

Pros
  • Elegant design
Cons
  • Long delivery time