PIR in 3.3V and ESP8266-01
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
PIR in 3.3V and ESP8266-01
Hi
So I'm new..
I'd like to make a wifi motion sensor.
I want to power it this way:
https://www.youtube.com/watch?v=j21CMZ6Lrfc
and use this feature to make it go on 3.3V
https://www.youtube.com/watch?v=5jhTQAV-hg0
And then I want it connected to my Domoticz server.
- only, I'm blank as to how I'll connect the PIR with the ESP.. And do I need extras? Resistors or such?
I think I can figure out the programming part.
I hope someone will take the time to help a newbie..
So I'm new..
I'd like to make a wifi motion sensor.
I want to power it this way:
https://www.youtube.com/watch?v=j21CMZ6Lrfc
and use this feature to make it go on 3.3V
https://www.youtube.com/watch?v=5jhTQAV-hg0
And then I want it connected to my Domoticz server.
- only, I'm blank as to how I'll connect the PIR with the ESP.. And do I need extras? Resistors or such?
I think I can figure out the programming part.
I hope someone will take the time to help a newbie..
-
- Normal user
- Posts: 103
- Joined: 16 Sep 2015, 20:32
Re: PIR in 3.3V and ESP8266-01
I have my PIR's powered with 5v with the + & - from the ESP..
The output goes directly to an ESP input pin.
The usual pirs have a onboard 3.3 voltage converter.
As far as I know is the output level of the PIR 3.3v
I do not fiddle with all kinds of esp's or voltage converters
Just use a Wemos D1 mini with a cheap 5v phone power adapter, in the end much quicker and more reliable
Works in my install for > 6 month's with EspEasy & Domoticz
Have you read the wiki?
The output goes directly to an ESP input pin.
The usual pirs have a onboard 3.3 voltage converter.
As far as I know is the output level of the PIR 3.3v
I do not fiddle with all kinds of esp's or voltage converters
Just use a Wemos D1 mini with a cheap 5v phone power adapter, in the end much quicker and more reliable
Works in my install for > 6 month's with EspEasy & Domoticz
Have you read the wiki?
-
- Normal user
- Posts: 1156
- Joined: 03 Sep 2016, 23:27
- Location: Bielefeld / Germany
Re: PIR in 3.3V and ESP8266-01
Hello,
Internally this PIR HC-SR501 sensor works with 3,3 V as the ESP does, it uses it's own on board voltage regulator.
So it's no problem to connect the output pin of the sensor to a GPIO of the ESP, no need for resistors and such.
Using a ESP-01 I'd prefer to use GPIO-2.
Generally i'd say using the 3,3V from the ESP works but it isn't best practice.
You need a voltage regulator for the ESP-01 anyways to get 3,3 V.
I'd prefer a LF-33 CV for the ESP, use a small heatsink if necessary, then you may use 5...12 V for power supply.
As said the HC-SR501 PIR sensor has it's own voltage regulator. According to datasheet it can be powered with 5....20 V.
So i'd use a 5...12 Volt power supply to power the PIR and the regulator for the ESP.
This gives separated 3,3V lines for ESP and PIR, resulting in better stability.
There is no more additional stuff or expense, it's just a different wiring.
As said the sensor uses 3,3V internally anyways so this doesn't give any issues with connecting the PIR to the ESP.
Regards
Shardan
Internally this PIR HC-SR501 sensor works with 3,3 V as the ESP does, it uses it's own on board voltage regulator.
So it's no problem to connect the output pin of the sensor to a GPIO of the ESP, no need for resistors and such.
Using a ESP-01 I'd prefer to use GPIO-2.
Generally i'd say using the 3,3V from the ESP works but it isn't best practice.
You need a voltage regulator for the ESP-01 anyways to get 3,3 V.
I'd prefer a LF-33 CV for the ESP, use a small heatsink if necessary, then you may use 5...12 V for power supply.
As said the HC-SR501 PIR sensor has it's own voltage regulator. According to datasheet it can be powered with 5....20 V.
So i'd use a 5...12 Volt power supply to power the PIR and the regulator for the ESP.
This gives separated 3,3V lines for ESP and PIR, resulting in better stability.
There is no more additional stuff or expense, it's just a different wiring.
As said the sensor uses 3,3V internally anyways so this doesn't give any issues with connecting the PIR to the ESP.
Regards
Shardan
Regards
Shardan
Shardan
-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
Re: PIR in 3.3V and ESP8266-01
I did read the wiki, but didn't find much about wiring in it..
So let me se if I get this right..
I split the usb 5V wires, so one pair goes to PIR and one pair goes like in the powersupply video I linked.
And then I connect the GPIO-2 on the ESP to the output of the PIR - and that's it?
I've tried to draw it - is that about right?
http://pasteboard.co/B7iVU8Xrq.jpg
So let me se if I get this right..
I split the usb 5V wires, so one pair goes to PIR and one pair goes like in the powersupply video I linked.
And then I connect the GPIO-2 on the ESP to the output of the PIR - and that's it?
I've tried to draw it - is that about right?
http://pasteboard.co/B7iVU8Xrq.jpg
Last edited by engberg on 21 Feb 2017, 22:09, edited 1 time in total.
-
- Normal user
- Posts: 1156
- Joined: 03 Sep 2016, 23:27
- Location: Bielefeld / Germany
Re: PIR in 3.3V and ESP8266-01
Hello,
Sorry i don't see the Image.
But basically that is right.
+5V to the PIR and the voltage regulator as shown in the video.
Output from the PIR to GPIO-2
and don't forget ground! Ground should be connected to the ESP ground.
Regards
Shardan
Sorry i don't see the Image.
But basically that is right.
+5V to the PIR and the voltage regulator as shown in the video.
Output from the PIR to GPIO-2
and don't forget ground! Ground should be connected to the ESP ground.
Regards
Shardan
Regards
Shardan
Shardan
-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
Re: PIR in 3.3V and ESP8266-01
Thanx for all the help so far !
You can't see the image by clicking the link?
http://pasteboard.co/B7iVU8Xrq.jpg
Well the ground to ground.. is that neccessery, when both are connected to gnd from the usb / regulator, like in the picture?
Just stumpled upon this USB pinout, that I'll have to use also..:
https://www.moddiy.com/product_images/u ... or-usb.jpg
You can't see the image by clicking the link?
http://pasteboard.co/B7iVU8Xrq.jpg
Well the ground to ground.. is that neccessery, when both are connected to gnd from the usb / regulator, like in the picture?
Just stumpled upon this USB pinout, that I'll have to use also..:
https://www.moddiy.com/product_images/u ... or-usb.jpg
-
- Normal user
- Posts: 1156
- Joined: 03 Sep 2016, 23:27
- Location: Bielefeld / Germany
Re: PIR in 3.3V and ESP8266-01
Hello,
you may connect to the USB-Ground either, that should be OK.
A 5V power supply (wall plug) might be easier to handle and avoids risk of damaging the USB of your computer...
The wiring seems ok to me.
Regards
Shardan
you may connect to the USB-Ground either, that should be OK.
A 5V power supply (wall plug) might be easier to handle and avoids risk of damaging the USB of your computer...

