Latest Posts

Saturday, November 29, 2014

Sensor Modules

Purpose

The Purpose of this post is to identify the many ways we will be interfacing with the hardware sensors that we have chosen to use within our robot. The interface with the sensors is all done through the Arduino Due. 

Ultrasonic Distance Sensor

At the start of the operation of our robot, we decided to perform a sweep of the room in which our robot turns 360 degrees and searches for the longest distance (sensor maxes out at around 4m). 
Our robot checks the current Radial Direction of our bot and utilizes a proximity sensor to perform a ‘sweep’ of the room. The robot is essentially searching for an opening, meaning that the output signal of the proximity sensor’s echo pin must remain high for a certain length of time.
If we are searching for a certain 'length of time' and our PIC32 is only allotted a limited number of I/O Ports, we must determine the most cost-effective (money and time) to develop a system of checking for a high pulse out of the ‘echo’ pin on the Proximity Sensor.
 The Ultrasonic Distance Sensor works by sending out a 10 microsecond TTL pulse on the trig port, sends out 8 40kHz sonic bursts, then sets the output echo port high and awaits a returned Ping. The diagram of the module is shown below, and the probed outputs created are shown to the right and below. 

The most important factor influencing the speed of sound in air is temperature.  The speed is proportional to the square root of the absolute temperature. The speed increases at about .6m/s per degree[1].

 To calculate the sensor feedback, the module was elevated off the ground and stabilized using some foam core scraps. See the 'SensorBot' above.

The code for the proximity sensors were found through the GitHub account of one of the original designers of the module. The only changes I made were converting the inches into cm - in an attempt to keep uniform units across sensor inputs:



/* ProximitySensorFeedback() - this function interfaces directly with the
proximity sensor and returns a 16-bit value corresponding to the distance in mm
The speed of sound is 340 m/s or 29 microseconds per centimeter.
The ping travels out and back, so to find the distance of
the object we take half of the distance travelled.*/
long ProximitySensorFeedback(int ping, int echo)
{
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, centimeters;
  int currentDist;
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  digitalWrite(ping, LOW);

  delayMicroseconds(2);
  digitalWrite(ping, HIGH);
  // pulse whose duration is the time (in microseconds) from the sending
  delayMicroseconds(5);   digitalWrite(ping, LOW);   // of the ping to the reception of its echo off of an object.   duration = pulseIn(echo, HIGH);   // convert the time into a distance   centimeters = duration / 29 / 2;   return centimeters; }

Beacon Detector

The IR Beacon with the crown is easily located through the IR Beacon Detector by a range of approximately 10 feet. The caveat here is that the beacon detector must be dead set on the beacon to actually detect it. Thus, a short radial sweep will be required when looking for the 2 kHz Beacon at the initial start of the robot's operation.
The second IR Beacon Detector will be searching for a beacon at the 56 kHz frequency (our daughter beacon). With the second beacon detector we can detect the daughter beacon that will be located at our home castle. Thus, we have effectively created a discernible IR Beacon that we can use to follow our way back home.
The Second Beacon Detector will require high pass filtering to only detect an IR beacon at the higher frequency.



[1] This also makes quite a good argument for utilizing ambient temperature feedback, but the cost of the module outweighs the benefits (the precision of the distance feedback required).

No comments:

Post a Comment