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.

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
| Component | Quantity |
|---|---|
| Arduino UNO R3 | 1 |
| HB100 Microwave Doppler Sensor Module | 1 |
| 5mm Red LED | 1 |
| 220 Ohm Resistor | 1 |
| MB-102 Breadboard | 1 |
| Male-to-Male Jumper Wires 20cm | 5 |
| 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

Wire the circuit as follows:
- LED - Connect anode (long leg) to Pin 13 through 220 Ohm resistor, cathode (short leg) to GND
- HB100 VCC - Connect to Arduino 5V
- HB100 GND - Connect to Arduino GND
- HB100 OUT - Connect to Arduino Digital Pin 2

Installing MsTimer2 Library
Install MsTimer2 library before writing code:
- Download the library from GitHub or MediaFire
- Open Arduino IDE
- Go to Sketch > Include Library > Add .ZIP Library
- Select MsTimer2-master.zip
- 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
- Open Arduino IDE and paste the code above
- Select board: Tools > Board > Arduino Uno
- Select Port: Tools > Port > COMx
- Click Upload button (right arrow)
- Wait for “Done uploading”
- Open Serial Monitor via Tools > Serial Monitor or Ctrl+Shift+M
- 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
| Problem | Cause | Solution |
|---|---|---|
| Value stays at 0 | Wrong pin wiring | Check VCC, GND, OUT connections |
| Readings not accurate | Distance from sensor | Adjust distance appropriately |
| Value keeps jumping | Signal noise | Add 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
จ้างทำโปรเจคเลย