mmWave-C4001 24Ghz Human Presence Detection Sensor Documentation
The mmWave-C4001 is a 24 GHz human presence detection sensor that uses mmWave technology to detect and track the presence of humans in a specific area. It is a highly accurate and reliable sensor suitable for various IoT applications, including smart homes, security systems, and industrial automation.
Frequency: 24 GHz
Range: Up to 10 meters
Accuracy: 1 cm
Power supply: 3.3 V - 5 V
Communication interface: UART, I2C, or SPI
Operating temperature: -20C to 70C
The mmWave-C4001 has a 12-pin interface with the following pinout:
| Pin | Function |
| --- | --- |
| 1 | VCC (3.3 V - 5 V) |
| 2 | GND |
| 3 | TX (UART) |
| 4 | RX (UART) |
| 5 | SCL (I2C) |
| 6 | SDA (I2C) |
| 7 | SCK (SPI) |
| 8 | MOSI (SPI) |
| 9 | MISO (SPI) |
| 10 | CS (SPI) |
| 11 | Interrupt |
| 12 | Reset |
### Example 1: Using the mmWave-C4001 with an Arduino Board (UART Interface)
In this example, we will use an Arduino Uno board to communicate with the mmWave-C4001 sensor using the UART interface.
```c++
#include <SoftwareSerial.h>
#define RX_PIN 2 // RX pin of the mmWave-C4001
#define TX_PIN 3 // TX pin of the mmWave-C4001
SoftwareSerial mmWaveSerial(RX_PIN, TX_PIN);
void setup() {
Serial.begin(9600);
mmWaveSerial.begin(115200);
}
void loop() {
mmWaveSerial.write("AT+ GetData");
delay(100);
String data = mmWaveSerial.readStringUntil('
');
int distance = data.substring(12, 15).toInt();
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(500);
}
```
### Example 2: Using the mmWave-C4001 with a Raspberry Pi (I2C Interface)
In this example, we will use a Raspberry Pi to communicate with the mmWave-C4001 sensor using the I2C interface.
```python
import smbus
bus = smbus.SMBus(1) // I2C bus number
mmWaveAddress = 0x1A // I2C address of the mmWave-C4001
def get-distance():
data = bus.read_i2c_block_data(mmWaveAddress, 0x00, 6)
distance = (data[3] << 8) + data[4]
return distance
while True:
distance = get_distance()
print("Distance: ", distance, "cm")
time.sleep(0.5)
```
### Example 3: Using the mmWave-C4001 with an ESP32 Board (SPI Interface)
In this example, we will use an ESP32 board to communicate with the mmWave-C4001 sensor using the SPI interface.
```c++
#include <SPI.h>
#define SPI_CS 5 // CS pin of the mmWave-C4001
#define SPI_CLK 18 // CLK pin of the mmWave-C4001
#define SPI_MOSI 23 // MOSI pin of the mmWave-C4001
#define SPI_MISO 19 // MISO pin of the mmWave-C4001
void setup() {
spi.begin(SPI_CS, SPI_CLK, SPI_MOSI, SPI_MISO);
Serial.begin(115200);
}
void loop() {
spi.transfer("AT+ GetData");
delay(100);
uint8_t data[6];
spi.transfer(data, 6);
int distance = (data[3] << 8) + data[4];
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(500);
}
```
Note: In all examples, make sure to connect the mmWave-C4001 to the corresponding pins on the development board, and ensure that the power supply voltage and communication interface match the sensor's specifications.