Distance Sensor with Pulse Width Output 50cm Max

£9.95 inc VAT

Availability: 2 in stock (can be backordered)

Brand: Pololu
Part Number: 4064
Barcode: 5055421000646
SKU: PPPOL4064 Categories: , , , , , , , ,
Share on facebook
Share on twitter
Share on linkedin
Share on facebook
Share on twitter
Share on linkedin

Distance Sensor with Pulse Width Output 50cm Max

This compact sensor makes it possible to measure the distance of objects up to about 50 cm (20″) away using a simple digital pulse width interface. It uses a short-range lidar module to precisely measure how long it takes for emitted pulses of infrared, eye-safe laser light to reach the nearest object and be reflected back, allowing for 3 mm resolution.

As long as the sensor is enabled, it takes continuous distance measurements and encodes the ranges as the widths of high pulses, which can then be timed by a microcontroller using a single digital input.

Distance Sensor with Pulse Width Output 50cm Max

The relationship between measured distance d (in mm) and pulse width t (in µs) is shown below:

Relationship between measured distance and pulse width (Time uS)

The timing uncertainty is approximately ±5%. As objects approach the sensor, the output pulse width will approach 1.0 ms, while an object detected at 50 cm will produce a 1.667 ms pulse width. The sensor uses a pulse width of 2.0 ms to indicate no detection. The pulse period T ranges from around 9 ms to 20 ms, depending on the proximity of the detected object.

The maximum detection range depends on object reflectivity and ambient lighting conditions. In tests, this sensor was able to reliably detect a white sheet of paper at an approximate distance of 50cm and a hand at approx. 30cm.

This graph shows the measured distances of five units versus their actual distances at several different ranges:

graph showing the measured distances of five units versus their actual distances from several different ranges

This sensor can detect objects almost up to the face of the sensor, however, the effective minimum distance it can measure is around 1 cm. This means that objects closer than 1 cm may still result in a measured distance of around 1 cm.

Using a camera with no IR filter, we can see the infrared light being emitted by the distance sensor as below:

Using a camera with no IR filter, we can see the infrared light being emitted by the distance sensor

Specifications:

  • Operating voltage: 3.0 V to 5.5 V
  • Current consumption: 30 mA (typical) when enabled, 0.4 mA when disabled
  • Maximum range: approximately 50 cm (20″) (for high-reflectivity targets in good ambient conditions; lower-reflectivity targets or poor ambient conditions will reduce the maximum detection range)
  • Update rate: 50 Hz to 110 Hz (20 ms to 9 ms period)
  • Field of view (FOV): 15° typical; can vary with object reflectance and ambient conditions
  • Output type: digital pulse width

Distance Sensor Dimensions:

  • Board Length: 21.6mm (0.85″)
  • Board Width: 8.9mm (0.35″)
  • Overall Thickness: 3.1mm (0.122″)
  • Weight: 0.4g
Distance Sensor with Pulse Width Output Dimensions

Configuration of the Sensor:

Using the PWM Distance Sensor with Arduino:
The Distance Sensor with Pulse Width Output 50cm, requires only three connections. VIN (between 3V and 5.5V), GND (0V), and OUT (to be connected to an available input on your microcontroller)! 
This sensor outputs digital pulses via the OUT pin. The low level of the pulses is 0 V, and the high level is VIN. A red LED on the back side of the board also lights whenever an object is detected (the closer the object, the brighter the LED).

Using the PWM Distance Sensor with Arduino:

Here is an Arduino sketch that reads the output of the Pololu Distance Sensor with Pulse Width Output, 50cm Max and displays the measured distance in millimeters:


// Example Arduino program for Distance Sensor with Pulse Width Output 50cm Max
 
// Change this to match the Arduino pin connected to the sensor's OUT pin.
const uint8_t sensorPin = 2;
 
void setup()
{
  Serial.begin(115200);
}
 
void loop()
{
  int16_t t = pulseIn(sensorPin, HIGH);
 
  if (t == 0)
  {
    // pulseIn() did not detect the start of a pulse within 1 second.
    Serial.println("timeout");
  }
  else if (t > 1850)
  {
    // No detection.
    Serial.println(-1);
  }
  else
  {
    // Valid pulse width reading. Convert pulse width in microseconds to distance in millimeters.
    int16_t d = (t - 1000) * 3 / 4;
 
    // Limit minimum distance to 0.
    if (d < 0) { d = 0; } 
  
    Serial.print(d);
    Serial.println(" mm");
  }
}

Using the Distance Sensor with the BBC micro:bit:

We have also created a MakeCode example program for the BBC micro:bit single-board computer that demonstrates how to read and convert the output of the Pololu Distance Sensor with Pulse Width Output, 50cm Max. The program’s output can be viewed in the MakeCode device console, which also plots the readings on a graph. You can open this program directly in the MakeCode editor here or by re-creating from the image below:

microbit code for the distance sensor with PWMOutput- BBC micro:bit with the distance sensor with PWM

The Pololu Digital Distance Sensor Family:

Sensors with Digital Output (ie no distance measurement):

Sensor VariationMax. RangeMin. Update RateJumper Settings (4321)
#4050: Digital output, 5cm5 cm145 Hz0
#4052: Digital output, 10cm10 cm115 Hz10
#4054: Digital output, 15cm15 cm95 Hz100

Sensors with Pulse Width (ie with distance measurement):

Sensor VariationMax. RangeMin. Update RateJumper Settings (4321)
#4064: Pulse width output, 50cm max50 cm50 Hz1110

Reviews

There are no reviews yet.

Be the first to review “Distance Sensor with Pulse Width Output 50cm Max”
Scroll to Top