mmWave Human Detection Sensor Kit. Unable to use Serial1 in sketch

I bought the mmWave Human Detection Sensor Kit, and it works well with the default firmware on the ESP32C3. When I try to load my own code onto the ESP32, the upload completes, but the device get stuck, waiting for “USB download”:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x0 (USB_BOOT)
Saved PC:0x400462dc
wait usb download

I have narrowed the issue down to opening of the Serial1 connection, in setup():

Serial1.begin(115200);

If I comment this line out, the ESP32 run the code as expected, but of course the communication with the sensor module do not work.

I have tried with both the default sensor (Human Static Presence Module Lite), the MR60FDA1 module and the MR60BHA1 module, and the issue is the same on all 3 modules.

Do I need to use SoftwareSerial instead, or what am I doing wrong, since all the example code snippets do not work?

Complete code, that generates the issue:

#include "Arduino.h"
#include <humanstaticLite.h>

HumanStaticLite radar = HumanStaticLite(&Serial1);

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);

  while(!Serial); 
  Serial.println("Readly");
}

void loop() {
  radar.recvRadarBytes();  
  radar.showData();   
  delay(200);
}

Hi there,
It’s a bit finicky the ESP32 , may need to press reset a couple times to get right.
FIrst be sure it’s in waiting for Download mode (DFU) before you hit upload and that the correct port is selected (they will change from DFU mode to normal)
Software serial is what you’ll need to use unless it’s connected to the second REAL serial port.
It’s not on the ESP32C3 (connections to it are on the bottom)
Pro tip: USE the SoftSerial and always NAME the PINS and Set the Word & Buad Rate BEFORE you do the “BEGIN SERIAL 1” INIT.
HTH
GL :slight_smile: PJ

I have a GPS demo on here that uses the Softserial. Check that code also.
:v:

Thanks a lot for the reply. I managed to get it working, using SoftwareSerial:

#include "Arduino.h"
#include <humanstaticLite.h>
#include <SoftwareSerial.h>

#define RX_Pin A2
#define TX_Pin A3

SoftwareSerial mySerial(RX_Pin, TX_Pin);
HumanStaticLite radar(&mySerial);

const unsigned char DevID_buff[10] = {0x53, 0x59, 0x02, 0xA2, 0x00, 0x01, 0x0F, 0x60, 0x54, 0x43};

void setup() {
  Serial.begin(115200);
  mySerial.begin(115200);

  while(!Serial);  

  Serial.println("Ready");
}

void loop() {
  radar.HumanStatic_func(true);  
  if(radar.radarStatus != 0x00){
    switch(radar.radarStatus){
      Serial.println(radar.radarStatus);
      case SOMEONE:
        Serial.println("Someone is here.");
        Serial.println("---------------------------------");
        break;
      case NOONE:
        Serial.println("Nobody here.");
        Serial.println("---------------------------------");
        break;
      case NOTHING:
        Serial.println("No human activity messages.");
        Serial.println("---------------------------------");
        break;
      case SOMEONE_STOP:
        Serial.println("Someone stop");
        Serial.println("---------------------------------");
        break;
      case SOMEONE_MOVE:
        Serial.println("Someone moving");
        Serial.println("---------------------------------");
        break;
      case HUMANPARA:
        Serial.print("The parameters of human body signs are: ");
        Serial.println(radar.bodysign_val, DEC);
        Serial.println("---------------------------------");
        break;
      case SOMEONE_CLOSE:
        Serial.println("Someone is closing");
        Serial.println("---------------------------------");
        break;
      case SOMEONE_AWAY:
        Serial.println("Someone is staying away");
        Serial.println("---------------------------------");
        break;
      case DETAILMESSAGE:
        Serial.print("Spatial static values: ");
        Serial.println(radar.static_val);
        Serial.print("Distance to stationary object: ");
        Serial.print(radar.dis_static);
        Serial.println(" m");

        Serial.print("Spatial dynamic values: ");
        Serial.println(radar.dynamic_val);

        Serial.print("Distance from the movement object: ");
        Serial.print(radar.dis_move);
        Serial.println(" m");
        
        Serial.print("Speed of moving object: ");
        Serial.print(radar.speed);
        Serial.println(" m/s");
        Serial.println("---------------------------------");
        break;
    }
  }
  delay(1000);
}
1 Like

@ a boy :clap: :smile: You were there the whole time.
so be sure to mark it the solution , So others searching can find it.
Great Work!
GL :slight_smile: PJ

How does this sensor differentiate between humans and animals/objects?

Hi there, these all work from the same radar wave principle,
" millimeter-wave radar sensor can accurately detect the presence of people, even with slight movements."
HTH
GL :slight_smile: PJ :v: