{"product_id":"pololu-distance-sensor-with-pulse-width-output-50cm-max","title":"Pololu Distance Sensor with Pulse Width Output","description":"\u003cp\u003eThis small lidar-based distance sensor reports the distance of objects with a pulsed signal similar to a hobby servo control signal.\u003c\/p\u003e\n\u003cp\u003eA digital microcontroller pin can be used to time the length of each high pulse, which encodes the measured distance. The sensor works over an input voltage range of 3.0 V to 5.5 V, and the 0.1″ pin spacing makes it easy to use with standard solderless breadboards and 0.1″ perfboards.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote:\u003c\/strong\u003e The maximum range is only achievable for high-reflectance objects in good ambient conditions. Lower-reflectivity targets or poor ambient conditions will reduce the maximum range.\u003c\/p\u003e\n\u003cp\u003eIt 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 1-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.\u003c\/p\u003e\n\u003cp\u003eThe relationship between measured distance d (in mm) and pulse width t (in µs) is as follows:\u003c\/p\u003e\n\u003ctable\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003cth\u003e50cm max\u003c\/th\u003e\n\u003cth\u003e130cm max\u003c\/th\u003e\n\u003cth\u003e300cm max\u003c\/th\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003et=1000 µs + \u003csup\u003e4µs\u003c\/sup\u003e⁄\u003csub\u003e3mm\u003c\/sub\u003e ⋅ d\u003c\/td\u003e\n\u003ctd\u003et=1000 µs + \u003csup\u003e1µs\u003c\/sup\u003e⁄\u003csub\u003e2mm\u003c\/sub\u003e ⋅ d\u003c\/td\u003e\n\u003ctd\u003et=1000 µs + \u003csup\u003e1µs\u003c\/sup\u003e⁄\u003csub\u003e4mm\u003c\/sub\u003e ⋅ d\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ed=\u003csup\u003e3 mm\u003c\/sup\u003e⁄\u003csub\u003e4µs\u003c\/sub\u003e ⋅ (t –1000 µs)\u003c\/td\u003e\n\u003ctd\u003ed=\u003csup\u003e2 mm\u003c\/sup\u003e⁄\u003csub\u003e1µs\u003c\/sub\u003e ⋅ (t –1000 µs)\u003c\/td\u003e\n\u003ctd\u003ed=\u003csup\u003e4 mm\u003c\/sup\u003e⁄\u003csub\u003e1µs\u003c\/sub\u003e ⋅ (t –1000 µs)\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003cp\u003eThe 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.65-1.75 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 (for 5cm max), 9ms to 10ms (for 130max), or 30 to 33ms (for max 300cm), depending on the proximity of the detected object.\u003c\/p\u003e\n\u003cp\u003eThe maximum detection range depends on object reflectivity and ambient lighting conditions. In tests, the sensor was able to reliably detect a white sheet of paper out to around 50 cm away, and it could reliably detect a hand out to around 30 cm away. The following graph shows the measured distances of five units versus their actual distances from a white paper target at several different ranges:\u003c\/p\u003e\n\u003cp\u003e\u003cimg alt=\"\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/0J11160.1200_480x480.png?v=1617978541\" data-mce-src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/0J11160.1200_480x480.png?v=1617978541\"\u003e\u003c\/p\u003e\n\u003cp\u003ePlease note that while this sensor can detect objects almost all the way up to the sensor face, the effective minimum distance it can measure is around 1 cm, so objects closer than 1 cm might still result in a measured distance of around 1 cm.\u003c\/p\u003e\n\u003ch2\u003eSpecifications\u003c\/h2\u003e\n\u003cul\u003e\n\u003cli\u003eOperating voltage: 3.0 V to 5.5 V\u003c\/li\u003e\n\u003cli\u003eCurrent consumption: 30 mA (typical) when enabled, 0.4 mA when disabled\u003c\/li\u003e\n\u003cli\u003eField of view (FOV): 15° typical; can vary with object reflectance and ambient conditions\u003c\/li\u003e\n\u003cli\u003eOutput type: digital pulse width\u003c\/li\u003e\n\u003cli\u003eDimensions: 0.85″ × 0.35″ × 0.122″ (21.6 × 8.9 × 3.1 mm); \u003ca href=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/pololu-digital-distance-sensor-dimensions.pdf?v=1617978613\" target=\"_blank\"\u003esee the dimension diagram for more information\u003c\/a\u003e\n\u003c\/li\u003e\n\u003cli\u003eWeight: 0.014 oz (0.4 g)\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch2\u003eUsing the sensor\u003c\/h2\u003e\n\u003cp\u003e\u003cstrong\u003eImportant note:\u003c\/strong\u003e This product might ship with a protective liner covering the sensor IC. The liner must be removed for proper sensing performance.\u003c\/p\u003e\n\u003cp\u003e\u003cimg alt=\"\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/0J11274.1200_480x480.jpg?v=1624271903\"\u003e\u003c\/p\u003e\n\u003cp\u003eThree connections are necessary to use this module: VIN, GND, and OUT. These pins are accessible through a row of 0.1″-pitch through holes, which work with standard 0.1″ (2.54 mm) male headers and 0.1″ female headers (available separately). The VIN pin should be connected to a 3 V to 5.5 V source, and GND should be connected to 0 volts. The sensor outputs its digital pulses on 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).\u003c\/p\u003e\n\u003cp\u003eThe board has an optional ENABLE pin that can be driven low to put it into a low-power state that consumes approximately 0.4 mA. This pin can be accessed through a via or its neighboring surface-mount pad on the back side labeled “EN” on the silkscreen. The ENABLE pin is pulled up to VIN, enabling the sensor by default.\u003c\/p\u003e\n\u003cp\u003eThe board features four surface-mount configuration jumpers that determine its operation mode. Different versions of the Pololu Digital Distance sensors ship with the appropriate jumpers pre-populated with 0 Ω resistors. These resistors can be desoldered from the populated spots or solder bridges can be added across the unpopulated spots to convert one sensor version into another. The table in the section below shows the jumper settings for the different versions.\u003c\/p\u003e\n\u003cp\u003eThe board has one mounting hole intended for use with #2 or M2 screws.\u003c\/p\u003e\n\u003ch2\u003eArduino program for reading pulse width output\u003c\/h2\u003e\n\u003cp\u003eThis is a simple Arduino sketch that reads the output of the Pololu Distance Sensor with Pulse Width Output, 50cm Max and displays the measured distance in millimeters.\u003c\/p\u003e\n\u003ccode\u003e\/\/ Example Arduino program for reading the Pololu Distance Sensor with Pulse Width Output, 50cm Max\u003cbr\u003e \u003cbr\u003e\/\/ Change this to match the Arduino pin connected to the sensor's OUT pin.\u003cbr\u003econst uint8_t sensorPin = 2;\u003cbr\u003e \u003cbr\u003evoid setup()\u003cbr\u003e{\u003cbr\u003e Serial.begin(115200);\u003cbr\u003e}\u003cbr\u003e \u003cbr\u003evoid loop()\u003cbr\u003e{\u003cbr\u003e int16_t t = pulseIn(sensorPin, HIGH);\u003cbr\u003e \u003cbr\u003e if (t == 0)\u003cbr\u003e {\u003cbr\u003e \/\/ pulseIn() did not detect the start of a pulse within 1 second.\u003cbr\u003e Serial.println(\"timeout\");\u003cbr\u003e }\u003cbr\u003e else if (t \u0026gt; 1850)\u003cbr\u003e {\u003cbr\u003e \/\/ No detection.\u003cbr\u003e Serial.println(-1);\u003cbr\u003e }\u003cbr\u003e else\u003cbr\u003e {\u003cbr\u003e \/\/ Valid pulse width reading. Convert pulse width in microseconds to distance in millimeters.\u003cbr\u003e int16_t d = (t - 1000) * 3 \/ 4;\u003cbr\u003e \u003cbr\u003e \/\/ Limit minimum distance to 0.\u003cbr\u003e if (d \u0026lt; 0) { d = 0; } \u003cbr\u003e \u003cbr\u003e Serial.print(d);\u003cbr\u003e Serial.println(\" mm\");\u003cbr\u003e }\u003cbr\u003e}\u003c\/code\u003e\n\u003ch2\u003emicro:bit MakeCode program for reading pulse width output\u003c\/h2\u003e\n\u003cp\u003ePololu 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 the program in the micro:bit MakeCode editor by \u003ca href=\"https:\/\/makecode.microbit.org\/_XgJWHYH6VUp6\" target=\"_blank\"\u003eclicking this link.\u003c\/a\u003e\u003c\/p\u003e\n\u003ch2\u003eJumper settings (irs17a)\u003cbr\u003e\n\u003c\/h2\u003e\n\u003cp\u003eThe board features four surface-mount configuration jumpers that determine its operation mode. Different versions of the Pololu Digital Distance Sensors ship with the appropriate jumpers pre-populated with 0 Ω resistors. These resistors can be desoldered from the populated spots or solder bridges can be added across the unpopulated spots to convert one sensor version into another. This sensor can be converted into any other irs17a version as listed in the following table.\u003c\/p\u003e\n\u003ctable\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003cth\u003eOutput type\u003c\/th\u003e\n\u003cth\u003eSensor\u003c\/th\u003e\n\u003cth\u003eMaximum range\u003c\/th\u003e\n\u003cth\u003eResolution\u003c\/th\u003e\n\u003cth\u003eMinimum update rate\u003c\/th\u003e\n\u003cth\u003eJumper settings (4321)\u003c\/th\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"7\"\u003e\n\u003cstrong\u003edigital\u003c\/strong\u003e\u003cbr\u003e(does not provide distance measurement)\u003c\/td\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39309440712787\" target=\"_blank\"\u003ePOL-4050: Digital output, 5cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e5 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e145 Hz\u003c\/td\u003e\n\u003ctd\u003e0000\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39309440745555\" target=\"_blank\"\u003ePOL-4052: Digital output, 10cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e10 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e115 Hz\u003c\/td\u003e\n\u003ctd\u003e0010\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39309440778323\" target=\"_blank\"\u003ePOL-4054: Digital output, 15cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e15 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e95 Hz\u003c\/td\u003e\n\u003ctd\u003e0100\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39377040736339\" target=\"_blank\"\u003ePOL-4066: Digital output, 25cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e25 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e100 Hz\u003c\/td\u003e\n\u003ctd\u003e0000\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39377042309203\" target=\"_blank\"\u003ePOL-4067: Digital output, 50cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e50 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e100 Hz\u003c\/td\u003e\n\u003ctd\u003e0001\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39377042931795\" target=\"_blank\"\u003ePOL-4069: Digital output, 100cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e100 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e100 Hz\u003c\/td\u003e\n\u003ctd\u003e0011\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"\/en-eu\/products\/pololu-digital-distance-sensor?variant=39377043095635\" target=\"_blank\"\u003ePOL-4077: Digital output, 200cm\u003c\/a\u003e\u003c\/td\u003e\n\u003ctd\u003e200 cm\u003c\/td\u003e\n\u003ctd\u003e-\u003c\/td\u003e\n\u003ctd\u003e30 Hz\u003c\/td\u003e\n\u003ctd\u003e1011\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"3\"\u003e\n\u003cstrong\u003epulse width\u003c\/strong\u003e\u003cbr\u003e(provides distance measurement)\u003c\/td\u003e\n\u003ctd\u003ePOL-4064: Pulse width output, 50cm max\u003c\/td\u003e\n\u003ctd\u003e50 cm\u003c\/td\u003e\n\u003ctd\u003e3 mm\u003c\/td\u003e\n\u003ctd\u003e50 Hz\u003c\/td\u003e\n\u003ctd\u003e1110\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ePOL-4071: Pulse width output, 130cm max\u003c\/td\u003e\n\u003ctd\u003e130 cm\u003c\/td\u003e\n\u003ctd\u003e1 mm\u003c\/td\u003e\n\u003ctd\u003e100 Hz\u003c\/td\u003e\n\u003ctd\u003e0101\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ePOL-4079: Pulse width output, 300cm max\u003c\/td\u003e\n\u003ctd\u003e300 cm\u003c\/td\u003e\n\u003ctd\u003e2 mm\u003c\/td\u003e\n\u003ctd\u003e30 Hz\u003c\/td\u003e\n\u003ctd\u003e1101\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003c\/tbody\u003e\n\u003c\/table\u003e","brand":"Pololu","offers":[{"title":"50cm max","offer_id":39377074847827,"sku":"POL-4064","price":12.95,"currency_code":"EUR","in_stock":false},{"title":"130cm max","offer_id":39377074880595,"sku":"POL-4071","price":16.95,"currency_code":"EUR","in_stock":false},{"title":"300cm max","offer_id":39377074913363,"sku":"POL-4079","price":16.95,"currency_code":"EUR","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/products\/0J11135.1200.jpg?v=1618296711","url":"https:\/\/shop.pimoroni.com\/en-eu\/products\/pololu-distance-sensor-with-pulse-width-output-50cm-max","provider":"Pimoroni Ltd","version":"1.0","type":"link"}