Convert a 5v PIR Motion Sensor to 3.3v for ESP8266

18,071

31

16

Posted

Introduction: Convert a 5v PIR Motion Sensor to 3.3v for ESP8266

Do you have a PIR Motion Sensor that you would like to use with your 3.3 volt Arduino or an ESP8266 (NodeMCU), or maybe a Raspberry PI. Well the standard el-cheapo Chinese PIR Sensor accepts 5 volts in the VCC pin(actually 5v to 20v) and will not work at 3.3 volts. In this Instructable I'll show you how you can use a standard HC-SR501 PIR Infrared Motion Sensor with an ESP8266 or other 3.3 Volt micro-controller.

Check out my YouTube video also. Youtube Video

Step 1: Solder a Wire Onto the Voltage Regulators Middle Terminal

In my tests the HC-SR501 PIR Motion Infrared Sensor falsed when I attempted to use 3.3 volts at the VCC input pin. Luckily there is a simple solution to get the Motion Sensor to work with 3.3 volts boards like the ESP8266.

UPDATE!!! Thanks to Dosman71 - I originally said to solder to the middle terminal of the onboard regulator, This is WRONG!! The terminal you need to solder the wire to is the one on the RIGHT of the voltage regulator if the three pins are facing you. Ignore the Picture above and disregard what I said in the YouTube video

We need to simply solder a wire to the RIGHT terminal of the onboard voltage regulator. This regulator was designed to convert the high voltages coming from the Arduino (5 volts) or other devices(up to 20v) down to 3.3 volts logic; however, the ESP8266 works at 3.3volts and this regulator is not needed. So we need to bypass it!

The motion sensor internals actually work at 3.3 volts and the trigger pin (the middle terminal between the VCC and Ground) outputs 3.3 volts.

Step 2: Connect and Upload the Code

Next simply connect the other end of the wire you just soldered to the PIR sensors voltage regulator to the 3.3v power supply from your Arduino or ESP8266 (NodeMCU) and then connect the Ground and Trigger Pin and think of all the new projects you can do with your new sensor.

The Example code be found at Adafruit's website below

https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/using-a-pir

Now you can have your ESP8266 send you a text message over WIFI notifying you when someone is at your front door, or when the mailman opened the mailbox door, or when the UPS man left a package. Have fun!

Share

Recommendations

  • Spotless Contest

    Spotless Contest
  • Pocket-Sized Contest

    Pocket-Sized Contest
  • Microcontroller Contest

    Microcontroller Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

13 Comments

you can do that put Vcc on Pin Header Labelled H and it will work instead of soldering the Vcc wire to the output of regulator, it is the same thing

have fun

You don't need to solder anything. The free PIN from Jumper serv 3.3 V :)

Actually the jumper pin on the HC-SR501 is used to determine whether or not the sensor will reset after an initial detection. I don't believe it affects the voltage in anyway.

lol AndreasO1 is correct. The jumpers serve to either pull pin 1 of the BISS001 chip high or low. You don't need to solder anything. One of the jumper pins is directly connected to Vout of the regulator.

Google "hc-sr501 schematic" and look at the jumper pins.... :)

In fact you can connect power directly to the correct jumper pins.

Hello,

I think you made a mistake : the voltage regulator on
the board is a HT7133 so pin 2 is "power input". You have to solder your
wire on pin 3, which is "power output".

So why does your
solution works ? It's because by injecting the 3.3V directly to the
regulator you are bypassing the polarity protection diode and it's
voltage drop.

However the way he did it does bypass the diode and pass thru the regulator which in return will clean up any voltage ripples depending on the voltage source. So either will work. It just depends on how you intend to power the sensor. ;) Good catch though as it is important to read the datasheets.

LOL....I was just about to say the exact same thing until I saw your post.

You are absolutely right! Thanks for pointing out my mistake.

Nifty, but what about current ?

I read standard 5v PIR Motion Sensor require about 50mA of current to operate, which is way more than esp8266 GPIO pin can source.

you are feeding the PIR from a 3V3 source, not from a GPIO pin