Raspberry90
Posts: 3
Joined: Fri Oct 27, 2023 6:53 pm

Help with a Raspberry Pi 4 project.

Fri Oct 27, 2023 6:59 pm

I’m working on a project for my Raspberry Pi 4. I’m a beginner so I was wondering if anyone can help me setting up the components on the Raspberry Pi? And if possible also help me out with some of the coding? I’m willing to pay money for it.

What I want to create:

1. The Raspberry must be connected to the internet. If not connected then this must be reported.
2. During the day the lamp is off.
3. If motion is detected after sunset and before sunrise, the lamp will turn on.
4. You can view all values ​​of the sensors on your smartphone.
If you are present in the house:
5. When the smart doorbell is pressed, the bell rings.
6. If you are not present in the house, the vigilance mode (see below) will be set.
In vigilance mode:
7. If motion is detected, the bell will give an acoustic alarm of 3 × 3 seconds and the lamp will turn on
8. When the smart doorbell is pressed, you will receive a notification on your smartphone.

ame
Posts: 8701
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Help with a Raspberry Pi 4 project.

Fri Oct 27, 2023 11:46 pm

Congratulations. You've just invented Domoticz (or Home Assistant, or whatever).
Oh no, not again.

W. H. Heydt
Posts: 16477
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Help with a Raspberry Pi 4 project.

Sat Oct 28, 2023 12:55 am

