jdesbonnet / RCWL-0516

Information about RCWL-0516 microwave proximity switch module (ICStation.com SKU 10630)
733 stars 107 forks source link

False triggers #2

Open mariusb57 opened 7 years ago

mariusb57 commented 7 years ago

I used this sensor with a esp8266 and i have a lot of false triggers. Seems to be strongly affect by the wireless network , in general , by strong electromagnetic fields . I tried to place him at a considerable distance from esp8266 and I used a lot of decoupling capacitors. Sure that the false switching operations were far fewer . I would like to know if anyone met this problem and how to solve it . If I mount a metalic shield on the back of the sensor, may this affect its detection properties ? Thanks .

starfish1107 commented 6 years ago

@barewires yes, you are perfectly right concerning the diode - it was a quick and dirty solution - I am no longer using this circuit. The double LC-filter below showed much better results.

dbk3r commented 6 years ago

i try'd a lot , but only a metal plate (1.5 mm) between sensor and d1 mini and a pi filter fixed it. Now 6 month without any false trigger. Maybe that helps :-)

dnoha commented 6 years ago

@dbk3r esp must be oriented towards wifi router. If you put metal plate and sensor behind, it means that sensor will not detect movement behind metal plate, so direction towards wifi router is blind spot ?

dnoha commented 6 years ago

@jeraymond - I found another reason for these false triggers. I noticed, that the setup usually works fine at the beginning but getting worse after a while. I took one of the sensor-pcbs from the trash, connected it. As expected it produced a lot of false signals. Then I washed the sensor print with pcb-cleaner spray. Believe it or not, after drying, it worked as the "virgin" new ones - no more false trigger sigs. Could you (or someone else) verify this?

@jeraymond still working ok?

If I don't have "PCB cleaner" can alcohol, acetone, nitro, gasoline, detergent or something handy help washing ?

underwoodblog commented 6 years ago

@dnoha alcohol works fine. I use a toothbrush with alcohol or pcb cleaner to remove all flux and compressed air to blow it dry/clean.

starfish1107 commented 6 years ago

@dnoha still working ok?

touch wood - until now the units are still working correctly. I am afraid it was rather "homemade" conducting remainings or fingerprints I was washing away.

starfish1107 commented 6 years ago

i try'd a lot , but only a metal plate (1.5 mm) between sensor and d1 mini and a pi filter fixed it. Now 6 month without any false trigger. Maybe that helps :-)

@dbk3r where did you ground the metal plate (if...)

dnoha commented 6 years ago

I tried almost all suggestions from above, but nothing seems to work. My node is in plastic distribution box 10x10 cm, which has nodemcu and RCWL inside, and powerbank outside which run both of them now. Node is at edge of wifi area (low signal) but works. I noticed only that when I power it up that I have many false triggers next 3-5 minutes, then nothing for hours. I tested this multiple times with same result. Also at some period at evening from 18-20h there is usually quite much false triggers. Other part of day are ok. There is no neighbors in over 150m, so there is no other wifi except mine.

As I can see ESP and RCWL do not go togeher. So for last two days I removed RCWL module outside box hanging on 15 cm cables. There was no false triggers.

Metal plate between is not option for me if I lose monitoring of one blind spot behind metal plate.

Now I'm thinking to setup node with RFM69 transmission to some kind of gateway. This has many advantages (range, power consumption, less devices on wifi, etc.), but adds quite much complexity to project, especially for noobs. Maybe someone have already tried this combination or have some pointers or tutorials so we don't loose much time on this?

Maybe simple RF433 Mhz is better option than RFM69. Or maybe NRF24L01? I have couple of RFM69 so I would like best to use those.

dbk3r commented 6 years ago

i try'd a lot , but only a metal plate (1.5 mm) between sensor and d1 mini and a pi filter fixed it. Now 6 month without any false trigger. Maybe that helps :-)

@dbk3r where did you ground the metal plate (if...)

i did not grounded the plate . i isolated it and stitched it between sensor and esp, quick and dirty like :-)

starfish1107 commented 6 years ago

