Getting Started with mmWave Sensor MR60BHA1 and Arduino

Advanced 60GHz Millimeter-Wave Motion Detection

Harness the power of mmWave radar technology for precise motion detection and distance measurement

Introduction

The MR60BHA1 mmWave Sensor is a compact and efficient radar sensor that utilizes millimeter-wave technology to detect objects, measure distance, and track motion. With its high precision and low power consumption, this sensor is ideal for applications in robotics, automation, and security systems.

Technical Specifications

Millimeter-wave (mmWave) sensors operate at extremely high frequencies, typically in the 30GHz to 300GHz range, allowing them to detect objects with great accuracy regardless of lighting conditions. Unlike optical sensors, mmWave sensors can penetrate fog, dust, and even certain materials, making them reliable in harsh environments.

The MR60BHA1 operates at 60GHz, providing precise motion detection and range measurement capabilities with exceptional reliability.

Applications of mmWave Sensors

Smart Homes & Automation
Human presence detection for lighting, heating, and security systems
Security & Surveillance
Intruder detection even in low-visibility environments
Industrial Automation
Machinery monitoring and worker safety detection
Robotics & Drones
Obstacle detection and autonomous navigation
Healthcare Monitoring
Contactless vital signs and movement detection
Automotive Applications
ADAS, blind-spot detection, and parking assistance
Retail Analytics
Customer movement tracking and business insights

Required Components

  • Arduino Board (Arduino Uno, Mega, or ESP32)
  • MR60BHA1 mmWave Sensor
  • Jumper Wires (Male-to-Female)
  • USB Cable (for Arduino connection)
MR60BHA1 mmWave Sensor

Firmware Update Process

⚠ Important: Update your radar to the latest firmware version for optimal performance. Many sensor issues can be resolved by updating to the latest firmware.

There are two methods to update firmware:

  1. J-Link Programmer: Professional but expensive option
  2. UART Method: Cost-effective using USB-to-UART converter

UART Firmware Update Method

1Download Latest Firmware

Download the latest firmware from the link below:

📥 Download Firmware

2Hardware Connection

Connect the MR60BHA1 sensor to your USB-to-UART converter as shown in the diagram:

UART Connection Diagram

3Download Software Tools

Download the necessary programming software:

📥 Download PackageMake Tool

4Configure Serial Connection

Unzip PackageMake-v1.1.1.zip and open the executable. Configure the serial port:

  • Click the gear icon in the upper left corner
  • Select the correct port number
  • Set baud rate to 115200
  • Click confirm in the bottom right corner
Serial Port Configuration

5Verify Connection

Click the second icon in the upper right corner to verify the connection. If properly configured, you should see raw data from the radar.

Data Verification

6Upload Firmware

Click the last icon in the upper right corner, select your downloaded firmware file, and double-click the upload icon to start the firmware update process.

Firmware Upload Process

Upper Computer Software

For advanced monitoring and configuration, you can use the dedicated upper computer software:

📥 Download Upper Computer Software
Upper Computer Software Interface

Software Interface Overview

1. Connection Setup: Select the correct serial port and refresh if needed. Data automatically updates when properly connected.
2. Function Settings: Enable debugging for real-time data, save raw data, or save sleep-specific data for analysis.
3. Serial Monitor: Displays real-time sensor data frames when debugging is enabled. Send commands at the bottom.
4. Graphic Display: Real-time line graphs showing respiratory rate, heart rate, and physical parameters over time.
5. Status & Orientation: Observe human presence status and body orientation (reference only).

Wiring Diagram

The MR60BHA1 communicates using UART (TX/RX). Connect the sensor to Arduino as follows:

MR60BHA1 Pin Arduino Pin Function
5V (VCC) 5V Power Supply
GND GND Ground
RX TX Serial Receive
TX RX Serial Transmit

Pin Interface Details

Interface 1 - Main Connections:

Power (5V): Main power supply interface for the sensor
RX & TX: Data transmission interfaces. RX = serial receive, TX = serial transmit
GP2 Output: Human presence status - High level = occupied, Low level = unoccupied
GP1 Output: Movement status - High level = active, Low level = stationary

Interface 2 - Programming Pins:

Flash Firmware Pinout: GND/3.3V/SWD/SWC for direct programming
Additional I/O: GP3~GP6 general purpose input/output pins

Arduino Development Setup

Library Installation

Download and install the sensor library:

📥 Download Arduino Library

Connection Configuration:

Arduino default pins: RX → A2, TX → A3

Ensure proper connections as specified in the wiring diagram above.

