ESP32

C4001 mmWave Human Detection Sensor with Arduino and ESP32

C4001 mmWave Human Presence Sensor:

C4001 mmWave Human Detection Sensor with Arduino and ESP32- Today, I am pushing the DFrobot C4001 mmWave sensor to its absolute limits! Can it detect through walls, boxes, glass, or even under a ceiling fan? Let’s find out!

C4001 mmWave human detection sensor with arduino and esp32

I personally found the DFrobot C4001 mmWave Human Presence Sensor quite impressive because it supports I2C and UART communication methods and is compatible with Arduino, ESP32, ESP8266, and Raspberry Pi development boards. And that’s not all—it has a human presence detection range of 8 meters and a motion detection and ranging range of 12 meters.

allpcb circuit

And let me tell you, the C4001 mmWave Sensor is entirely different from the C1001 mmWave Sensor.




We will use the C4001 mmWave sensor with both Arduino and ESP32. We will cover a total of four examples:

  1. Monitoring speed and velocity
  2. Using a filter to stabilize the values
  3. Implementing it for home automation and
  4. Monitoring the sensor using the Blynk application

After making the C4001 mmWave sensor fully functional, I will perform various tests on it. For example:

  • Will the C4001 mmWave sensor work properly under a fan? Many people have already requested this test. It’s going to be mind-blowing if this sensor functions well directly under strong airflow.
  • Can it detect people through;
  • Fabric
  • Boxes
  • Hardboards
  • Wood
  • Plastic and
  • Glass?
  • And finally; the ultimate test – human detection through walls!

For performing these tests I will be using my designed ESP32 Development board and Arduino Nano Development board.

You can download the projects source codes and related material from my Patreon Page.

So, without any further delay let’s get started!!!



Amazon Links:

C4001 mmWave Human Presence Sensor

ESP32 Dev Module

Arduino Nano USB C type (Recommended)

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Human detection:

Feature

Millimeter-wave Presence Sensor Infrared Sensor
Sensing Principle TOF radar principle + Doppler radar sensing (active detection) Pyroelectric infrared sensing (passive radiation)
Motion Sensitivity Can detect presence, slight movement, and motion of the human body Can only detect motion and close-range slight movement of the human body
Sensing Range Can be adjusted to different sensing distances Sensing range cannot be adjusted
Environmental Temperature Impact Not affected by environmental temperature Sensitivity decreases when temperature is close to human body temperature
Application Environment Not affected by heat sources, light sources, or air flow Susceptible to heat sources and air flow
Penetration Ability Can penetrate fabrics, plastics, glass, and other insulating materials Can only penetrate some transparent plastics
Distance Measurement Support Yes No

Unlike traditional infrared sensors, The C4001Millimeter Wave Presence Sensor utilizes a combination of TOF radar and Doppler radar sensing principles for active detection.

It can accurately detect human presence, slight movements, and body motion, making it highly effective for applications requiring precise monitoring.

One of its standout features is its adjustable sensing range, allowing customization based on specific needs.

Additionally, it has strong resistance to environmental factors, remaining unaffected by temperature changes, heat sources, light variations, and airflow.

A key advantage of this sensor is its penetration ability, enabling it to detect human presence through fabric, plastic, glass, and other insulating materials.

Moreover, it supports distance measurement, adding versatility to its functionality.



Installation Methods

installation method of C4001 mmWave sensor

The performance of a millimeter-wave human body sensor depends on proper installation, as incorrect placement can impact its accuracy and functionality.

The commonly used installation methods for this module include top installation, bottom installation, horizontal installation, and downward tilted installation.

Specifications of C4001 mmWave Sensor:

C4001 mmWave sensor fmcw modulation speed and distance

The C4001 mmWave presence sensor uses FMCW modulation to measure both distance and speed. It can detect objects up to 12 meters away and track motion speeds ranging from 0.1 to 10 meters per second.

The C4001 millimeter-wave human presence sensor operates on a 3.3V or 5V power supply, making it compatible with various microcontrollers.

Operating Voltage: 3.3V/5V

Maximum Detection Range: 12m

Beam Angle: 100*80°

Modulation Mode: FMCW

Operating Frequency: 24GHz

Operating Temperature: -40~85℃

Baud Rate: 9600

I2C Address: 0x2A/0x2B

Size: 22*30mm

C4001 mmWave sensor onboard components and interfaces

+ is the Power, – is the Ground, C/R is I2C Clock Line or RX, and D/T is the I2C Data Line or TX.

It comes with a Gravity-4P I2C/UART Sensor Connector.