I still have some combinations of different makes of ESP and RCWL showing false triggers, maybe due to production tolerances or different productions. Some of them work without further problems some not. I earlier found that using 2 different power supplies is almost everytimes the best solution. That implies that -at least here- the direct rf-radiation is not the problem. Therefore I experimented with power supply noise blocking improving the pi-filter suggested by ym58. bewegungssensor this circuit showed considerable better results even with problematic modules. the l-c combinations are probably not optimised, I just took what I had in my scrap box. Edit dec. 8th: I increased the capacitors to 470 uF. When using inductors with low dc resistance like this one 1mH - 420mA - 1,989Ohm - CDRH105RNP-102NC its even possible to use the Wemos USB plug for power supply. No more false triggers with all the 8 motion sensors I built until now. img_20181208_090934

jeraymond commented 6 years ago

@starfish1107 when you say you use two different power supplies do you mean using two different voltage regulators one for each device whose ground are connected at some point?

starfish1107 commented 6 years ago

firefox_screenshot_2018-11-29t08-08-26 332z @jeraymond excactly. Ground has to be common, except when using optocouplers of course. this would have been the next step - but actually I dont think this is needed. Last night I had a record showing no false pulses for 8 hours. additionally I compare with a PIR-sensor in the same room. There are big quality differences between the rcwl modules. One of them was even self-oscillating without a esp-module being connected.
the yellow line is the actual module which showed heavy misrepresentation before.

slq32 commented 5 years ago

Got a quite similar (or maybe weirder) problem. I use the module connected to a Raspberry Pi 3B+, powered from the RPI board and output connected to a pulled down GPIO. I use the setup to detect motion at an entrance door (metal door). The sensor, camera and a ring button are on the outside and the RPI is on the inside, connected by a 15cm UTP unshielded cable. If the sensor detects motion the camera records a 10 second video, and if someone pushes the ring button, i get a notification. Now comes the funny part: when i power the RPI from a battery pack everything is very stable, no false reading whatsoever. However my design is to power the whole thing from a 12V, battery backed up power source, go with 12V via a ~2.5m cable and use a converter to step down the voltage to 5.2V/6A. Like this i got false readings exactly every 5 minutes. I tried different power sources, different converters, ferrite beads, with exactly the same results. Disconnecting the whole thing from the 220V grid and using batteries - no false readings. Connecting it to the grid - false readings every 5 minutes. I also tried to power the module directly from the 12V wire and the RPI from the converter (with common ground of course) and still didn't fix the problem. The 12V psu and battery are located in a metal cabinet in the wall, where a distribution box for underfloor heating is located. It contains a small water recirculation pump, several valves and a Salus module that controls the whole thing and connects to the thermostats in every room via zigbee, so i guess the automation is the most likely culprit, given the fact that false readings come exactly 5 minutes apart. I have a similar setup in another place with absolutely no problems. For me, the only fix was in software, to check the length of the event. I added a 5ms delay and re-checked the sensor output. If still high, trigger the camera, if not, ignore it. In my case the problem might be with the whole setup and not the sensor itself, and the false reading is really short (under 5ms). Maybe adding a delay works with different setups too. However this is a very nice module even though is quite cheap, but it seems quite sensitive to power. Checking the output after a short delay may fix it for some, depending on the setup.

CapitalT commented 5 years ago

Hi, I had a RCWL-0516 connected to a Raspi 3B, getting false positives. I tried ferrite beads, placing the sensor further away from Wifi or other radio sources, using 5V and 3V as input etc. I am not very technical but what I understood from this thread and other sources it seemed to me that the power source of the Pi is not providing a stable current and the problem is not so much radio or power frequency interference but sudden power drops that set of the sensor. I tried a setup that looks like this: NodeMCU_Sketch_simple

The RCWL is powered by the 5 Volt from the USB input. A small capacitor is placed on the 5V line. I used a NodeMCU clone that probably eats less power too. The actual setup has a long chord to the sensor with a ferrite bead and a LED on one of the GPIO pint to tell me when the sensor goes off, but the thing that made the difference was using power from the input source and the 330uF capacitor. So far it has not given me any false triggers! Does this setup makes sense from an electronics perspective?

slq32 commented 5 years ago

Your design makes sense. For the Raspberry Pi, did you try to pull down the GPIO pin ? For me the only way to fix it was with a delay ...

