0
\$\begingroup\$

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.

Thank your for help.enter image description here

\$\endgroup\$
  • \$\begingroup\$ Please add links to the datasheets so that we don't all have to search for them. \$\endgroup\$ – Transistor Feb 17 '18 at 9:34
  • \$\begingroup\$ The pir sensor works if you disconnect the output form esp8266? Check with a voltmeter. Have you set D2 as input? \$\endgroup\$ – Dorian May 3 at 10:51
  • \$\begingroup\$ I do see a 1k resistor in series with the output on the HC SR-501. This is not present on HC SR04 that means it has a better current capability. That could explain why one is working and the other not if you forgot to set D2 as input or some peripheral has the control or a pull-down is activated. \$\endgroup\$ – Dorian May 3 at 11:12
-1
\$\begingroup\$

enter image description here

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.

schematic

simulate this circuit – Schematic created using CircuitLab

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.

enter image description here

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.

\$\endgroup\$
  • \$\begingroup\$ Ok Transistor, thanks for your reply. But analysing your post, i perceive two things: 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. 2) In your circuit, what Q1 transistor? It's not clear for me. Thank you again for your reply. \$\endgroup\$ – Cayo Fontana Feb 17 '18 at 13:02
  • \$\begingroup\$ See the update. \$\endgroup\$ – Transistor Feb 17 '18 at 14:59
  • 1
    \$\begingroup\$ Please correct this. The advice of shifting the output to 5V is wrong, and will fry the ESP8266, which notoriously has a 3V3 logic. \$\endgroup\$ – Elmesito Nov 20 '18 at 18:26
  • \$\begingroup\$ @user156047: In that case it's already fried. OP has it powered from 5 V. I'm not familiar with the board and OP provided no datasheet links. Does it use 3.3 V internally? In any case I think my update should make it clear. Thanks for the feedback. \$\endgroup\$ – Transistor Nov 20 '18 at 22:04
  • 1
    \$\begingroup\$ a quick google search for the wemos schematic, reveals that there is a regulator that takes the 5V down to 3V3. The board is not fried, until you put the level shifter in. wiki.wemos.cc/_media/products:d1:sch_d1_mini_v3.0.0.pdf \$\endgroup\$ – Elmesito Nov 21 '18 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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