Raspberry90 wrote:
Fri Oct 27, 2023 6:59 pm
1. The Raspberry must be connected to the internet. If not connected then this must be reported.
How do you propose to report no internet connection? (At least, other than locally, and in that case you'd be there to know about it.)

cleverca22
Posts: 8606
Joined: Sat Aug 18, 2012 2:33 pm

Re: Help with a Raspberry Pi 4 project.

Sat Oct 28, 2023 1:13 am

W. H. Heydt wrote:
Sat Oct 28, 2023 12:55 am
Raspberry90 wrote:
Fri Oct 27, 2023 6:59 pm
1. The Raspberry must be connected to the internet. If not connected then this must be reported.
How do you propose to report no internet connection? (At least, other than locally, and in that case you'd be there to know about it.)
where i work, we use https://deadmanssnitch.com/ heavily

in this case, the pi will be phoning in to deadmanssnitch at regular intervals
if anything goes wrong, and it cant check in, then deadmanssnitch will email/text you automatically, to let you know that something has gone wrong

W. H. Heydt
Posts: 16477
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Help with a Raspberry Pi 4 project.

Sat Oct 28, 2023 1:21 am

cleverca22 wrote:
Sat Oct 28, 2023 1:13 am
W. H. Heydt wrote:
Sat Oct 28, 2023 12:55 am
Raspberry90 wrote:
Fri Oct 27, 2023 6:59 pm
1. The Raspberry must be connected to the internet. If not connected then this must be reported.
How do you propose to report no internet connection? (At least, other than locally, and in that case you'd be there to know about it.)
where i work, we use https://deadmanssnitch.com/ heavily

in this case, the pi will be phoning in to deadmanssnitch at regular intervals
if anything goes wrong, and it cant check in, then deadmanssnitch will email/text you automatically, to let you know that something has gone wrong
That still begs the question of trying to report an internet outage...with no internet to carry the message.

cleverca22
Posts: 8606
Joined: Sat Aug 18, 2012 2:33 pm

Re: Help with a Raspberry Pi 4 project.

Sat Oct 28, 2023 1:26 am

W. H. Heydt wrote:
Sat Oct 28, 2023 1:21 am
That still begs the question of trying to report an internet outage...with no internet to carry the message.
thats the whole point of deadmanssnitch

the lack of you reporting anything, is what sets off the alarm
so when the internet goes out, you cant send the "everythings ok" message, so deadmanssnitch assumes "everything is on fire" and pages you

W. H. Heydt
Posts: 16477
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Help with a Raspberry Pi 4 project.

Sat Oct 28, 2023 1:55 am

cleverca22 wrote:
Sat Oct 28, 2023 1:26 am
W. H. Heydt wrote:
Sat Oct 28, 2023 1:21 am
That still begs the question of trying to report an internet outage...with no internet to carry the message.
thats the whole point of deadmanssnitch

the lack of you reporting anything, is what sets off the alarm
so when the internet goes out, you cant send the "everythings ok" message, so deadmanssnitch assumes "everything is on fire" and pages you
Still pretty vague. You get a message that an "I'm alive" message wasn't received. That still doesn't tell you what is wrong. Could be internet outage. Could be the power is out. Could be the Pi crashed. Could be you didn't write the messaging script correctly. So it just tells you "something" is wrong, but can't specify *what* is actually the problem.

cleverca22
Posts: 8606
Joined: Sat Aug 18, 2012 2:33 pm

Re: Help with a Raspberry Pi 4 project.

Sat Oct 28, 2023 1:59 am

yeah
but in most of those cases, you will need to do something to fix things

and at least your now aware that something is wrong, and could begin to investigate it
rather then getting a call at 6am when somebody complains about the lights not turning on

Raspberry90
Posts: 3
Joined: Fri Oct 27, 2023 6:53 pm

Re: Help with a Raspberry Pi 4 project.

Tue Nov 28, 2023 7:49 pm

Hi, so now I know which components to use on the breadboard. Could someone help me out with it? I can share a technical scheme as well.

Connected to the pin of Raspberry Pi, the PIR sensor will detect motion. The PIR sensor will send a signal to the Raspberry Pi. The Raspberry Pi 4 will then activate the buzzer. The buzzer will sound until the motion stops.

In order to set up the circuit, you have to follow steps like the following:

1. Connect the 5V power supply to the VCC pin of the PIR sensor, COM pin of the relay, and the buzzer sub-circuit as shown in the scheme.
2. Connect the 330 ohm resistor to the LED and the other end of the resistor to the relay.
3. Connect one relay's IN pin to the GP18 pin of the Raspberry Pi 4, and the other relay pin to ground.
4. Connect one buzzer pin to GP12 pin of the Raspberry Pi 4, and the other buzzer pin to ground.
5. Connect one pin of PIR sensor to GP17 pin of the Raspberry Pi 4.

Someone else will write Python code for me to control the smart doorbell circuit. This code will continuously monitor the PIR sensor and turn on the buzzer if motion is detected. The buzzer will stay on until the motion stops.

ame
Posts: 8701
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Help with a Raspberry Pi 4 project.

Tue Nov 28, 2023 7:53 pm

Raspberry90 wrote:
Tue Nov 28, 2023 7:49 pm
Hi, so now I know which components to use on the breadboard. Could someone help me out with it? I can share a technical scheme as well.

Connected to the pin of Raspberry Pi, the PIR sensor will detect motion. The PIR sensor will send a signal to the Raspberry Pi. The Raspberry Pi 4 will then activate the buzzer. The buzzer will sound until the motion stops.

In order to set up the circuit, you have to follow steps like the following:

1. Connect the 5V power supply to the VCC pin of the PIR sensor, COM pin of the relay, and the buzzer sub-circuit as shown in the scheme.
2. Connect the 330 ohm resistor to the LED and the other end of the resistor to the relay.
3. Connect one relay's IN pin to the GP18 pin of the Raspberry Pi 4, and the other relay pin to ground.
4. Connect one buzzer pin to GP12 pin of the Raspberry Pi 4, and the other buzzer pin to ground.
5. Connect one pin of PIR sensor to GP17 pin of the Raspberry Pi 4.

Someone else will write Python code for me to control the smart doorbell circuit. This code will continuously monitor the PIR sensor and turn on the buzzer if motion is detected. The buzzer will stay on until the motion stops.
Those steps you have provided are awful. Seriously, where did they come from?
Oh no, not again.

Raspberry90
Posts: 3
Joined: Fri Oct 27, 2023 6:53 pm

Re: Help with a Raspberry Pi 4 project.

Tue Nov 28, 2023 10:25 pm

ame wrote:
Tue Nov 28, 2023 7:53 pm
Raspberry90 wrote:
Tue Nov 28, 2023 7:49 pm
Hi, so now I know which components to use on the breadboard. Could someone help me out with it? I can share a technical scheme as well.

Connected to the pin of Raspberry Pi, the PIR sensor will detect motion. The PIR sensor will send a signal to the Raspberry Pi. The Raspberry Pi 4 will then activate the buzzer. The buzzer will sound until the motion stops.

In order to set up the circuit, you have to follow steps like the following:

1. Connect the 5V power supply to the VCC pin of the PIR sensor, COM pin of the relay, and the buzzer sub-circuit as shown in the scheme.
2. Connect the 330 ohm resistor to the LED and the other end of the resistor to the relay.
3. Connect one relay's IN pin to the GP18 pin of the Raspberry Pi 4, and the other relay pin to ground.
4. Connect one buzzer pin to GP12 pin of the Raspberry Pi 4, and the other buzzer pin to ground.
5. Connect one pin of PIR sensor to GP17 pin of the Raspberry Pi 4.

Someone else will write Python code for me to control the smart doorbell circuit. This code will continuously monitor the PIR sensor and turn on the buzzer if motion is detected. The buzzer will stay on until the motion stops.
Those steps you have provided are awful. Seriously, where did they come from?
My tutor wrote it down for me. I attached the technical scheme, maybe adding a scheme would make it easier?
Attachments
IMG_6679.jpeg
IMG_6679.jpeg (126.82 KiB) Viewed 2299 times

ame
Posts: 8701
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Help with a Raspberry Pi 4 project.

Tue Nov 28, 2023 11:06 pm

Raspberry90 wrote:
Tue Nov 28, 2023 10:25 pm
ame wrote:
Tue Nov 28, 2023 7:53 pm
Raspberry90 wrote:
Tue Nov 28, 2023 7:49 pm
Hi, so now I know which components to use on the breadboard. Could someone help me out with it? I can share a technical scheme as well.

Connected to the pin of Raspberry Pi, the PIR sensor will detect motion. The PIR sensor will send a signal to the Raspberry Pi. The Raspberry Pi 4 will then activate the buzzer. The buzzer will sound until the motion stops.

In order to set up the circuit, you have to follow steps like the following:

1. Connect the 5V power supply to the VCC pin of the PIR sensor, COM pin of the relay, and the buzzer sub-circuit as shown in the scheme.
2. Connect the 330 ohm resistor to the LED and the other end of the resistor to the relay.
3. Connect one relay's IN pin to the GP18 pin of the Raspberry Pi 4, and the other relay pin to ground.
4. Connect one buzzer pin to GP12 pin of the Raspberry Pi 4, and the other buzzer pin to ground.
5. Connect one pin of PIR sensor to GP17 pin of the Raspberry Pi 4.

Someone else will write Python code for me to control the smart doorbell circuit. This code will continuously monitor the PIR sensor and turn on the buzzer if motion is detected. The buzzer will stay on until the motion stops.
Those steps you have provided are awful. Seriously, where did they come from?
My tutor wrote it down for me. I attached the technical scheme, maybe adding a scheme would make it easier?
That might be worse.

Looking at it one piece at a time, is the output of the PIR sensor safe to connect to the Pi GPIO? The PIR is powered from 5V, but the Pi GPIO input must not exceed 3.3V. Can the PIR operate with a 3.3V supply?

Next, what relay module are you using? If it's a bare relay wired as shown, it won't work. And what does the relay do? Is the LED a stand-in for some later function?

Next, why use a single GPIO for the button and the buzzer?
Oh no, not again.

User avatar
davidcoton
Posts: 7398
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Help with a Raspberry Pi 4 project.

Wed Nov 29, 2023 12:03 am

ame wrote:
Tue Nov 28, 2023 11:06 pm
why use a single GPIO for the button and the buzzer?
It's worse than that. If GP12 is output and low, and you push the button, it will produce smoke signals. At least the first time. Possibly not after that, but you will need a new Pi. Of course, either the PIR or the relay might have damaged the Pi before that.
Location: 345th cell on the right of the 210th row of L2 cache

User avatar
neilgl
Posts: 7450
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Help with a Raspberry Pi 4 project.

Tue Dec 05, 2023 9:00 am

Usually the cheap HC-SR501 PIR modules operate at 5V but have the output at 3.3V (or 0V) - check the data sheet.
Mine are like that and connect to the pi GPIO OK:
Attachments
pir to pi4 sz.jpg
pir to pi4 sz.jpg (221.86 KiB) Viewed 1802 times

ame
Posts: 8701
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Help with a Raspberry Pi 4 project.

Tue Dec 05, 2023 9:30 am

neilgl wrote:
Tue Dec 05, 2023 9:00 am
Usually the cheap HC-SR501 PIR modules operate at 5V but have the output at 3.3V (or 0V) - check the data sheet.
Mine are like that and connect to the pi GPIO OK:
We are not privy to part numbers. Or data sheets. Kids these days don't read them anyway.
Oh no, not again.

Return to “Wanted”