def sensor_callback(channel):
    global cfile
    if cfile:
      return
    time.sleep(0.005)
    if GPIO.input(SENSOR_PIN) != 1:
      lasteventtime = dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
      print(lasteventtime, "False motion event detected")
      return
    recthread = threading.Thread(target=record_on_motion)
    recthread.start()

It might actually be because of the Rpi , not the RCWL module ...

CapitalT commented 5 years ago

@sql32 I might have tried the internal pull-down. I can't test it because I grilled my Pi trying to connect it to a more stable power source (source was stable, just not the right power :-( ). When playing with the NodeMCU I found no difference with a pull down resistor or without. I assumed that the RCWL module pulls the pin down itself. Is that not correct?

slq32 commented 5 years ago

@CapitalT I don't think the Pi does pull up or down by itself. Most guys recommend using external pull up / pull down resistors, but on some occasions the internal pull-ups/downs do work (it worked in my case). I'm also not sure if the RCWL does any kind of pull-down. AFAIK it just sends a 3.3V logic when it "detects" motion, otherwise nothing. I don't think your issue was related only to the power source. I used a 5.2V / 6A power source , closed to the RPI with no luck. I don't know if i mentioned but with my setup i also got false inputs on the "door bell" pin, a pulled down mechanical switch , that was only supposed to send a signal when someone pushed the button and closed the circuit. It looks like the Pi goes berserk in some specific set-ups. I can send you my Python script if you want, i guess if you want to code in a different language, the hardware is still the same.

ortegafernando commented 5 years ago

Got a quite similar (or maybe weirder) problem. I use the module connected to a Raspberry Pi 3B+, powered from the RPI board and output connected to a pulled down GPIO. I use the setup to detect motion at an entrance door (metal door). The sensor, camera and a ring button are on the outside and the RPI is on the inside, connected by a 15cm UTP unshielded cable. If the sensor detects motion the camera records a 10 second video, and if someone pushes the ring button, i get a notification. Now comes the funny part: when i power the RPI from a battery pack everything is very stable, no false reading whatsoever. However my design is to power the whole thing from a 12V, battery backed up power source, go with 12V via a ~2.5m cable and use a converter to step down the voltage to 5.2V/6A. Like this i got false readings exactly every 5 minutes. I tried different power sources, different converters, ferrite beads, with exactly the same results. Disconnecting the whole thing from the 220V grid and using batteries - no false readings. Connecting it to the grid - false readings every 5 minutes. I also tried to power the module directly from the 12V wire and the RPI from the converter (with common ground of course) and still didn't fix the problem. The 12V psu and battery are located in a metal cabinet in the wall, where a distribution box for underfloor heating is located. It contains a small water recirculation pump, several valves and a Salus module that controls the whole thing and connects to the thermostats in every room via zigbee, so i guess the automation is the most likely culprit, given the fact that false readings come exactly 5 minutes apart. I have a similar setup in another place with absolutely no problems. For me, the only fix was in software, to check the length of the event. I added a 5ms delay and re-checked the sensor output. If still high, trigger the camera, if not, ignore it. In my case the problem might be with the whole setup and not the sensor itself, and the false reading is really short (under 5ms). Maybe adding a delay works with different setups too. However this is a very nice module even though is quite cheap, but it seems quite sensitive to power. Checking the output after a short delay may fix it for some, depending on the setup.

could you please share your code ? thanks.

gecko9 commented 5 years ago

You probably already have earthed the 0V line of your power supply to RPI and sensors?

slq32 commented 5 years ago

The power supply is grounded yes (the AC side at least), i am not sure about the 0V line ...

gecko9 commented 5 years ago

Grounding the 0V line can completely remove certain kinds of spurious interference. Simple thing to try!

CapitalT commented 5 years ago

@gecko9 Wow.. this did the trick for me. I connected the Ground to the real ground. No false positives in 24h! There seems to be a voltage difference between GND and the real ground that is fluctuating but I don't have proper measuring equipment. @underwoodblog I did put the sensor in an air tight container with rice after cleaning the sensor with aclohol. Did not seem to make any difference.

nextgenman commented 5 years ago

Hi all. RC filter did not help me. Using dc-stepUp mt3608 solve the issue. I've test with esp8266 and esp32 as well. So I've connected Vin from esp to dc-stepUp in. Out voltage set to ~11V. And this voltage go to the RCWL. Hope it will help somebody. IMG_20190522_203014 radar

