Help basic project

Hi, im a beginner, please be gentle…

in this project I need to make a smart door that can be locked/unlocked through Blynk app

Components:

  1. NODEMCU ESP8266
  2. PIR Motion Sensor (to send notifications that there are someone infront the door)
  3. 5V RELAY MODULE
  4. SOLENOID DOORLOCK
  5. 9V BATTERY

My wires connection:

PIR Motion Sensor:
VCC -> D1
OUT -> 3V3
GND -> GND

5V Relay Module:
IN -> D2
GND -> GND
VCC -> Vin

Solenoid Door Lock:
RED -> Relay’s NO
BLACK -> 9V Battery

—————————

The code I’m using is just basics to try PIR Motion Sensor and Solenoid Door Lock working or not before combining them as one.

I think the battery is not working or might be inserted wrongly, right now I am using this battery (picture provided)

Another problem is, my motion sensor always detect eventhough I have adjusted the sensitivity and delay.

Please any advice or help is really appreciated, thankyou so much!

Please read the pinned post re 'how to get the most from this forum'. I will tell you using a 9V battery can be a problem, to get started, use USB or a wall wart.
Yes, PIRs are notoriously finicky, I hope you ordered 10. You do understand they measure heat.

1 Like

If you are a starter , then I would play with some of the examples , turning a led on/off and build from there. As an initial project this is too hard .
If this is a school task , you should know enough to do the project.

I think the PIR is connected wrongly , the battery will not drive a solenoid. The micro will/may not drive the relay ( voltage wrong, too little current capability )

You really ought to show a circuit diagram , your code , and links to important parts (PIR)- as per the previous post

1 Like

... and your body heat is nearby.

1 Like

Yes, giving a constant high reading. Place the PIR inside a box and make sure NO heat source is nearby. That likely means the 8266 and you should be as far as possible from the PIR. Also, I do recall there are some settings on the PIR and maybe a jumper? They are a bit hard to understand but just test with pots at extreme settings.
Also, you have not done what you were told in post #2. Code, error logs, wiring diagram. Read the introductory post first, so you know how to do those things.l

1 Like

PIR Motion Sensor:
VCC -> D1 3V3
OUT -> 3V3 D1
GND -> GND

1 Like

I've had PIRs that took longer than I would like to come to some equilibrium with the environment.

So add taking a break whilst it does.

a7

2 Likes

Yes, they are a real pain except for very specific use cases which this project is not. As I recall the better sensors had two controla on board that affected sensitivity and what part of the wave was the triger or something like that. What the OP should be looking for is a 'human presence' detector. Often found on the corners of modern cars so we don't run people over.

1 Like

I've had good results with this product

The last minute engineers didn't seem to need it, but I had success only after some power supply deemphasis.

Here just two sections of small resistor and an electrolytic capacitor. I don't recall the values, I can look later at one of the several that do things around the lab.

It may not be what moved me from frustration to joy; now I use it with the rcwl0516 for luck. :expressionless:

It can "see" through walls and had other characteristics that warrant experimenting. I test sensors like this just by letting them control an LED I can see from wherever I hope to not have it sense anythjng.

HTH

a7

1 Like

I used one of those in my kitchen to turn on the lighting. It 'saw' me at about 15 ft through the wall of a kitchen island.

Here is a PIR with the two controls I mentioned. https://amzn.to/40o25Lu

1 Like

Did you set the H/L jumper correctly?



source:

Another trick with these PIR sensors is to set them back inside a toilet paper tube cut in half. It helps to "aim" the sensor in a way.

Can you explain to me about battery will not drive the solenoid, because I followed a YouTube tutorial. I use the same components as them (except battery type and PIR bcs i have to add one more sensor).

And when I run the code:

const int RELAY_PIN = 4; // Relay connected to D2 (GPIO4)

void setup() {
  Serial.begin(115200);
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, LOW); // Start with the relay off (locked)
  Serial.println("Solenoid Lock Test Ready.");
}

void loop() {
  Serial.println("Unlocking...");
  digitalWrite(RELAY_PIN, HIGH); // Turn on the relay to unlock the door
  delay(5000); // Keep it unlocked for 5 seconds

  Serial.println("Locking...");
  digitalWrite(RELAY_PIN, LOW); // Turn off the relay to lock the door
  delay(5000); // Keep it locked for 5 seconds
}

The 5V relay did turn on both LED (power n switch i guess). It is just I want it to relay and move the solenoid lock.

Thankyou…

Yes, PIR Motion Sensor might be troublesome for this project. But, I have limited sensors because I have to use what is available in the class (the sensor is just add-on, it can be any sensor actually that makes the ‘Smart Door’ better)

Do you have any ideas of common and easy to setup sensor that are suitable for a Smart Door? The only sensor that came to my mind is PIR motion and Camera module, but I will try to find the ‘human presence’ sensor you mentioned.

Thankyou…

oh btw the code here is just for me to test the functional of

5v relay, selenoid doorlock and battery.

The 9v batteries have a low capacity and relatively high internal resistance - so cannot drive high current loads and are designed not too . They appear in projects as the “ 9v battery “ is often an easily available icon for a battery , and after all , anyone can post an on line project …
You need use a number of AA type batteries as a starting point .

You could look at home alarm type PIR sensors which are more reliable , but might need 12v (unsure) .

Example

1 Like

I don't do homework.

1 Like

alright, i understand better now, thankyouu for you explaination and advice!

alright, thankyou for your previous information and advices. I did learn from your replies! Thankyou !

PIR sensors have a multi-lense that concentrates infrared-radiation to multiple parts of the sensor.

If an object with a higher temperatur walks through the sight-field of the sensor the higher radiation falls into different parts of the sensor. This causes a change inside the sensor.
And the circuitry detects these changes.

This is the reason why PIR-sensors work outside from coldest winter to warm summer.
If an object with a different temperature than the background moves through the sight-field of the sensor the sensor-signal-change triggers the PIR-module.

Me personal I have never had any problems with different kinds of PIR-sensors.
Though most of them are more professional than these small and cheap "arduino"-PIR-modules.

Different sensors would be

  • a light barrier
  • a radar-sensor
  • doormat which changes resistance of you step on the doormat

You should really post a hand-drawn schematic.
Sure ! Hand-drawn but following the professional rules how to draw schematics.
Frizzing-picture became very popular but are unprofessional as hell.

Here is a tutorial that explains it

1 Like