Voltage-based trigger on Wemos D1/ESP8266 – How?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Voltage-based trigger on Wemos D1/ESP8266 – How?

#1 Post by Wookbert » 11 Apr 2021, 13:42

I want to trigger a Wemos D1 mini using one of these cheap 5.8 GHz Microwave Motion Detector Switches. (Advantage over the super-cheap RCWL-0516 Microwave Sensor is that a) I can steal power to drive the ESP8266 and b) comes with DIP switches for easy adjustment of range and lux).

Instead of triggering the ESP8266 with the relay on the Microwave Switch (which makes click sounds and might fail through mechanical wear), my idea is to remove the relay and instead detect the relay’s 5V signal.

Is that possible with the Wemos D1 mini and ESP Easy? If so, which pins to connect to and which software settings?

Thanks in advance!
Last edited by Wookbert on 12 Apr 2021, 01:03, edited 1 time in total.

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#2 Post by TD-er » 11 Apr 2021, 20:50

I have not played with those modules.
But since it is working on mains power, you really should be cautious as most of those units do not have proper isolations from mains.
What you can do is replace the relais with an LED + an optocoupler.
Depending on the relais voltage you can either place the LED and the optocoupler's LED in series (>5V switching voltage) or in parallel.
When placing in parallel you need a separate resistor for each LED.
N.B. the LED itself is not really needed, but can be useful for debugging.

The transistor side of the optocoupler you can then use, with a pull-up resistor, to connect a GPIO pin.
Something like this, only I would also include a resistor in series with the transistor to protect the GPIO pin of the ESP when you may accidentaly drive the pin as output.

To power the ESP, please use a separate power supply for it, like an USB charger or one of those HiLink adapters.

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#3 Post by Wookbert » 11 Apr 2021, 22:29

So there is no direct way to „measure“ the 5V switch would pull the relay? (I read something about measuring voltage on Pin A0 here, but perhaps I'm misunderstanding this).

Optocoupler is one alternative, another one to replace the mechanical relays with a 5V solid state relay (also cheap; too bad that the footprint is quite different to the mechanical relay).

„No proper insulation from mains“ No worries, I'm not an electronic engineer, but I can read the PCB a bit. What’s the reason why you recommend to use a separate power supply? Worried about me frying the ESP8266 or myself, or expecting the 5V as provided from the Microwave Sensor PCB „not being clean enough“, thus interfering for instance with the ESP’s Wifi signal?

I'd like to avoid using „another“ power supply, simply because of the standy-by power consumption. I mean: These things are always on (24/7/365), which means every 10th of a Watt counts, especially if one installs multiple of these and lives in Germany, where electricity has become quite expensive.

P.S.: Pictured below is a ESP8266 In-Wall Power Supply PCB I designed around your mentioned Hi-Link PSU. Triple-fused: Over-heat, over-voltage, shorts. Design goal was to cramp everything onto a PCB small enough to fit into a standard 68 mm one-gang box. Works like charm. More on that project (including printable enclosure and a backpack PCB template) in a not so far away future. Total lack of time here.
D10EBBB9-C95E-4458-AA57-A44B7E5129B5_1_105_c.jpeg
D10EBBB9-C95E-4458-AA57-A44B7E5129B5_1_105_c.jpeg (245.67 KiB) Viewed 5166 times
DC3B3949-8943-40DD-B415-DA73D4941552_1_105_c.jpeg
DC3B3949-8943-40DD-B415-DA73D4941552_1_105_c.jpeg (198.55 KiB) Viewed 5166 times

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#4 Post by TD-er » 11 Apr 2021, 23:28

The reason I advise to go for a separate power supply is mainly because I would like to keep users alive :) and also because I suspect the power supply in that sensor will not be powerfull enough to deliver peaks of upto 500 mA to the ESP which it may draw when starting WiFi.
Even the Sonoff power supplies are often slightly too weak to deliver it to the ESP.