jirmjos commented 5 years ago

Hi @nextgenman, seems you have the trick , but then you need shift level again down on the RCWL output to 3.3V to avoid damages on gpio inputs on ESP boards, rigth ?. Or how do you doi it ?

nextgenman commented 5 years ago

Hi @jirmjos , absolutely no need to convert output as according spec: Operating Voltage: 4-28V Operating Current: 2.8mA (typical); 3mA (max) Detection Distance: 5-9m Transmitting Power: 20mW (typical); 30mW (max) Output Voltage: 3.2-3.4V Output Voltage Driving Capacity: 100mA Trigger Way: repeat trigger Output Control Low Level: 0V Output Control High Level: 3.3V

So when input 4V - output high level is 3.3V and when input 28V output high level is 3.3V as well. Just connected directly to ESP GPIO. And some statistic: radar2 Before 1 - normal activities in the room Period 1 - nobody in the room Between 1 - 2 - I came into the room and went to bed Period 2 - I slept in the room Between 2 - 3 - Waked up and some activities Period 3 - Was on work (nobody home) After 3 - Normal activities

Absolutely no false positive so far (~6 days period)

jirmjos commented 5 years ago

Hi, Dimitry. Of course, for me, you found the key! . If the output of the RCWL module is 0 (low) -3.3V (high), the range is perfect for ESP gpio. In my opinion, it is mandatory to increase the value of Vin to> 5 V for the work of the RCWL module without false positives. A few days ago I started to think that the RCWL module seems need step up its Vin to a value > 5V to achieve a stable job without false positives, but I do not have time to investigate further and I left the tests, but yesterday I found your post. . This hypothesis is due to the fact that, in general, by increasing the power value of any module, we achieve much better rejection noise levels, as well as a better definition of the internal logical levels with which the module works. I am starting to do some tests of the RCWL module for a couple of days, but I would try feeding with only 5V over RCWL Vin (maybe you already tested with 5V value and you discart going up to 11V you say) I think will be better if we can use 5V which ESP is tolerant on their gpio inputs and usually achieved directly on mostly any ESP plate systems and per my tests with 5V seems stable (no false positives at this time), but it is necessary to perform a reliability tests using different RCWL modules and some different ESP system boards. When I finish I publish my experience again.

bastero commented 5 years ago

Hi @jirmjos , absolutely no need to convert output as according spec: Operating Voltage: 4-28V Operating Current: 2.8mA (typical); 3mA (max) Detection Distance: 5-9m Transmitting Power: 20mW (typical); 30mW (max) Output Voltage: 3.2-3.4V Output Voltage Driving Capacity: 100mA Trigger Way: repeat trigger Output Control Low Level: 0V Output Control High Level: 3.3V

So when input 4V - output high level is 3.3V and when input 28V output high level is 3.3V as well. Just connected directly to ESP GPIO. And some statistic: radar2 Before 1 - normal activities in the room Period 1 - nobody in the room Between 1 - 2 - I came into the room and went to bed Period 2 - I slept in the room Between 2 - 3 - Waked up and some activities Period 3 - Was on work (nobody home) After 3 - Normal activities

Absolutely no false positive so far (~6 days period)

Perfect!! I've been struggling with trying to filter ESP noise with a Pi-Filter without any luck. I'll try your suggestion, it makes sense.

MisterScience5 commented 5 years ago

Been trying pretty much everything in this thread to get my RCWL's to work, although I seem to be getting close to something.

My solution was to fully isolate the RCWL from the Wemos D1 Mini using a B0505s-1W isolated DC-DC converter with a reasonably 470uF input cap, and a PC817 for the signal which seems to have sorted out false positives even from a fairly noisy USB charger that was giving me false positives every 10-20 secs using starfish1107's inductor/cap filter.

It's a bit of a costly solution as the B0505s is about a dollar a pop, but so far it seems extremely stable. If it keeps going, definitely will be my go to solution for multisensors, not the least because the isolation circuitry is fairly compact.

jeraymond commented 5 years ago

@MisterScience5 can you share a schematic of your solution? I’m interested in how you put it all together.

MisterScience5 commented 5 years ago

