US-100 Ultrasonic Distance Sensor Module

From air
Jump to navigation Jump to search
Ultrasonic Sensor US-100 on MSP430 Launchpad G2

Capteur de distance ultrason supportant 2 modes : GPIO et Série (il faut retirer le jumper pour le mode série)

Il est compatible avec les programmes pour le capteur HR-SC04.

This sensor can be used with both 3.3V (MSP430, STM32 Discovery) and 5V (Arduino, STM32 Nucleo) microcontrollers and only consumes 2mA when idle.

Using the US-100 Ultrasonic Distance Sensor Module Connect the VCC and GND pins to a 2.4V-5.5V power supply. The usage of the other pins depends on the operating mode selected. Select the operating mode of the US-100 Ultrasonic Distance Sensor by using the jumper on the back of the module. When the jumper is present, the sensor outputs the distance as binary serial data, otherwise the sensor outputs a single pulse that has a width which represents the distance measured.



TI' MSP430 Launchpad

Simple Test of Ultrasonic Sensor US-100 on MSP430 Launchpad G2.

US-100 from

Source inspired from

// set pin numbers:
const int trigPin = P1_6;
const int echoPin =  P1_7; 

void setup() {
  Serial.println("Ultrasonic sensor US-100 test"); 
  pinMode(trigPin, OUTPUT);      
  pinMode(echoPin, INPUT);     

void loop(){
  long duration, distance;
  digitalWrite(trigPin, LOW); // Added this line
  delayMicroseconds(2); // Added this line
  digitalWrite(trigPin, HIGH);
// delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
   duration = pulseIn(echoPin, HIGH);
   distance = (duration/2) / 29.1;

  Serial.println(" cm");