The wiring seems ok to me.
Regards
Shardan
Regards
Shardan
Shardan
-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
Re: PIR in 3.3V and ESP8266-01
Yes, absolutely on the power supply.
Going for an old Ipad-charger..
Now I just have to wait for the TTL-module and the capasitor to ship to me, so that I can get started!
Going for an old Ipad-charger..

Now I just have to wait for the TTL-module and the capasitor to ship to me, so that I can get started!
-
- Normal user
- Posts: 63
- Joined: 08 Aug 2016, 23:42
Re: PIR in 3.3V and ESP8266-01
I am using a PIR module with a Sonoff wireless smart switch.
https://www.itead.cc/sonoff-wifi-wireless-switch.html
I modified the PIR module to bypass its 3.3v power regulator and then connected the PIR sensor to the 3.3v power header in the Sonoff switch.
Works very reliably in my kitchen switching my under unit and other spotlights. Love it. The sonoff is very reasonably priced, and basically gives you everything that you need to complete the project.
https://www.itead.cc/sonoff-wifi-wireless-switch.html
I modified the PIR module to bypass its 3.3v power regulator and then connected the PIR sensor to the 3.3v power header in the Sonoff switch.
Works very reliably in my kitchen switching my under unit and other spotlights. Love it. The sonoff is very reasonably priced, and basically gives you everything that you need to complete the project.
-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
Re: PIR in 3.3V and ESP8266-01
Justblair>> Thanks for your input - I like the transparancy in this project for me.
Buying a Sonoff switch somehow defeats the purpose of this project to me.
But I might do it anyway, if my original idea fails
Buying a Sonoff switch somehow defeats the purpose of this project to me.
But I might do it anyway, if my original idea fails

