I am trying to interface NodeMCU with RCWL-0516 Microwave Radar Sensor and power it via battery. Below is the circuit diagram

enter image description here

Below is the Arduino Code I am using :

int Status = 12;  // Digital pin D6

int sensor = A0;  // Analog pin A0

void setup() {
  // put your setup code here, to run once:
   pinMode(sensor, INPUT);   // declare sensor as input
   pinMode(Status, OUTPUT);  // declare LED as output


void loop() {
  // put your main code here, to run repeat edly:
    long state = analogRead(sensor);
    if(state >= 200) {
      digitalWrite (Status, HIGH);
      Serial.println("Motion detected!");
    else {
      digitalWrite (Status, LOW);
      Serial.println("Motion absent!");


Now with this circuit I am facing following issues :

1) Radar Sensor keep getting triggered and the led keeps getting on and off (When I replace radar sensor with PIR HC-sr501 sensor it starts working normally. I suspect there is some interference between NodeMCU wifi signal and doppler wave)

2) No matter if I use PIR Sensor or radar sensor the battery last for only few hours and after it goes below 5.5V sensors stop working.

So, how can I make radar sensor and NodeMCU work together with battery without false triggering and how can I make it work for 2-3 days without changing battery?


When I power NodeMCU with USB then radar sensor is working fine. (So I don't think there is interference of NodeMCU with Microwave Sensor). Below is the circuit digram with NodeMCU powered by USB. Why there is constant trigger when NodeMCU is powered by battery?

enter image description here

Link of data-sheet of Radar Sensor


closed as too broad by Chris Stratton, RoyC, Oleg Mazurov, Chetan Bhargava, Axeman Aug 23 at 13:28

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Without a full data sheet for the radar sensior this is unanswerable and will probably have to be closed. You code shows no effort to reduce power consumption and only operate when needed, so even apart from the sensor the constant power consumption on the MCU should be expected to result in short battery life. Creating battery powered systems is practucally hard even for the experienced, you do not seem to have given power conservation any thought. \$\endgroup\$ – Chris Stratton Aug 20 at 12:29
  • \$\begingroup\$ @ChrisStratton Data sheet added. BTW, RCWL-0516 is very well known sensor and its data-sheet can be easily found. \$\endgroup\$ – Abhishek Kumar Aug 20 at 12:53
  • \$\begingroup\$ While better than nothing, that is not a data sheet, it's a writeup of some other hobbyist's reverse engineering effort. Critically, it has no statement of transmit or idle power consumption. It seems your problem may be power related, 9v radio batteries are notoriously weak, so perhaps try 5 or 6 alkaline AA cells. But the issue remains that you cannot expect reasonable battery life without careful engineering to make your project sleep in a micramp current range and only wake up occasionally to take a measurement. That is far too broad a topic to cover here. \$\endgroup\$ – Chris Stratton Aug 20 at 13:07
  • \$\begingroup\$ At a basic level, you might ask: do you see many battery powered microwave motion detectors being offered for sale? If not, there is probably a reason, such as that it's not really a combination which works well. And even if it is possible with some devices, there's no indication that your sensor is designed for battery power, that it has a way to put it in a suspend mode, or that it will work very well if you use a power switch chip to turn it on briefly before turning it back off again. \$\endgroup\$ – Chris Stratton Aug 20 at 13:09
  • \$\begingroup\$ @ChrisStratton when I power NodeMCU with USB, still radar sensor is powered by battery but its working ok. \$\endgroup\$ – Abhishek Kumar Aug 20 at 13:18

Using Power Bank for Power supply via USB and following the below circuit resolved the issue

enter image description here

  • \$\begingroup\$ It won't work for very long on a powerbank - the whole idea remains relatively impractical and useless. \$\endgroup\$ – Chris Stratton Aug 20 at 15:08
  • \$\begingroup\$ Whether it will work long or not depends on the type of power bank in use. Without knowing that you shouldn't come to conclusion and vote down the answer @Chris \$\endgroup\$ – Abhishek Kumar Aug 20 at 15:32
  • \$\begingroup\$ Wrong again - no power bank will run it all that long. What you have is fundamentally not engineered for battery power. Fix that, don't throw a huge battery at it just to get a week. \$\endgroup\$ – Chris Stratton Aug 20 at 18:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.