กลับหน้าหลัก
views
How to Use Arduino with HB100 Microwave Motion Sensor
Last updated on

How to Use Arduino with HB100 Microwave Motion Sensor


How to Use Arduino with HB100 Microwave Motion Sensor

This tutorial walks you through wiring and coding Arduino to read values from the HB100 microwave motion sensor, which operates on the 10.525 GHz Doppler Radar principle.

![Circuit diagram showing Arduino UNO connected to HB100 Sensor and LED on breadboard](image: Breadboard circuit showing wiring between Arduino UNO, HB100 microwave sensor module, red LED, and 220 Ohm resistor with clear pin labels)

What is HB100 Microwave Sensor

The HB100 is a microwave-based motion detection sensor (Microwave Motion Sensor) that uses the Doppler Effect principle. It transmits high-frequency microwaves and measures frequency shifts when objects move.

Key advantages over PIR sensors:

  • Immune to environmental conditions, sunlight, or temperature
  • 360-degree detection range
  • Suitable for industrial and outdoor applications

Required Components

ComponentQuantity
Arduino UNO R31
HB100 Microwave Doppler Sensor Module1
5mm Red LED1
220 Ohm Resistor1
MB-102 Breadboard1
Male-to-Male Jumper Wires 20cm5
Power Adapter 9V 2A (optional)1

How to Wire HB100 to Arduino

HB100 Module Pins

The HB100 sensor has 4 working pins:

  • VCC - 5V power supply
  • GND - Ground
  • OUT - Signal output when motion is detected
  • 3.3V - 3.3V reference (for some models)

Wiring Steps

![Pin mapping table showing Arduino connections to HB100 and LED](image: Connection table showing Arduino Pin 13 > LED > 220 Ohm, Arduino 5V > HB100 VCC, Arduino GND > HB100 GND, Arduino Pin 2 > HB100 OUT)

Wire the circuit as follows:

  1. LED - Connect anode (long leg) to Pin 13 through 220 Ohm resistor, cathode (short leg) to GND
  2. HB100 VCC - Connect to Arduino 5V
  3. HB100 GND - Connect to Arduino GND
  4. HB100 OUT - Connect to Arduino Digital Pin 2

![Photo of HB100 Module with labeled pins](image: HB100 microwave sensor module with clearly labeled pins VCC GND OUT on the circuit board)

Installing MsTimer2 Library

Install MsTimer2 library before writing code:

  1. Download the library from GitHub or MediaFire
  2. Open Arduino IDE
  3. Go to Sketch > Include Library > Add .ZIP Library
  4. Select MsTimer2-master.zip
  5. Wait for IDE to confirm successful installation

Arduino Code for Reading HB100

#include <MsTimer2.h>

// Define pin connected to HB100
#define HB100_OUT 2

// Variable to count motion detection events
volatile int motionCount = 0;

// Interrupt function to count motion events
void motionDetected() {
  motionCount++;
}

void setup() {
  Serial.begin(9600);
  
  // Set up interrupt pin
  pinMode(HB100_OUT, INPUT);
  
  // Set Timer Interrupt every 1 second
  // Adjust value based on your needs
  MsTimer2::set(1000, printMotionCount);
  MsTimer2::start();
  
  // Call motionDetected on rising/falling edge at OUT pin
  attachInterrupt(digitalPinToInterrupt(HB100_OUT), motionDetected, CHANGE);
  
  Serial.println("Arduino HB100 Microwave Sensor Ready");
  Serial.println("Value shown = Number of detections per second");
}

void loop() {
  // Nothing to do here, using Interrupt instead
}

// Function to print count every second
void printMotionCount() {
  Serial.println(motionCount);
  motionCount = 0; // Reset after printing
}

Note: Timer value (1000ms) can be adjusted based on your needs. Shorter intervals give faster readings but be aware of debounce issues.

Steps to Upload and Test

  1. Open Arduino IDE and paste the code above
  2. Select board: Tools > Board > Arduino Uno
  3. Select Port: Tools > Port > COMx
  4. Click Upload button (right arrow)
  5. Wait for “Done uploading”
  6. Open Serial Monitor via Tools > Serial Monitor or Ctrl+Shift+M
  7. Set Baud Rate to 9600

Expected Results

When opening Serial Monitor you will see:

  • Initial value shows 0 when no motion
  • Value changes based on number of motion detections
  • LED on Pin 13 will blink accordingly (if you add the code)

Reference Video

Common Problems and Solutions

ProblemCauseSolution
Value stays at 0Wrong pin wiringCheck VCC, GND, OUT connections
Readings not accurateDistance from sensorAdjust distance appropriately
Value keeps jumpingSignal noiseAdd capacitor for filtering

Summary

Using HB100 with Arduino requires MsTimer2 library for interrupt handling to count motion detection events. Sensitivity depends on Timer settings and distance from sensor. This setup is ideal for applications requiring motion detection in environments where PIR sensors are unstable.

อยากทำโปรเจคแบบนี้?

รับทำโปรเจค Arduino / IoT จบงานไว ส่งงานครบ พร้อมสอน

If you need Arduino project service or urgent IoT development, see full service details on the home page

จ้างทำโปรเจคเลย

ความคิดเห็น