I'm working with ESP8266 Wemos D1 Mini and HC SR-501 (PIR sensor) in one particular project (please, see the circuit image in annex). The question is the HC SR-501 stay always LOW. I tried change the PIR Sensor by ultrasonic sensor (HC SR-04) and the circuit works fine (obviously, little things was changed)! Why this circuit not work with PIR sensor? Could be the PIR sensor with some problem? PS: i used two PIR sensor and both not work.
Figure 1. Extract from the PIR datasheet.
The datasheet shows that the device is 3.3 V. You are feeding it into 5 V logic so you need a level shifter.
Figure 2. A simple level-shifter.
If you enable the pull-ups on your micro's inputs then you may omit R2. Note that the circuit inverts the logic from the PIR.
Notes on your schematic:
- In general the high voltage rails should be on the top of the schematic and the lower voltages towards the bottom. It makes it much easier to read.
- Use one ground symbol for each point that is grounded. This reduces clutter and clearly shows the voltage at that point without having to trace back to the PSU.
1) I'm feeding the PIR with a 5 vdc. Note that 3.3v logic is the output signal of the sensor, and send 0v when not body detect and 3.3v when body detect. In the most examples on the web, i don't see the people using resistors and/or transistors, because the 3.3v is the same I/O voltage that ESP8266 operate.
Figure 2. The PIR datasheet clearly shows that the whole circuit is fed from a 7133-1 voltage regulator. This is a low drop-out 3.3 V regulator. The maximum PIR output voltage will be 3.3 V.
2) In your circuit, what Q1 transistor? It's not clear for me.
Any small-signal NPN transistor will work. 2N2222 is an example.