It features a switch labeled “I2C/UART”, allowing me to toggle between I2C and UART communication based on my setup. Right next to it, there is another switch for selecting the I2C address (0x2A or 0x2B), which is useful when using multiple sensors on the same I2C bus.

Right now, I have set it to I2C mode. The advantage of this is that I don’t have to change the pins in the code for Arduino or ESP32. But if I select UART communication, I would have to change the pins every time. So, I will use I2C communication.

And let me tell you all the programs I am going to share with you will work on both Arduino and ESP32 without any changes.



Features

  • Communication Methods: It supports two communication methods, I2C and UART.
  • Interface: It uses the Gravity interface (PH2.0).
  • Human Detection: It can detect the presence of humans up to 8 meters and detect human motion up to 12 meters.
  • Distance Detection: It can measure distances from 1.2m to 12m.
  • Speed Detection: It can detect speeds from 0.1m/s to 10m/s.
  • Strong anti-interference capability: It is not affected by factors such as snow, haze, temperature, humidity, dust, light, and noise.
  • Compact size and easy integration.

Applications

  • Human Detection
  • Distance and Velocity Detection
  • Environmental Monitoring
  • Industrial Automation
  • Real-time Monitoring and Tracking

C4001 mmWave Sensor with Arduino:

C4001 mmWave sensor interfacing with arduino

Connect the Red and Black wires to the Arduino 5V and Gnd. Connect the Blue wire to the Arduino A5 and the other wire to A4 pin on the Arduino. A4 is the SDA and A5 is the SCL.

The 5V buzzer is connected to the Arduino digital pin 8. For the connections you can follow this circuit diagram.

5v buzzer wiring with arduino for C4001 mmWave

Right now, I can’t permanently fix the C4001 mmWave sensor because I need to perform multiple tests on it. So, that’s why I temporarily attached it to a mobile stand using double tape.

C4001 mmWave sensor installation

And let me tell you; It should be at least 1.5 meters above the floor. Now, let’s go ahead and take a look at the programming.




Install required library:

First, you need to install the DFRobot_C4001 library. To do this, go to the product’s wiki page and download the library from there. I have already downloaded it.

Next, go to the Sketch menu…then to Include Library…and click Add .ZIP Library.

Finally, select the folder and then click the open button.

Example1:

I downloaded this code from DFRobot’s Wiki page. You can also find the code for UART communication on the same page.

At first glance, this code might look a bit confusing, but it’s actually not that complicated. Once you read through it, you will understand it better. In the next examples, I have simplified the code significantly.

Code:



Practical Demonstration:

Look at the screen—Target Number, Target Speed, Target Range, and Target Energy—all updating in real-time!

C4001 mmWave speed velocity distance and target energy measurement

When I move towards the mmWave sensor, the Target Speed value shows a negative sign. But the moment I move away, the negative sign disappears!

From the Target Range value, you can already tell how accurate this sensor is!

And here’s the real game-changer; Target Energy! The more I move, the higher this value goes.

Example 2:

You might have noticed that the values were fluctuating a lot. So this time, we will use a filter to make the values more stable, and along with that, we will also use a timer. We will also define the range to check how accurate the sensor is.

C4001 Stable Value and Distance Program:



Code Explanation

As you can see, I have simplified the code. The buzzer is connected to digital pin 8.

I have also defined a 600ms delay, meaning the buzzer will only turn OFF when no human is detected for 600ms.

For now, you can see that I have set the minimum distance to 30cm and the maximum distance to 1200cm (12 meters full range). The threshold value is set to 10. You will understand the C4001 mmWave sensor better when you experiment with different values.

Additionally, I have used a filter to stabilize the targetRange value.

The buzzer will only turn ON if the person’s distance is between 0.4 and 5.0 meters.

Otherwise, the buzzer will remain OFF.

As you can see, I have used a timer, so the buzzer will turn OFF only when there is no detection for 600ms.

I have already uploaded this program and now let’s watch the C4001 mmWave sensor in action.



Practical Demonstration:

room security system using C4001 mmWave

Right now, I am outside the room, and the buzzer is OFF. Now, I am about to enter the room; let’s see if the buzzer turns ON or not. For practical demonstration watch the video tutorial given at the end of this article.

C4001 mmWave sensor detected me as i entered the room

Amazing! We have successfully used the C4001 mmWave sensor to turn the buzzer ON. The buzzer will remain ON as long as I stay within the defined range.

This, in itself, works as a security system; as soon as someone enters the room, the buzzer turns ON. By using the same code, you can also control lights. In a little while, we will also test it with a light.

Now, let’s try a different range.

I have set the maximum detection range to 300cm (3 meters) and also set the target range to 3 meters.

