The Pololu Distance Sensor with Pulse Width Output (Manufacturer Part ID: 4079) is a high-performance distance measuring sensor designed for applications requiring accurate distance readings up to 300 cm. This sensor uses pulse width modulation (PWM) to output distance measurements, making it easy to interface with microcontrollers and other digital systems. Its compact size and reliable performance make it ideal for robotics, automation, and object detection systems.
Parameter | Value |
---|---|
Manufacturer | Pololu |
Part ID | 4079 |
Measurement Range | 5 cm to 300 cm |
Output Type | Pulse Width Modulation (PWM) |
Supply Voltage | 4.5 V to 5.5 V |
Current Consumption | ~25 mA |
Output Pulse Width Range | 1 ms (5 cm) to 37 ms (300 cm) |
Operating Temperature | -10°C to 60°C |
Dimensions | 20 mm × 10 mm × 7 mm |
Weight | 0.5 g |
Pin Number | Pin Name | Description |
---|---|---|
1 | VIN | Power supply input (4.5 V to 5.5 V). Connect to the 5V pin of your system. |
2 | GND | Ground. Connect to the ground of your system. |
3 | PWM OUT | Pulse width output. Provides distance measurement as a PWM signal. |
VIN
pin to a 5V power source and the GND
pin to the ground of your circuit.PWM OUT
pin to a digital input pin of your microcontroller. The pulse width of the signal corresponds to the measured distance.PWM OUT
pin. Use the formula below to calculate the distance:
[
\text{Distance (cm)} = \text{Pulse Width (ms)} \times 10
]
For example, a pulse width of 15 ms corresponds to a distance of 150 cm.PWM OUT
pin and ground to stabilize the output.The following Arduino code demonstrates how to read the PWM output from the sensor and calculate the distance:
// Define the pin connected to the PWM OUT of the sensor
const int pwmPin = 2;
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Set the PWM pin as an input
pinMode(pwmPin, INPUT);
}
void loop() {
// Measure the duration of the HIGH pulse on the PWM pin
unsigned long pulseWidth = pulseIn(pwmPin, HIGH);
// Convert the pulse width to distance in cm
float distance = pulseWidth * 0.1; // 1 ms = 10 cm
// Print the distance to the Serial Monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
// Add a small delay for stability
delay(100);
}
No Output Signal
VIN
pin is connected to a 5V power source and the GND
pin is connected to ground.Inaccurate Distance Readings
PWM Signal is Unstable
PWM OUT
pin and ground.Distance Readings are Stuck at Maximum or Minimum
Q: Can this sensor detect transparent objects?
A: The sensor may have difficulty detecting transparent or highly reflective objects. For best results, use opaque and matte surfaces.
Q: How fast can the sensor update distance readings?
A: The sensor provides a new distance reading approximately every 50 ms.
Q: Can I use this sensor with a 3.3V microcontroller?
A: The sensor requires a 5V power supply, but the PWM output can be read by 3.3V logic microcontrollers. Use a level shifter if needed.
Q: What is the accuracy of the sensor?
A: The sensor provides reliable readings with an accuracy of ±5% under ideal conditions.