Arduino Code Examples

Example 1: Basic Heartbeat Detection

This example demonstrates how to read heartbeat data from the MR60BHA1 sensor.

📄 heartbeat_basic.ino
#include <60ghzbreathheart.h>

// Choose your communication method:
// For hardware serial: #define SerialInit Serial1
// For software serial on A2 & A3:
#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3); // RX, TX
    #define SerialInit mySerial
#endif

#ifdef ESP32
    #define SerialInit Serial1
#endif

BreathHeart_60GHz radar = BreathHeart_60GHz(&SerialInit);

void setup() {
    Serial.begin(115200);
    SerialInit.begin(115200);
    
    Serial.println("Ready to receive data...");
    delay(500);
}

void loop() {
    radar.recvRadarBytes();           // Receive radar data
    radar.showData();                 // Display data on serial monitor
    delay(200);                       // Delay for readability
}
Ready to receive data...
Heart Rate: 72 BPM
Breath Rate: 16 breaths/min
Status: Person Detected ✓

Example 2: Heart Rate Monitoring

Monitor real-time heart rate values and display them on the serial monitor.

📄 heart_rate_monitor.ino
#include <60ghzbreathheart.h>

#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3);
    #define SerialInit mySerial
#endif

#ifdef ESP32
    #define SerialInit Serial1
#endif

BreathHeart_60GHz radar = BreathHeart_60GHz(&SerialInit);

void setup() {
    Serial.begin(115200);
    SerialInit.begin(115200);
    
    Serial.println("Heart Rate Monitor Ready");
    delay(500);
}

void loop() {
    radar.recvRadarBytes();
    
    if (radar.sensor_report != 0x00) {
        switch (radar.sensor_report) {
            case HEARTRATEVAL:
                Serial.print("Heart Rate: ");
                Serial.print(radar.heart_rate);
                Serial.println(" BPM");
                break;
        }
    }
    delay(200);
}
Heart Rate Monitor Ready
Heart Rate: 68 BPM
Heart Rate: 70 BPM
Heart Rate: 72 BPM
Heart Rate: 71 BPM

Example 3: Breath Rate Detection

Detect and display respiratory rate in breaths per minute.

📄 breath_rate_monitor.ino
#include <60ghzbreathheart.h>

#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3);
    #define SerialInit mySerial
#endif

#ifdef ESP32
    #define SerialInit Serial1
#endif

BreathHeart_60GHz radar = BreathHeart_60GHz(&SerialInit);

void setup() {
    Serial.begin(115200);
    SerialInit.begin(115200);
    
    Serial.println("Breath Rate Monitor Ready");
    delay(500);
}

void loop() {
    radar.recvRadarBytes();
    
    if (radar.sensor_report != 0x00) {
        switch (radar.sensor_report) {
            case BREATHVAL:
                Serial.print("Breath Rate: ");
                Serial.print(radar.breath_rate);
                Serial.println(" breaths/min");
                break;
        }
    }
    delay(200);
}
Breath Rate Monitor Ready
Breath Rate: 15 breaths/min
Breath Rate: 16 breaths/min
Breath Rate: 14 breaths/min
Breath Rate: 16 breaths/min

Example 4: Human Presence Detection

Detect if a person is present in the detection zone.

📄 presence_detection.ino
#include <60ghzbreathheart.h>

#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3);
    #define SerialInit mySerial
#endif

#ifdef ESP32
    #define SerialInit Serial1
#endif

BreathHeart_60GHz radar = BreathHeart_60GHz(&SerialInit);

void setup() {
    Serial.begin(115200);
    SerialInit.begin(115200);
    
    Serial.println("Presence Detection Ready");
    delay(500);
}

void loop() {
    radar.recvRadarBytes();
    
    if (radar.sensor_report != 0x00) {
        switch (radar.sensor_report) {
            case SOMEONE:
                Serial.println("✓ Someone is here");
                break;
            case NOONE:
                Serial.println("✗ No one detected");
                break;
            case NONEPSE:
                Serial.println("⚠ None");
                break;
        }
    }
    delay(200);
}
Presence Detection Ready
✓ Someone is here
✓ Someone is here
✗ No one detected
✗ No one detected

Example 5: Complete Health Monitoring

Monitor heart rate, breath rate, and presence simultaneously.

📄 complete_health_monitor.ino
#include <60ghzbreathheart.h>

#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3);
    #define SerialInit mySerial
#endif

#ifdef ESP32
    #define SerialInit Serial1
#endif

BreathHeart_60GHz radar = BreathHeart_60GHz(&SerialInit);