It limited the sensor’s detection range as per our preference. Similarly, you can also set your own custom range as needed.

In the next two examples, we will be using the ESP32. So now, it’s your choice whether you want to use an Arduino or the ESP32 WiFi + Bluetooth module.




C4001 mmWave Sensor with ESP32:

Connect the Red and Black wires of the C4001 mmWave Sensor to the ESP32’s 3.3V and GND pins.

Connect the Blue wire to GPIO22 and the other wire to GPIO21.

The 5V SPDT type relay is connected to the GPIO13. For the relay connections you can follow this circuit diagram.

spdt type 5v relay driver circuit diagram for C4001 mmWave

Now, let’s go ahead and take a look at the programming.



C4001 mmWave ESP32 Relay Program:

Code Explanation:

The relay is connected to GPIO13. To further eliminate fluctuations, this time I am using two timers.

We could still use the previous code, but this is another approach where we can control the ON time and adjust the scan time.

Everything else is almost the same. The main purpose of this example is to demonstrate how to use the C4001 mmWave sensor with the ESP32 and show you how to control a light.



Practical Demonstration:

control a light using C4001 mmWave sensor

As you can see while I am outside the Sensor’s range, the light is OFF.

how to control a light using C4001 mmWave

This time, the relay didn’t turn ON instantly. First, the C4001 mmWave sensor detected my presence for a few seconds, and only then did it turn the relay ON.

Now, the light will remain ON as long as I stay in this area.

When I leave the area, the C4001 mmWave sensor will scan the area for a few seconds, and if no movement is detected, it will turn the light OFF.

Now, it’s your choice whether you want to use the buzzer-based code or this one.



C4001 mmWave with ESP32 & Blynk:

Next, we will use the C4001 mmWave sensor with the Blynk application. With Blynk, we can monitor the C4001 sensor from anywhere in the world.

In my previous article and video, I set up Blynk for a Tilt sensor, and I will be using the same application for this project.

blynk application for the C4001 mmWave

As you can see, I have named the device C4001 mmWave.

If I go to Datastreams, you will see that I am using the same virtual pin V0, but this time, I have changed its Data Type to Double.

C4001 mmWave and blynk

That’s it! If you still find it difficult, I recommend watching my previous video on the 360-degree Tilt sensor or you can also read the article.

If I open the ESP32 code, you will see that I am using the same Template name, ID, and authorization token.

I have also included a watchdog timer, so you won’t need to manually restart the ESP32 if it freezes.

The rest of the code is simple and straightforward. If you read it carefully, you will understand it easily.

And if you are using ESP32 and Blynk for the first time, I highly recommend watching my getting started video on ESP32 and Blynk V2.0.




Practical Demonstration:

With the Blynk application, I can now monitor the C4001 mmWave sensor in real time from anywhere in the world.

C4001 mmWave sensor in an iot project

You can build a highly reliable security system that you can monitor from your Smartphone. And if you have a paid Blynk plan, you can even generate alert messages.

By now, you should have a good idea of how easily the C4001 mmWave sensor can be used with Arduino and ESP32.

Tests on C4001 mmWave Sensor:

Now, we are going to perform some tests, and after that, you can decide for yourself whether you should use the C4001 mmWave sensor or not.

Cardboard Box:

First, I am going to start with this cardboard box, and then we will gradually increase the complexity. I am using my 4S Lithium Ion battery pack to power up the Arduino Nano Development board.

C4001 mmWave sensor inside a box first text

So, let’s see if it can detect me.

C4001 mmWave sensor inside a box

It detected me so easily from inside the box. I didn’t stop here. I put three more boxes in front of it; and it still detected me without any issues.

C4001 mmWave sensor can detect humans through cardboard sheets and boxes

This is crazy! I can’t stop myself from testing one more Box, but this time I am going to do something different.

C4001 mmWave human detection through material

Finally, this giant box! Inside this box, there’s a dinner set “a lot of stuff inside”. Let’s see if the C4001 can still detect me through all these five boxes.

C4001 mmWave sensor mind blowing test

The range has reduced, likely because there’s a lot of stuff inside the box. When I’m close to the table, it detects me perfectly, but as I step back, the C4001 can’t detect me anymore. The first test was super impressive!



Human Detection through Hardboard:

C4001 mmWave sensor hardboard test

Next up, we are taking the challenge to the next level—testing it with this hardboard sheet! The sensor is facing downward, and the real question is… can it detect my foot movement through the board? This could be a game-changer for hidden security and smart automation! Let’s find out!

C4001 mmWave sensor detect me through the hardboard sheet

It was like a piece of cake for the C4001 mmWave Sensor. This is so incredible, we can use it inside Drawers to protect Jewelry, money, etc from being stolen.  



