PIR Motion Sensor is not working (script and logs included)

August 29, 2024, 13:53

microphonebeam

I have a PIR Motion Sensor from the Edukit Camjam 2, and i am experiencing problems, it either doesn't output anything, outputs one signal, outputs another, outputs both, or sometimes doesn't work at all. Does anyone know a fix for that?

microphonebeam

here is my script
python
from gpiozero import MotionSensor
import time

pir = MotionSensor(17)

while True:
        pir.wait_for_motion()
        print("motion")
        time.sleep(1)
        pir.wait_for_no_motion
        print("nomotion")
        time.sleep(1)
problem i am occuring: the console even thought there is no movement says i there is movement or no movement.

thunder07337

Sensor connected correctly?

microphonebeam

yes i believe

microphonebeam

also ping me when you answer

thunder07337

Believing is not knowing... Which instructions did you follow? Do you have a picture of how you connected the sensor?

microphonebeam

i followed the instructions from the worksheets of the edukit camjam2. i do have a picture and will send that to you right now, also i agian request you to ping me once i answer.

microphonebeam

im sorry i can't take a picture right now my lamp is not very good and it's dark

microphonebeam

i'll send it tommorow

thunder07337

Here your ping... But don't ping me, I'll look at my mobile phone when I have time! How about a link to the instructions?

microphonebeam

huh

thunder07337

<@655806508449398834> Then the only thing missing is the picture of how you connected it. By the way, your code does not correspond to the example... Why don't you try the example code first before you change anything.

microphonebeam

i have already tried it

microphonebeam

since the motion sensor is sending unuseful stuff it won't work

thunder07337

Then maybe he's looking at it the wrong way? But I can't judge that if I don't see it...

microphonebeam

yeah i saw a text saying you should probrally enloce it a little because it's radius is kinda high which i tried but it was still printing out the same

microphonebeam

i'll get the photo quickly

microphonebeam



microphonebeam

im not sure if that's good enough tho

microphonebeam

tell me if you need a clearer picture

microphonebeam


thunder07337

<@655806508449398834> So I can already see 1 reason why this is not working properly. You don't have a pin header on the Pi, if you connect the plugs and it can happen that no proper contact is made and then it just doesn't work properly. So it's best to solder on a pin header, then you can plug in the cables and make proper contact.

microphonebeam

does breadboard work instead?

microphonebeam

since other stuff like leds and buzzers work straight up like that

thunder07337

You may be lucky and it works, but as the plugs are only loose in the holes, any slightest movement can destroy the contact. It would be better to connect a pin header to the Pi, then there will be no problems with poor contact.

microphonebeam

does soldering make the transfering of electricity better, right?

microphonebeam

cause i once tried the pin headers without soldering and they didn't work at all

thunder07337

Yes, of course it doesn't work well or at all without solder, how else is the current supposed to flow from one component to another without contact?

oops.se

It can work if you apply pressure so the pin are pressed against the wall of the hole. But it is unreliable! I often do this when testing.

microphonebeam

i need solder paste for soldering and a solder gun, correct?

thunder07337

Solder and soldering iron, yes. It is best to use solder with lead, which is easier for beginners because it melts faster than lead-free solder. And make sure you use thin solder with thin tips, otherwise it will draw too much heat away and won't melt.

microphonebeam

i'll get back at you once i do all that stuff

microphonebeam

alright

microphonebeam

i got the stuff

microphonebeam

but i don't know what to do really

microphonebeam

what is rosin flux and do i need it?

microphonebeam

watched a few videos

microphonebeam

i mean one

microphonebeam

but do you have any ideas on what i can practice?

microphonebeam

oh wow

microphonebeam

i texted that at the same hour 20 days ago i think?

microphonebeam

almost at the same minute]

oops.se

Apply "Rosin flux" to remove oxidations during the soldering

oops.se

Here you can see the difference with flux and no flux, https://www.youtube.com/watch?v=M2Jf8cebwCs&t=786s

thunder07337

What kind of components do you have for practising?

microphonebeam

what do you mean by that?

thunder07337

You want to solder the pin header to the Pi. You want to practise soldering beforehand. So you need components such as cables or LEDs and a circuit board to practise soldering them. So what components do you have that you can use?

microphonebeam

none xd

microphonebeam

i guess i'll not practice

thunder07337

Well then, good luck