Here's pretty much how it's set up:)

Couldn't find a part for the B0505s-1W, so I just fudged it with a random 4 pin part.

image

lmamakos commented 5 years ago

I wonder if using something like https://www.amazon.com/Erayco-LM2596-Converter-3-0-40V-1-5-35V/dp/B07JNQFV7F would work, from +5v input, feeding the 3.3v pin on the RCWL device. I'm doing something similar with an LDO linear regulator successfully, though while being able to power it OK, I still get occasional false triggers where there are large spikes in current consumption. Maybe not quite enough isolation..

jirmjos commented 5 years ago

Hi all!.

Some field test completed in these days with some RCWL RF sensor modules. I tested four modules and two diferent ESP development boards (Wemos D1 mini R2 and Node MCU). Below are my proptotype board working:

P90617-110904

Conclusions:

Other pic on tests boards with a RF 433 transmitter placed so closer over RCWL:

P90619-120650

I hope these tests can be useful for all those who want to use these RF sensors.

Regards

martin072 commented 5 years ago

Have had the same problems. Resolved them by doing the following:

  1. Have the DC power feed to the ESP as close as possible to the ESP.
  2. Put a 2000uF capacitor as close as possible to the power input of the RCWL. The pi filter mentioned above is not necessary but the single capacitors to smooth out ripples to RCWL is.
  3. Put a 10k resistor between output of the RCWL and ground.

I also tried the following at the suggestion of others for the ESP: WiFi.setPhyMode(WIFI_PHY_MODE_11G); // puts ESP in G mode only WiFi.setOutputPower(8) ; // limits output power to 8/4=2 dbM WiFi.mode(WIFI_STA); // not quite sure what this does I do not know whether these have an effect or not. The second line where you limit the power certainly does. This may be due to the fact that when the ESP goes into transmit mode it draws power which causes a slight ripple in the power line which is sufficient to trigger the RCWL. The capacitor accross the power line near the RCWL mitigate this effect. Hope this helps someone .....

Hi,

Is this still the best option? I am getting crazy with the RWCL-0516, it gives me a lot of false triggers. There is a 470uf Cap over the Vin at the sensor (don't have the 10k to ground yet, will do this as a last resort), I used a shielded cable to the sensor (about 2m long), and connected it all to a Wemos (Pin D6), but it triggers like crazy. As far as I can think about it, it is not near any RF transmitting devices.. The power connector is a standard USB charger type.

Any ideas are welcome..

MisterScience5 commented 5 years ago

Quick update, after testing using an isolated DC-DC converter I have to conclude that it's not 100% removing false positives, It seems to remove almost all false triggers, but I still sometimes get a trigger at night every now and again.

bastero commented 5 years ago

Sorry for the late response but I believe i've finally got the detector working as required, i.e. w/o false triggers. It has been running for 48 hrs in an isolated part of the home without a single false trigger. The solution for me was to add filtering (470uF caps) on both the ESP01-1 & DC/DC (Vin/Gnd). DC/DC voltage set up (Vin 3.3V - Vout adjusted to ~11V). I found that the circuit also required the 10k Ohm pull down resistor on the Out pin of the RCWL-0516 module. The circuit is much like what @MisterScience5 shows above, however i used the DC/DC Step up (MT3608 Adjustable Power supply Adapter) ~$1.0 each.

RCWL Doppler detector

nextgenman commented 5 years ago

@bastero So you just confirmed that solution proposed by me on May is working fine. =) Great to hear that.

bastero commented 5 years ago
    Did I just confirm that, sorry I didn’t go back through the tread to verify the original proposer. If that was you, then thank you. Credit where credit is due!. It was a struggle to get the RCWL’s to work but I’m glad your proposal works. It’s a great alternative to the PIR when the false triggers are addressed. Take care.

On Sat, Aug 17, 2019 at 3:27 AM -0500, "Dzmitry Dydyshka" notifications@github.com wrote:

@bastero So you just confirmed that solution proposed by me on May is working fine. =)

Great to hear that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

happytm commented 5 years ago

@bastero can you please show schematic of your modification so everyone can understand how it is done? Hand drawn schematic will be fine.As far as I understood it we need 2 470uf caps ,1 10k resistor & boost converter to achieve this

