ArcBotics http://arcbotics.com Making robotics learning easy, fun, and open source Thu, 18 Aug 2016 02:48:38 +0000 en-US hourly 1 https://wordpress.org/?v=4.5.3 Hexy Ultrasonic Distance Sensor http://arcbotics.com/2015/12/19/hexy-ultrasonic-distance-sensor/ http://arcbotics.com/2015/12/19/hexy-ultrasonic-distance-sensor/#respond Sat, 19 Dec 2015 06:04:08 +0000 http://roboalch.com/?p=1767

m-products-101-1012007-1012007-2-960x520

Getting it Working with Servotor32

You can connect the module to the Servotor32 board in a Hexy kit with the included 4-pin cable. With the Servotor32 powered, take one end of the 4-wire cable and connect connect it to ultrasonic unit, and then the other end to the board. Note the labels on the board and the ultrasonic ‘vcc’ and ‘gnd’. Make sure the wires are connecting ‘vcc’ to ‘vcc’ and ‘gnd’ to ‘gnd’. If the green light on the board starts to dim, unplug the ultrasonic immediately. This means the ultrasonic is plugged in backwards and is shorting out the board. Reverse the connection and try again.

8359131173_ffaab08c3b_o

This code is using the Servotor 2.0 firmware libraries, which is available here:

#include "Servotor32.h"
Servotor32 hexy;

void setup(){
hexy.begin();
}

loop(){
float cm;
cm = hexy.ping();
Serial.print("CM: ");
Serial.println(cm);
hexy.delay_ms(200);
}

 

The code prints out a measurement from the module in centimeters every 200 milliseconds (5 times per second).

Basic Theory

The distance sensor works by sending out a pulse of ultrasonic sound and measuring the amount of time it takes for the sound to come back, know as the ‘time of flight’ method. This is the same method bats use to find things by sound. The sound goes out in a cone pattern, so the best detection is done . However, objects on the side of the cone can still be detected. This is the cone pattern for this module:

ultrasonic-cone

Because it works with sound waves, it works best on objects that easily reflect sound. Flat, smooth services (like a wall) reflect work best. Fuzzy, soft, irregular surfaces (like a dog) reflect the worst.

Operational

ultrasonic-operation

A 10uS high pulse on the Trigger pin initiates an 8 cycle burst of 40khz ultrasonic pulses. The pulses return to the module, and it emits on the Echo pin a high pulse between 150uS and 25ms. The distance can be calculated from the formulas above. They are derived from: Test distance = (high level time * velocity of sound (340M/S) / 2. The pins are connected on the Servotor32 module as such: Trigger – Pin 17 (PB0) Echo – Pin 11 (PB6)

Specifications

  • Working Voltage: DC 5 V
  • Working Current: 15mA
  • Working Frequency: 40Hz
  • Max Range: 4m
  • Min Range: 2cm
  • Measuring Angle: 15 degree
  • Trigger Input Signal 10uS TTL pulse
  • Echo Output Signal Input TTL lever signal and the range in proportion
  • Dimensions: 45*20*15mm
ultrasonic-dimensions

Files

Solidworks Model
]]>
http://arcbotics.com/2015/12/19/hexy-ultrasonic-distance-sensor/feed/ 0
Hello world! http://arcbotics.com/2015/11/26/hello-world/ http://arcbotics.com/2015/11/26/hello-world/#respond Thu, 26 Nov 2015 19:35:09 +0000 http://192.168.1.109/?p=1 Welcome to WordPress. This is your first post. Edit or delete it, then start writing!]]> http://arcbotics.com/2015/11/26/hello-world/feed/ 0