Beställt på vardagar före 14:00 = skickas samma dag. 30 dagars ångerrätt

Kopplingsschema och kodexempel

Så här kopplar du Infraröd hinderundvikningsmodul HW-201 till en Arduino UNO eller ESP32, med ett exempel­sketch som du kan ladda upp direkt.

IR Obstacle Detection with HW-201

This project uses an HW-201 infrared obstacle avoidance sensor to detect nearby objects. When an obstacle comes into range, the sensor's digital output goes LOW, turning on the Arduino's built-in LED and printing detection alerts to the Serial Monitor. Adjust the onboard potentiometer on the sensor module to calibrate the detection distance.

Kopplingsschema: Infraröd hinderundvikningsmodul HW-201 på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: Infraröd hinderundvikningsmodul HW-201 på en Arduino UNO
Kopplingstabell · Klicka för att förstora
IR_Obstacle_Detection_with_HW_201.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : IR Obstacle Detection with HW-201
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : HW-201 Infrared Obstacle Avoidance Module
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// Pin definitions
const int sensorPin = 2;
const int ledPin = 13;

void setup() {
  pinMode(sensorPin, INPUT);
  pinMode(ledPin, OUTPUT);

  Serial.begin(115200);
  Serial.println(F("HW-201 IR Obstacle Sensor Demo"));
  Serial.println(F("Ready: Move an object in front of the sensor."));
}

void loop() {
  // The HW-201 sensor outputs LOW when an obstacle is detected
  int sensorState = digitalRead(sensorPin);

  if (sensorState == LOW) {
    digitalWrite(ledPin, HIGH);
    Serial.println(F("Obstacle Detected!"));
  } else {
    digitalWrite(ledPin, LOW);
    Serial.println(F("Clear (no obstacle)"));
  }

  delay(200);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

IR Obstacle Detection with ESP32

This project reads the digital output from the HW-201 Infrared Obstacle Avoidance Module. When an object is detected within range, the sensor output drops LOW, lighting up the ESP32's built-in LED and printing an alert to the Serial Monitor. You can adjust the detection distance using the potentiometer on the module.

Kopplingsschema: Infraröd hinderundvikningsmodul HW-201 på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: Infraröd hinderundvikningsmodul HW-201 på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
IR_Obstacle_Detection_with_ESP32.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : IR Obstacle Detection with ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : HW-201 Infrared Obstacle Avoidance Module
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// HW-201 IR Obstacle Sensor with ESP32
const int SENSOR_PIN = 4;   // Connected to OUT pin of HW-201
const int LED_PIN = 2;      // Onboard LED

void setup() {
  Serial.begin(115200);
  pinMode(SENSOR_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  
  Serial.println("HW-201 Obstacle Sensor Ready");
}

void loop() {
  // The HW-201 output is active-LOW (LOW when an obstacle is detected)
  int sensorState = digitalRead(SENSOR_PIN);

  if (sensorState == LOW) {
    digitalWrite(LED_PIN, HIGH);
    Serial.println("Obstacle detected!");
  } else {
    digitalWrite(LED_PIN, LOW);
    Serial.println("Path clear");
  }

  delay(200);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Produktsäkerhet
Tillverkare
OTRONIC
Meerweg 76A, 2121 VC BENNEBROEK, Nederland
support@otronic.nl
Ansvarig i EU
OTRONIC
Meerweg 76A, 2121 VC BENNEBROEK, Nederland
support@otronic.nl
Säkerhetsinformation
Läs produktinformationen och eventuell manual före användning. Elektroniska moduler och delar är avsedda för personer med teknisk kunskap; förvara dem utom räckhåll för barn. Använd endast angiven spänning och anslut eller koppla inte loss något medan kretsen är spänningssatt. Lämna uttjänt elektronik och batterier till en insamlingsplats; släng dem inte i hushållsavfallet.

Infraröd hinderundvikningsmodul HW-201

Infraröd hinderundvikningsmodul.

Ger en 5V-signal när det inte finns några hinder och en 0V-signal när det finns ett hinder och den gröna LED:n tänds. Avståndet kan justeras med en potentiometer. Fungerar med 3.3V och 5V, har en röd power-LED.

Mäter avstånd till hinder på ett avstånd av 2-30cm och 35 grader med hjälp av infraröda signaler. Innehåller en infraröd sändare och mottagare.

Mått
Längd: 4,5cm
Bredd: 1,4cm
Höjd: 0,9cm

  • Hinderdetektering
  • Avståndet kan justeras
  • Grön LED
  • Röd power-LED

Varför välja denna produkt?

  • Justerbart avstånd – Avståndet kan justeras med potentiometer.
  • Två signaler – Ger 5V eller 0V beroende på hinder.
  • Fungerar på 3,3V och 5V – Lämplig för 3,3V- och 5V-tillämpningar.
  • LED-indikering – Grön och röd LED visar status.
  • Detekterar nära – Läser av hinder på 2–30 cm avstånd.
Specifikationer
Bredd1,4 cm
Driftspänning3,3V
Längd4,5 cm
Höjd0,9 cm
Vinkel35 grader
Mätavstånd2-30 cm

Recensioner

★★★★★ 5,0/5 4 recensioner
  • ★★★★★Ad Versteeg

    Precis vad jag letade efter

  • ★★★★★Simon Appeltants

    bra kvalitet

  • ★★★★★Vojta Matejec

    DET ÄR BRA

Skriv ett omdöme
Ditt omdöme

Frakt & returer

Frakt

  • Paket med spårning85 kr5 arbetsdagar
  • Paket med spårning104 kr5 arbetsdagar
  • Paket med spårning124 kr5 arbetsdagar
  • Paket med spårning130 kr5 arbetsdagar
Allt om frakt

Returer

Inte nöjd? Du har 30 dagars ångerrätt efter leverans för att returnera produkten.

Allt om returer