-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
Re: PIR in 3.3V and ESP8266-01
So I'm just gonna document here..
Got my FTDI232 device and found drivers here:
http://www.ftdichip.com/Drivers/VCP.htm
Then connected the FTDI232 and the esp8266 this way:
http://iot-playground.com/blog/2-uncate ... are-update
And followed the flash instructions here:
http://www.letscontrolit.com/wiki/index ... are_Upload
I had to do it twice, before it worked..
Got my FTDI232 device and found drivers here:
http://www.ftdichip.com/Drivers/VCP.htm
Then connected the FTDI232 and the esp8266 this way:
http://iot-playground.com/blog/2-uncate ... are-update
And followed the flash instructions here:
http://www.letscontrolit.com/wiki/index ... are_Upload
I had to do it twice, before it worked..
-
- Normal user
- Posts: 11
- Joined: 21 Feb 2017, 16:42
Re: PIR in 3.3V and ESP8266-01
It only runs on standart power, if I connect both the VCC and the CH_PD to 3,3V
-
- Normal user
- Posts: 20
- Joined: 11 Mar 2017, 10:21
Re: PIR in 3.3V and ESP8266-01
Hi Justblair please could you share your PIR Sonoff configuration and rules?
Thanks
Thanks
Justblair wrote: ↑22 Feb 2017, 10:04 I am using a PIR module with a Sonoff wireless smart switch.
https://www.itead.cc/sonoff-wifi-wireless-switch.html
I modified the PIR module to bypass its 3.3v power regulator and then connected the PIR sensor to the 3.3v power header in the Sonoff switch.
Works very reliably in my kitchen switching my under unit and other spotlights. Love it. The sonoff is very reasonably priced, and basically gives you everything that you need to complete the project.
-
- Normal user
- Posts: 63
- Joined: 08 Aug 2016, 23:42
Re: PIR in 3.3V and ESP8266-01
espeasy.items
espeasy.rules
On the Sonoff:
rule
Task 1: System Uptime (not needed really)
Task 2:
Task 3:
Code: Select all
Switch kitchenPIR "Kitchen Motion Sensor" <kitchen> (Sensor) { mqtt="<[broker:/KitchenMood/pir/Switch:command:ON:1],<[broker:/KitchenMood/pir/Switch:command:OFF:0]" }
Switch kitchenDownlights "Kitchen Lights" <light> (lights,downstairs_lights,backroom_lights) [ "Switchable" ] { mqtt=">[broker:/KitchenMood/gpio/12:command:ON:1],>[broker:/KitchenMood/gpio/12:command:OFF:0]" }
Code: Select all
var Number counter = 0
var Number lastCheck = 0
rule "kitchenLightOn"
when
Item kitchenPIR changed from OFF to ON
then
counter = counter + 1
//sendCommand(br_x10_lamp, ON)
sendCommand(kitchenDownlights, ON)
end
rule "kitchenLightOff"
when
Time cron "0 0/3 * * * ?"
then
if(lastCheck == counter) {
counter = 0
lastCheck = -1;
//sendCommand(br_x10_lamp, OFF)
sendCommand(kitchenPIR, OFF)
sendCommand(kitchenDownlights, OFF)
} else {
lastCheck = counter
}
end
rule
Code: Select all
on pir#Switch do
if [pir#Switch]=0
gpio,13,1
else
gpio,13,0
endif
endon
Task 2:
Code: Select all
Device: Switch input
Name: pir
Delay: 0 (Optional for this device)
IDX / Var: 1
1st GPIO: GPIO-12
Pull UP: false
Inversed: false
Switch Type: switch
Switch Button Type: Normal Swtch
Send Boot state: false
Send Data: true
Global Sync: false
Optional Settings Value
Value Name 1: Switch
Code: Select all
Device: Switch input
Name: status
Delay: 0 (Optional for this device)
IDX / Var: 5
1st GPIO: GPIO-12
Pull UP: false
Inversed: false
Switch Type: Switch
Switch Button Type: Normal Switch
Send Boot state: false
Send Data: true
Global Sync: false
Optional Settings Value
Value Name 1: Switch
Who is online
Users browsing this forum: Anthropic Claude Bot [bot] and 18 guests