• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

esp8266

Q&A Forum › Category: ESP8266 › esp8266
0 Vote Up Vote Down
Larry asked 4 years ago

     So I have gone to the tutorial to put esp8266 into deep sleep mode , built the pushbutton circuit but still don’t understand how I would accomplish deep sleep with the motion sensor. 
I believe that Steve Mercer said I put my code in the wrong place (setup) but that doesn’t answer my question as to how to get it to work properly. In the example there is a what appears to be a 10k resistor that pulls it low when pressed. I think the motion sensor has a built in resistor for it to work so do I just connect that to rst? Sorry for my inexperience but I am lost here.
      Don’t have a clue as to how this would be wired or where to implement the code properly. Do I need a transistor or a relay to see the state of the sensor and have that go to ground ? 
 

Question Tags: motion sensor
13 Answers
0 Vote Up Vote Down
Steve Mercer answered 4 years ago

From the tutorial for the ESP8266 (I don’t have one of these) it looks like you only have two options – timer and reset.
 
Using this sentence “The RST pin of the ESP8266 is always HIGH while the ESP8266 is running. However, when the RST pin receives a LOW signal, it restarts the microcontroller.” you will need to provide a low signal to the RST pin to get the 8266 to restart. Checking the data sheet for your sensor will tell you what it does when triggered. If it shorts then connect it between ground and the RST pin.You may need to create a short latching circuit for reliability.
 
Using an ESP32 gives you many more options to wake from deep sleep.

0 Vote Up Vote Down
Larry answered 4 years ago

So from what I can see it sends out a high signal 3 v so I am thinking that I would have to put that signal through a N/O set of contacts. When motion is seen it would send its signal to GPIO 14(D5)  to do the reset from RST to GND . Just wondering if I did that, then I probably don’t need any code to accomplish it provided I send the signal long enough to fire that relay . 

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

No code necessary. Once the sensor fires and it takes RST pin low, the microcontroller restarts.

0 Vote Up Vote Down
Larry answered 4 years ago

I have the NodeMcu ESP8266  running and I have turned down the sensitivity somewhat , lower the delay setting to about half (approx 2 1/2 minutes . I left it running  in a room unoccupied and got detections on my telegram 8:17,8:20, 8:24,8:28and 8:31. Thought i may be the cat but looking at the times I suspect that it is just going off for no reason .Any thoughts on this? Pretty much given up on trying to get this thing to work in deep sleep mode also.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I don’t know what sensor you have but, if it’s one that is super cheap and comes with a kit, then it’s probably gonna fire for no apparent reason (I know my one does).

0 Vote Up Vote Down
Larry answered 4 years ago

 Steve   
 HC-SR501 is the sensor I have, not very expensive but it does have LHI 781 sensor. I did change the settings for sensitivity and adjust the settings for time delay to a lower setting. 
     What I found was the sensor puts out a high signal as an out put, actually tied a led to it to watch it and set it for the length of on time, 5 seconds. 
     It still isn’t stable enough to put it somewhere as an intrusion alarm 🚨but is a little better. Testing it more tonight. 
     Wondering if I use a reset to put it into deep sleep if it would be a bit more stable.Any idea as how it could be wired using a relay or preferably a NPN transistor. I have an idea but not sure of it. If I was to take the output of the sensor to the base of the transistor then send low to rst ???

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Yes. You would have to send a low signal to the ESP8266 RST pin.
Regards,
Sara

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

This article shows you how to use a transistor as a switch.
 
Everyone out there has had trouble with false triggering of the HC-SR501 sensor. This video will give you tips on making it better.

0 Vote Up Vote Down
Larry answered 4 years ago

     Thanks Steve, interesting that in the video ,the op used 3.3v which is what I already had but then  moved the jumper on the 3 pin jumper to retrigger rather than single and then  took the 3.3v supply to pin 3 on the  jumper . So I guess I am trying that solution to see if that stabilizes the motion sensor , also extending the connections from the ESP8266 so it will move the sensor further away from the ESP8266. Not a fan of that because I am trying to keep a small footprint.
    As far as the transistor , i have used a transistor as a switch on a previous project but wasn’t really clear as to how I would connect it to this HC-SR501.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

I’m thinking that if you want a stable motion sensor you should be looking at a different one than you have. The constraints are just not worth the effort required.
 
The article I linked should have taught you how to use the transistor as a switch. Can you tell me why you are having issues in your specific situation?

0 Vote Up Vote Down
Larry answered 4 years ago

     Just having trouble wrapping my head around it , I am not good at written instructions, I am more of a hands on person. That’s why I have issues here , reading some of this stuff is not really sinking in , so I struggle with a lot of it. 
     Concepts is another thing, I really have a desire to learn this stuff but then I don’t have the imagination to create my own. 
     So no , I don’t think you can really help me much further, I just have to work harder at it and it will sink in eventually. Thanks 

0 Vote Up Vote Down
Larry answered 4 years ago

     Just having trouble wrapping my head around it , I am not good at written instructions, I am more of a hands on person. That’s why I have issues here , reading some of this stuff is not really sinking in , so I struggle with a lot of it. 
     Concepts is another thing, I really have a desire to learn this stuff but then I don’t have the imagination to create my own. 
     So no , I don’t think you can really help me much further, I just have to work harder at it and it will sink in eventually. Thanks 

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

Yes, time is the thing needed. It took me a while when I first started out with all the different types of transistors and what they could do. I wondered why you even needed them when a NAND gate could do pretty much anything you could want 😉 When I was starting out, all you could use were books. Good luck in your further endeavors.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.