void setup() {
    Serial.begin(115200);
    SerialInit.begin(115200);
    
    Serial.println("=================================");
    Serial.println("  Complete Health Monitor v1.0  ");
    Serial.println("=================================");
    delay(500);
}

void loop() {
    radar.recvRadarBytes();
    
    if (radar.sensor_report != 0x00) {
        Serial.println("\n--- Health Data ---");
        
        switch (radar.sensor_report) {
            case SOMEONE:
                Serial.println("Status: Person Detected ✓");
                break;
            case NOONE:
                Serial.println("Status: No Person Detected");
                break;
            case HEARTRATEVAL:
                Serial.print("Heart Rate: ");
                Serial.print(radar.heart_rate);
                Serial.println(" BPM");
                break;
            case BREATHVAL:
                Serial.print("Breath Rate: ");
                Serial.print(radar.breath_rate);
                Serial.println(" breaths/min");
                break;
            case SITUATION:
                Serial.print("Distance: ");
                Serial.print(radar.distance);
                Serial.println(" cm");
                break;
        }
        Serial.println("-------------------");
    }
    delay(200);
}
=================================
Complete Health Monitor v1.0
=================================

--- Health Data ---
Status: Person Detected ✓
-------------------

--- Health Data ---
Heart Rate: 72 BPM
-------------------

--- Health Data ---
Breath Rate: 16 breaths/min
-------------------

--- Health Data ---
Distance: 45 cm
-------------------

Example 6: Sleep Monitoring

Track sleep quality and breathing patterns during rest.

📄 sleep_monitor.ino
#include <60ghzbreathheart.h>

#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 3);
    #define SerialInit mySerial
#endif

#ifdef ESP32
    #define SerialInit Serial1
#endif

BreathHeart_60GHz radar = BreathHeart_60GHz(&SerialInit);

void setup() {
    Serial.begin(115200);
    SerialInit.begin(115200);
    
    Serial.println("Sleep Monitor Started");
    Serial.println("Place sensor 30-50cm from person");
    delay(500);
}

void loop() {
    radar.recvRadarBytes();
    
    if (radar.sensor_report != 0x00) {
        switch (radar.sensor_report) {
            case BREATHVAL:
                Serial.print("Sleep Breath Rate: ");
                Serial.print(radar.breath_rate);
                Serial.print(" | Quality: ");
                if (radar.breath_rate >= 12 && radar.breath_rate <= 20) {
                    Serial.println("Normal");
                } else if (radar.breath_rate < 12) {
                    Serial.println("Slow (Deep Sleep)");
                } else {
                    Serial.println("Fast (Light Sleep)");
                }
                break;
            case SOMEONE:
                Serial.println("Person in bed detected");
                break;
            case NOONE:
                Serial.println("Bed empty");
                break;
        }
    }
    delay(1000); // Check every second
}
Sleep Monitor Started
Place sensor 30-50cm from person
Person in bed detected
Sleep Breath Rate: 14 | Quality: Normal
Sleep Breath Rate: 10 | Quality: Slow (Deep Sleep)
Sleep Breath Rate: 15 | Quality: Normal
Sleep Breath Rate: 22 | Quality: Fast (Light Sleep)

Code Explanation

Library Import: Include the 60ghzbreathheart.h library for sensor communication
Serial Configuration: Set up software or hardware serial based on your board (AVR/ESP32)
Radar Object: Create a radar object to handle sensor data
Data Reception: Use radar.recvRadarBytes() to receive data from sensor
Data Processing: Parse sensor reports using switch-case statements

Sensor Report Types

  • HEARTRATEVAL: Heart rate measurement in BPM
  • BREATHVAL: Breathing rate in breaths per minute
  • SOMEONE: Person detected in range
  • NOONE: No person detected
  • SITUATION: Distance and movement data
  • NONEPSE: No presence status

Testing the Sensor

  1. Upload the code to your Arduino board
  2. Open the Serial Monitor in the Arduino IDE
  3. Set the baud rate to 115200
  4. Observe incoming data from the MR60BHA1 sensor

Depending on the sensor's configuration, you should see motion detection data or distance measurements being streamed in real-time.

Conclusion

The MR60BHA1 mmWave sensor is a powerful and compact module for detecting motion and measuring distances with exceptional accuracy. When paired with an Arduino, it becomes an invaluable tool for a wide variety of applications.

By following this comprehensive guide, you can easily set up the sensor, update its firmware, and start experimenting with millimeter-wave radar technology in your projects.

🚀 Happy Coding!

0 comments:

Post a Comment