C4001 mmWave Sensor Detection through Glass:

C4001 mmWave sensor human detection through a glass

Can the C4001 mmWave sensor detect me through glass? This could be a game-changer for security systems in shops and offices! But here’s the real challenge—I haven’t placed it directly against the glass. I left some distance to truly push its limits. Will it pass or fail? Let’s find out!

human detection through glass using C4001 mmWave

This is absolutely mind blowing. I didn’t see any change in the range. You can use this behind a mirror in a Washroom/Bathroom to control the lights automatically. Hundreds of ideas are popping up in my mind. What’s in your mind? Let me know in the comment.



Human Detection through Plastic:

This time, I have placed a plastic case in front of the mmWave sensor. I’m sure it won’t have any trouble penetrating it and detecting my presence.

C4001 mmWave inside a plastic box enclosure

It detected me as if there is nothing in front of the C4001 mmWave sensor. From this test its obvious that we can use it in any plastic enclosure, this way we can make it waterproofed and then we can use it outside for security purposes or for controlling lights. There are more than a thousand ways it can be used. So, it’s up to you; how you plan to use it. Best of Luck!

Human Detection through Curtains “Fabric”:

Can this mmWave sensor see through a curtain?

human detection through cloth fabric curtains using C4001 mmWave

There’s quite a distance between the sensor and the curtain; so let’s put the C4001 mmWave to the test. Will it detect me even when I am completely hidden?

Just imagine… A sensor so powerful that it can detect movement without even seeing you! This could change the game for security systems, smart automation, and even futuristic tech!

Let’s find out!

C4001 mmWave sensor detection me from behind the curtain

This is absolutely mind blowing; This tiny sensor just proved; it can detect movement through fabric! Imagine the possibilities—security systems, hidden monitoring, and more! What would you use this for? Let me know in the comments!




Detection through a Wood door:

Can the C4001 mmWave Sensor penetrate this door and still detect me on the other side?

C4001 mmWave sensor door test

If it detects me, I’ll be seriously impressed!

As you can see, the sensor is quite far from the door. The real question is—can it still penetrate through and detect me on the other side? Let’s find out!

human detection behind a door using C4001 mmWave

The C4001 mmWave sensor just shocked me! Even from a distance, it successfully detected my presence through the door!

Now imagine the possibilities; you can detect if someone is standing outside your room, create a contactless doorbell, or even build a completely invisible security system!



mmWave Sensor under a Fan:

Can It Survive Under a Ceiling Fan?

C4001 mmWave sensor under a running ceiling fan

Many people complain that mmWave sensors struggle under direct airflow; so let’s put that to the test!

The C4001 mmWave sensor is right under a running ceiling fan; the airflow is strong, and if this sensor is truly reliable, it should still detect me without false triggers.

So what’s going to happen? Will it detect me accurately, or will the airflow confuse it? Let’s find out!

Drop your predictions in the comments before we begin! Do you think this sensor can handle it, or will it fail?

C4001 mmWave sensor test under a running ceiling fan

The fan is running at full speed, and I am standing outside the sensor’s range. The buzzer has been OFF for the last 3 minutes—no false triggering at all!

But now comes the real challenge!

I am about to step closer to the C4001 mmWave sensor—will it detect me accurately despite the strong airflow? Or will it fail like most other mmWave sensors? Let’s find out!

C4001 mmWave sensor works under a running ceiling fan

This is unbelievable! Most mmWave sensors struggle under direct air contact, but the C4001 is rock solid! This sensor is on a whole new level!



C4001 mmWave Sensor Detection through a Wall:

The Ultimate Challenge:

Can this mmWave Sensor Detect through Walls?

We have tested it through curtains… We have tested it through a Door… we have tested it under a running ceiling fan… but now comes the final and most insane test yet; human detection behind a wall!

human detection behind a wall using C4001 mmWave sensor

I am going to step behind this wall; behind this hardboard sheet is a brick wall. Let’s see if the C4001 mmWave sensor can still detect me.

C4001 mmWave sensor for human detection behind a wall

It’s NOT detecting me!

So, here is the reality; the C4001 mmWave sensor works great through most of the materials, but it struggles with solid walls. This is something you should definitely keep in mind when using it for security applications.

Not all mmWave sensors are the same—some are built for ultra-penetration, while others are designed for short-range detection. So, always test before you build!

Well if you are specifically looking for a sensor that can detect humans behind a wall then you should read my article on a Microwave sensor that can detect Humans behind the walls.

So, that’s all for now.

Support me on Patreon for more articles and videos.



Watch Video Tutorial:

 

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.