Thanks.

starfish1107 commented 5 years ago

@nextgenman/bastero interesting that simple stepup converters work fine. For me a isolated DC-DC converter showed the best results. Looks like (supply)noise immunity increases with higher supply voltages (common when designing opamp circuits).

bastero commented 5 years ago

@happytm here you go.. The most important design considerations that I feel made the difference to the reduction in false triggers was @nextgenman inclusion of the DC-DC converter. I did try a tuned Pi- filter on the supply lines, however that was only somewhat successful, the caps on the rails are included as good design practice.

The other improvement was the addition of the pull down resistor, this definitely improved the false triggers. Initially I did play around with ensuring that the ESP01 and RCWL where as far as possible from each other however their proximity in the final design didn't appear to be a factor (I don't have an oscilloscope so I can't prove this..).

I have implemented the design with an ESPHome.yaml sketch within Home Assistant. I mention this as the implementation of s/w averaging/filtering has been kept at a minimum, this ensures that detection is virtually immediate and therefore enhances my confidence that the circuit is reacting to true detection and not spurious emissions.

@starfish1107 your assessment regarding noise immunity as a result of higher injection voltage makes perfect sense. Screen Shot 2019-08-18 at 12 05 54 PM

happytm commented 5 years ago

@bastero thank you very much.This will remove all confusion. If this is successful in long run it will be a solution at last. Please update us after about a month of use so no one have to go through 140 or so comments in this thread.Also this schematic should be in readme file for this repository.

@nextgenman thank you for your original idea and testing.You can also update us on your experience so far with it since you are using it for longer time.

bastero commented 5 years ago
    @happytm I’m not that familiar with Github and how to place documents as a readme file. If you would be so kind as to place it in the correct location I’d appreciate it. 

On Sun, Aug 18, 2019 at 2:55 PM -0500, "happytm" notifications@github.com wrote:

@bastero thank you very much.This will remove all confusion. If this is successful in long run it will be a solution at last. Please update us after about a month of use so no one have to go through 140 or so comments in this thread.Also this schematic should be in readme file for this repository.

@nextgenman thank you for your original idea and testing.You can also update us on your experience so far with it since you are using it for longer time.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

happytm commented 5 years ago

I think owner of this repository can do that.

Thanks

rohimo commented 5 years ago

@bastero can you please share DC-DC converter part number you used....

bastero commented 5 years ago

@rohimo Purchased on Amazon: AZDelivery 5 x MT3608 DC-DC Step Up Adjustable Power Supply Adapter Module for Arduino Sold by: AZ-Delivery Shop $6.99

happytm commented 5 years ago

This is a modification on this particular dc-dc converter to increase efficiency of unit for battery powered unit:

https://www.youtube.com/watch?v=zJJcdptSH80

Thanks

rrauenza commented 5 years ago

I found this issue thankfully -- I bought the DFRobot packaging of the HB100 and at its highest sensitivity setting, it flashes a lot on my rpi 3 b+. And yes, it looks like network traffic.

I cut open a spare usb cable and connected the device to an iPhone charger -- no spurious flashes.

What is my next step?

ifconfig down wlan0 didn't fix it. I haven't tried disabling wifi in the boot/config.txt yet. I'm about to order the MT3608 to see if it fixes it -- are you using it to go from 5v to 5v??

Anyway, just ordered the MT3608 and a few 470uf low-esr caps.

MisterScience5 commented 5 years ago

I'm using the MT3068 circuit now, which was perfect as I needed a higher voltage for an A4988 also. I'm running my output from the MT3608 at 10V, and this has so far given me 0 false triggers.

happytm commented 5 years ago

I just ordered 25 of MT3608 at unbelievable cheap price of less than 50 cents each.

https://www.ebay.com/itm/5pcs-Professional-MT3608-2A-Max-DC-DC-Step-Up-Power-Module-Booster-for-Arduino/143162070116?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

bastero commented 5 years ago

Update on false trigger performance: I have had zero false triggers since my last entry. Note that I have also included/added a 1M Ohm potentiometer on the 'R-GN' pad of the RCWL-0516, this helped reduce the range of the microwave sensor as well as make it tunable to every installation for ranges < ~ 5 meters.

@MisterScience5 what's your application i.e. A4988?