Skip to content

Crowbits-Ultrasonic Ranging Sensor


This HC-SR04 Ultrasonic Ranging Sensor is a non-contact distance measurement module with stable performance and high ranging accuracy, with the inexpensive price. The measurement range can be up to 5M, which would be helpful for your project such as robotic Obstacle Avoidance and so on.



  • High precision
  • Stable


  • Ranging distance: 2cm to 500 cm
  • Operating Voltage: 3.3V DC
  • Dimensions: 31.5(L)*24.5(W)*13(H)mm


The following sketch demonstrates a simple application of digital display.

1. You need to prepare a Crowbits motherboard, such as Crowbits-UNO board.

2. Connect the module to the D4 and D5 interface of the Crowbits-UNO board, as shown in the figure:

Crowbits-Ultrasonic Ranging Sensor-Wiki 1.JPG

3. Download the library “Ultrasonic”. Unzip and put it in the libraries file, for example: C:\Program Files (x86)\Arduino\libraries.

4. Upload the following code to the Crowbits-UNO board.

#include <Ultrasonic.h>
Ultrasonic ultrasonic(4,5);//Init an Ultrasonic object
int Distance;
void setup() {

void loop()
 Distance=ultrasonic.Ranging(CM);//get the current result;
 Serial.print("the distance is ");

5. After the upload is successful, open the serial port monitor, the baud rate is set to 9600. Put an object in front of the sensor, the serial port will print the corresponding distance, as shown in the figure:

Crowbits-Ultrasonic Ranging Sensor-Wiki 2.jpg