

The Ultrasonik Coba Coba is an ultrasonic sensor designed for measuring distances by emitting ultrasonic waves and detecting their reflection. It is widely used in applications requiring precise distance measurement, such as robotics, obstacle detection, liquid level sensing, and proximity detection. Its compact design and ease of integration make it a popular choice for both hobbyists and professionals.








| Pin Name | Pin Number | Description |
|---|---|---|
| VCC | 1 | Power supply pin (5V DC). |
| Trig | 2 | Trigger pin to send ultrasonic pulses. |
| Echo | 3 | Echo pin to receive reflected ultrasonic waves. |
| GND | 4 | Ground pin. |
// Define pins for Ultrasonik Coba Coba
const int trigPin = 9; // Trigger pin connected to digital pin 9
const int echoPin = 10; // Echo pin connected to digital pin 10
void setup() {
pinMode(trigPin, OUTPUT); // Set Trigger pin as output
pinMode(echoPin, INPUT); // Set Echo pin as input
Serial.begin(9600); // Initialize serial communication
}
void loop() {
// Send a 10 µs HIGH pulse to the Trigger pin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Measure the duration of the HIGH signal on the Echo pin
long duration = pulseIn(echoPin, HIGH);
// Calculate the distance in cm
float distance = (duration * 0.034) / 2;
// Print the distance to the Serial Monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(500); // Wait for 500 ms before the next measurement
}
No Output or Incorrect Readings
Fluctuating Distance Measurements
Sensor Not Detecting Objects
Echo Pin Always HIGH or LOW
Q: Can the Ultrasonik Coba Coba detect transparent objects?
A: Ultrasonic sensors may struggle with transparent objects like glass. For better results, use objects with solid, non-reflective surfaces.
Q: What is the maximum angle of detection?
A: The sensor typically has a detection angle of about 15 degrees.
Q: Can I use this sensor with a 3.3V microcontroller?
A: The Ultrasonik Coba Coba requires a 5V power supply. Use a level shifter for compatibility with 3.3V systems.
By following this documentation, you can effectively integrate the Ultrasonik Coba Coba into your projects and troubleshoot common issues with ease.