You can read the 5V from the relais via the analog input, but I suspect it is not really useful to measure an analog value for something as discrete as "relais on/off" so you could also use some resistors to get it to 3v3 and connect it to a GPIO pin.
But then you're not isolating it from the mains, so that's why I suggested to go for an optocoupler.

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#5 Post by Wookbert » 12 Apr 2021, 01:22

Perhaps I simply turn things around, and use the 5V as supplied from my shown In-Wall PSU Board to drive the Microwave Sensor Switch (and don't use the mains thereof), presuming that the sensor runs on plain 5V, and not 5V/12V mixed. The Hi-Link PSU is strong enough. Just need to take a close look at the sensor PCB, and check where the low-voltage DC section starts.

In that case I could also try if the Microwave sensor also works with only 3v3 (Hi-Link in both 5V and 3v3 versions at hand), which would enable the option for the GPIO trigger you’ve mentioned.

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#6 Post by TD-er » 12 Apr 2021, 08:15

Turning 5V into 3v3 pulse signal isn't that hard using 2 resistors as a voltage divider.
The cheap radar sensor does also work on lower voltages, but it is then behaving quite different, so maybe it is the same with this one... It may work but not the same.
Also keep in mind these sensors may be affected with metal near it, so placing other electronics in the same housing may also affect its performance.
The sensor now has its own plastic enclosure and different plastics have different effect on the antenna tuning, so if you plan on changing the enclosure too, test it first to see if it still works as expected with a different enclosure.

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#7 Post by Wookbert » 12 Apr 2021, 13:41

Fully aware of the metal shielding issue. All in all it looks like a viable option, powering the microwave sensor from my shown Hi-Link/Wemos board. Only slightly worried that the 5.8 GHz microwave creates interferences with the WiFi.

Would be cool if there’s an experienced electronic engineer in this forum, who is capable and interested in designing a Microwave Sensor HAT/Shield/Backpack matching my PCB’s footprint. In my hottest/wettest dreams with sensitivity for motion and ambient light (lux) via the ESP8266 and ESPEasy. 🥵😍

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#8 Post by TD-er » 12 Apr 2021, 14:49

5.8 GHz should not interfere with 2.4 GHz WiFi. Maybe it can interfere with 802.11ac in the U-NII-3 band, however that's hardly used here.
Only semi-professional WiFi gear which does use a different radio for communicating between APs to allow for a more stable WiFi bridge (or mesh) may use it.

But I really doubt these units will work with proper filters to only use a very narrow band.
If they don't then other channels may also detect it as radar and those channels that should use DFS may then stop for 10 minutes when they detect the signals.
Those are 5 GHz WiFi channels >= channel 50. See: https://en.wikipedia.org/wiki/List_of_W ... j/n/ac/ax)

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#9 Post by Wookbert » 23 Apr 2021, 01:13

After inspecting three different integrated 230V Microwave Sensor Relay Switches, I realized that the DC circuitry doesn't seem to run on 5V (depending on the model I measure either 12 or 24V, which matches the imprint on the relay). Anyhow I have to admit that I'm not expert enough to understand the circuitry enough without access to a schematic.

Long story short: I ordered a HFS-DC06 5V 5.8GHz Microwave Radar Sensor Switch Module from AliExpress for USD 3.18 (4.76 shipped) for testing. Curious to see how well that works. Any experience with that module?
Attachments
Bildschirmfoto 2021-04-23 um 01.43.53.png
Bildschirmfoto 2021-04-23 um 01.43.53.png (268.97 KiB) Viewed 4861 times
HFS-DC06.jpg
HFS-DC06.jpg (100.63 KiB) Viewed 4864 times

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#10 Post by TD-er » 23 Apr 2021, 08:21

Nope, not yet.
I only played around with those "50ct" modules RWCL...something

User avatar
ThomasB
Normal user
Posts: 881
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#11 Post by ThomasB » 25 Sep 2021, 19:07

Long story short: I ordered a HFS-DC06 5V 5.8GHz Microwave Radar Sensor Switch Module from AliExpress for USD 3.18 (4.76 shipped) for testing. Curious to see how well that works. Any experience with that module?
Were you able to get it working on a ESP8266? Any chance you tried it outdoors, far away from buildings?

The reason I ask is because the HFS-DC06 I tried does not work correctly. Mine is the 12V version (has 78L05 Vreg in it). I bypassed the Vreg so I could run it on 5V. Works on the bench using the lab power supply.
.
HFS-DC06, 12V version
HFS-DC06, 12V version
microwave_sensor1.jpg (195.84 KiB) Viewed 1121 times
.
But it refuses to work when it shares the 5V that runs the ESP8266. The Wemos D1 Mini Pro's power bus appears to cause interference that tricks the sensor to be constantly triggered. LC Filtering its DC power does not help.

I've ordered the HFS-DC06 version that accepts 5V in case it has better tolerance to sharing power. So I'm hoping that you can report that the 5V version is working for you.

- Thomas

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#12 Post by TD-er » 25 Sep 2021, 20:13

Maybe you can wrap the (+5V) wire around some ferrite ring, or clip on one of those ferrite beads?

User avatar
ThomasB
Normal user
Posts: 881
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#13 Post by ThomasB » 25 Sep 2021, 20:37

Maybe you can wrap the (+5V) wire around some ferrite ring, or clip on one of those ferrite beads?
That was one of the many EMI/RFI suppression tricks that I tried.

The HFS-DC06 is suppose to be friendly with the ESP8266. But I suspect the interference issue is related to the 12V board design. Or maybe it is defective. In a few weeks the post office will be delivering the 5V version. It will be interesting to see if it has the same issue.

BTW, Andreas Spiess's four year old YouTube video mentions that the HFS-DC06 works down to 3.3V. That's ideal for us ESP8266 users. But apparently it depends on a bit of luck, since some builders reported it fails to work correctly on 3.3V. I tested mine (12V module hacked for 5V operation) and it gets weird under 4V.

- Thomas

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#14 Post by Wookbert » 25 Sep 2021, 22:10

I didn't find the time yet to experiment with the HFS-DC06 (and HB100, which I have also), but my partner in crime and I intend to do so shortly. A solution is badly needed, PIR just doesn't work in some of my environments (e.g. through the glass door of the shower).

As for the voltage of the HFS-DC06: There are different board versions (HFS-DC06H, HFS-DC06F, no idea which is which), but there is a good comparison, also describing your found 78L05 differences, on this page: https://kleinejan.medium.com/boltanski- ... e41202ccb6
HFS-DC06 Variations.jpg
HFS-DC06 Variations.jpg (825.53 KiB) Viewed 1100 times

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#15 Post by Wookbert » 25 Sep 2021, 22:17

Here’s a „Datasheet light“ for the HFS-DC06 I found on the web.
HFS-DC06 Datasheet.pdf.zip
(194.11 KiB) Downloaded 12 times
My fear is a bit that the 5.8 GHz might interfere with the Wifi channels 157 to 177, which operate in the 5.8 GHz range. There are some user reviews on Amazon which claim exactly that.

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#16 Post by TD-er » 25 Sep 2021, 22:39

Those are "DFS" channels.
Meaning the AP needs to keep silent for 10 minutes as soon as it detects radar signals when using those channels.
And these devices probably trigger such a DFS filter.

See: https://en.wikipedia.org/wiki/List_of_W ... j/n/ac/ax)

User avatar
ThomasB
Normal user
Posts: 881
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#17 Post by ThomasB » 26 Sep 2021, 00:17

I didn't find the time yet to experiment with the HFS-DC06 (and HB100, which I have also), but my partner in crime and I intend to do so shortly.
Please let me know if you have success when it is connected to the ESP8266. I'm using a Wemos D1 Mini Pro (I recall you use them too).
My fear is a bit that the 5.8 GHz might interfere with the Wifi channels 157 to 177, which operate in the 5.8 GHz range. There are some user reviews on Amazon which claim exactly that.
I saw the Amazon reviews that complained about the issues with 5.8GHz WiFi. I'm not concerned since I only need 2.4GHz WiFi.

But because I was curious I also ordered a 10GHz microwave motion sensor to try out. Should be in my hands in 3-6 weeks.
https://www.aliexpress.com/item/4000382657591.html

- Thomas

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#18 Post by Wookbert » 26 Sep 2021, 00:23

TD-er wrote: 25 Sep 2021, 22:39 Those are "DFS" channels.
Meaning the AP needs to keep silent for 10 minutes as soon as it detects radar signals when using those channels.
And these devices probably trigger such a DFS filter.
Can you translate that for RF idiots like me? So does that make the HFS-DC06 (and any other 5.8 GHz Microwave Sensor) a bad choice?

I'm looking at sensors in other frequency ranges as well:
Bildschirmfoto 2021-09-26 um 00.17.57.png
Bildschirmfoto 2021-09-26 um 00.17.57.png (234.2 KiB) Viewed 1082 times
EN Compliance/Standards „allows“ completely different frequencies (see also ETSI EN 300 440):
Motion Detection Frequencies.png
Motion Detection Frequencies.png (76.93 KiB) Viewed 1082 times

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#19 Post by Wookbert » 26 Sep 2021, 00:47

ThomasB wrote: 26 Sep 2021, 00:17 But because I was curious I also ordered a 10GHz microwave motion sensor to try out. Should be in my hands in 3-6 weeks.
https://www.aliexpress.com/item/4000382657591.html
That’s the HB100 which I've mentioned above and which I have also on my desk. We gonna test that as well. Problem is that it „fires“ as crazy, so one needs same smart software logic. Also it is pretty bulky (big PCB diameter) compared to the HFS-DC06 and RCWL-0516 boards.

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#20 Post by TD-er » 26 Sep 2021, 01:42

Wookbert wrote: 26 Sep 2021, 00:23
TD-er wrote: 25 Sep 2021, 22:39 Those are "DFS" channels.
Meaning the AP needs to keep silent for 10 minutes as soon as it detects radar signals when using those channels.
And these devices probably trigger such a DFS filter.
Can you translate that for RF idiots like me? So does that make the HFS-DC06 (and any other 5.8 GHz Microwave Sensor) a bad choice?
[...]
The 5GHz band is also used for (military) radar.
This means a WiFi access point in the 5 GHz band may not interfere with radar and thus as soon as it detects something that looks like radar, the AP will stop sending for 10 minutes.
Not only military radar, but also weather radar may be seen by an access point as the kind of radar signal which causes the AP to shut up for a while.

So in some areas you can't use 5GHz WiFi, or only on a very limited number of channels.
All channels mentions on this table, where "DFS" is mentioned may suffer from this. (ch 50 - 144 are thus unusable)

If you live in an area where you never experienced this, then you will see those 5.8 GHz radar modules may interfere with your 5 GHz WiFi. But others may have had many issues already with 5 GHz WiFi for this reason and thus the radar module may not make a difference.

In the temp houses I now live (along with my entire street), we have a lot of issues on 5 GHz WiFi (and I'm not to blame, this time ;) )
Not sure what causes it. It could be there is some radar nearby, or maybe a weather balloon may be "in sight" every now and then. (line-of-sight is very far here, as I can see buildings 15km away from my desk)
Or maybe it is just that we have like 60+ WiFi access points within 300 m, which may interfere such that the firmware may see it as radar noise.

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#21 Post by Wookbert » 26 Sep 2021, 15:16

TD-er wrote: 26 Sep 2021, 01:42 This means a WiFi access point in the 5 GHz band may not interfere with radar and thus as soon as it detects something that looks like radar, the AP will stop sending for 10 minutes.
So that leads to the question: How far away from router or 5.8 GHz Wifi devices does a 5.8 GHz Radar Sensor like the HFS-DC06 must be positioned? Does it matter the radar sensor is place in the „line of sight“? How strong is the signal really compared to the 5.8 GHz Wifi signal? (That HFS-DC06 datasheet doesn't list any mW value, but the sensor consumes 25 mA, perhaps that’s an indicator).

Or is any motion sensor using 5.8 GHz for detection ill-fated and a bad choice? That would speak for the HB100 (10.525 GHz).

User avatar
ThomasB
Normal user
Posts: 881
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#22 Post by ThomasB » 26 Sep 2021, 17:30

Or is any motion sensor using 5.8 GHz for detection ill-fated and a bad choice? That would speak for the HB100 (10.525 GHz).
I would suggest using the RCWL-0516. Good for indoor motion sensing, no WiFi interference, not affected by ESP8266, very small size, low cost.

- Thomas

Wookbert
Normal user
Posts: 86
Joined: 06 Nov 2020, 03:17

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#23 Post by Wookbert » 26 Sep 2021, 17:46

So, why did you order the HFS-DC06 and HB100 then? ;) :P

What speaks a bit against the RCWL-0516 is the rather short range (on 7 meters unobstructed; amongst others I need to cover a 11 x 1,5 meter hallway), and if you actually need a shorter range, SMD soldering is required (0805 resistor @ PCB position R-GN). Also the repeat trigger timer requires soldering an SMD capacitor (PCB position C-TM), should there be a desire to change it.

Full description of the RCWL-0516 here.

User avatar
ThomasB
Normal user
Posts: 881
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#24 Post by ThomasB » 26 Sep 2021, 18:46

So, why did you order the HFS-DC06 and HB100 then?
The RCWL-0516 is an effective sensor for typical motion detect applications. Perhaps the best value for the dollar.

But it won't work in my application. The full story is found here: viewtopic.php?f=2&t=8759

For the record, I have no idea if the HFS-DC06 or HB100 will work for me either. But try I must because I refuse to let the turkeys win.
... and if you actually need a shorter range, SMD soldering is required (0805 resistor @ PCB position R-GN). Also the repeat trigger timer requires soldering an SMD capacitor (PCB position C-TM), should there be a desire to change it.
Installing a 0805 size component is not difficult if you can solder thru-hole devices. You'll probably need to install resistor R-GN, but it's highly unlikely you will need C-TM. Regardless, don't let this SMD soldering be a deal killer.

- Thomas

TD-er
Core team member
Posts: 5502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Voltage-based trigger on Wemos D1/ESP8266 – How?

#25 Post by TD-er » 26 Sep 2021, 21:16

Wookbert wrote: 26 Sep 2021, 15:16
TD-er wrote: 26 Sep 2021, 01:42 This means a WiFi access point in the 5 GHz band may not interfere with radar and thus as soon as it detects something that looks like radar, the AP will stop sending for 10 minutes.
So that leads to the question: How far away from router or 5.8 GHz Wifi devices does a 5.8 GHz Radar Sensor like the HFS-DC06 must be positioned? Does it matter the radar sensor is place in the „line of sight“? How strong is the signal really compared to the 5.8 GHz Wifi signal? (That HFS-DC06 datasheet doesn't list any mW value, but the sensor consumes 25 mA, perhaps that’s an indicator).

Or is any motion sensor using 5.8 GHz for detection ill-fated and a bad choice? That would speak for the HB100 (10.525 GHz).
Such a radar must emit enough power to see the reflected signal strong enough to detect changes.
So roughly speaking, it will at least cover twice the detection range.
The big unknown here is how sensitive the receiver in the radar module is.
If that receiver is a lot less sensitive compared to the radio in an access point (which it likely is), then the range of disturbance may be quite a lot more than its detection range.
It would not surprise me if those radar modules can affect 5 GHz WiFi for over 100 meter.
What may attribute to this DFS limitation is that the access point may classify a lot as radar, just to be on the safe side. As a manufacturer you cannot risk to be forced to recall your devices while customers seeing such a disruption can be told "We're sorry but it is according regulations".

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests