3

I'm working on a project similar to a security camera with a Raspberry Pi NoIR Camera Module v2 and a FLIR Lepton 3.5 on a purethermal 2.

I am somewhat new to this and am not sure how to proceed. I need to have the program trigger from a motion detector (PIR) attached to a GPIO pin and activate either the camera or FLIR depending on the time of day. I also need the system to store 5 jpegs a second of the stream while there is still motion. I am currently attempting to run video and use gstreamer to convert certain frames to jpeg because this seems more reliable than the still features. Any help would be appreciated.

Does anyone know how to capture and switch between these cameras as well as continue the stream while there is motion?

4
  • forgot to mention max resolution required is 640x480
    – Ben0547
    Commented Apr 10, 2019 at 21:23
  • Yes, so I found a cheapy Logitech webcam with 640 x 480 pixels can do the job well. Even AlphaGo cannot handle higher resolution than a chess board. RpiCamV2 with 3280 × 2464 pixels is a ridicuious overkill. You need to reduce RpiCam to 640x480 to do AI (and from RGB to black and white, my goodness!). That was why I abandoned RpiCam and switched to LogiTechCam.
    – tlfong01
    Commented Apr 11, 2019 at 1:48
  • Then I found web cameras a bit bulky. I also tried Rpi high resolution type but with wide angle. Finally I found the narrow angle CCD cameras for parking car, also with cheapy 5" PAL i480 LCD monitor best suited for my home security system. I am showing some more pictures. You might like to let me know which more look like yours.
    – tlfong01
    Commented Apr 11, 2019 at 4:09
  • I just found that the new generation PIR chip AM312 is DSP, low power is is much better than the old chip DS0001. So I am going to order one from TaoBao. unusualelectronics.co.uk/as312-am312-mini-pir-module-review
    – tlfong01
    Commented Apr 12, 2019 at 4:25

1 Answer 1

1

Question

Let me summarize your project.

  1. You have two cameras, one day camera, another, night camera.

  2. You have one PIR sensor, connected to Rpi which gets alerted if a naughty cat comes in.

  3. If it is day time, Rpi switches on camera and starts streaming video, extracts to 5 jegs a second and stops as soon as the thing has left.

  4. Similarly the night camera at night.

Short Answer

Some time ago I used Rpi, Rpi Camera, and also cheap Logitech web cameras to do similar things and found many open software tools and libraries helpful.

Now I have learnt how to use python to interface real time clock DS3231. Perhaps I can do system integration this time, starting with PIR. Perhaps I can also add Google Tensor Flow cat face detection, ...

pir modules

web cam and mon

References

AI to identify cats 2012 and 5000 species 2017 - Dave Gershgorn 2017apr11

Cats🐱 vs Dogs🐶 Leveraging Convolutional Neural Networks and Google Colab Free GPU - Greg Surma 2018nov18

Edge TPU - cloud google

Coral Local/Offline AI (Mendel/Debian, Tensor Flow Lite, Python) - Google

Edge TPU USB Accelerator (Raspberry Pi, Debian) - USD$74.99 https://coral.withgoogle.com/products/accelerator/ https://coral.withgoogle.com/tutorials/accelerator-datasheet/

Update 2019apr11htk1049

More References

Adafruit PIR Sensor Tutorial - Introducing PIR https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/overview

Adafruit PIR Sensor Tutorial - Connecting to PIR https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/connecting-to-a-pir

Adafruit PIR Sensor Tutorial - Testing PIR https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/testing-a-pir

PIR BISS00012 Micro Power PIR Motion Detector IC Datasheet - Shanghai JX 2005 http://www.ladyada.net/media/sensors/BISS0001.pdf

PIR BISS00012 Micro Power PIR Motion Detector IC Datasheet in Chinese - Shanghai JX 2005 http://www.ec66.com/market/sheet/biss0001.pdf

AliExpress PIR sensor module catalog https://www.aliexpress.com/w/wholesale-pir-sensor-module.html

TaoBao PIR Sensor Module Catalog https://risym.tmall.com/search.htm?q=%C8%CB%CC%E5%B8%D0%D3%A6%C4%A3%BF%E9+&navigator=all&_input_charset=&spm=a21bp.7806943.20151106.1

TaoBao HC-SR501 PIR Module CN¥3.60 https://item.taobao.com/item.htm?spm=a312a.7700824.w4002-18130655753.30.569b21fci4bMs6&id=589581993055

Update 2019apr11hkt1210

Smart Home Security System Hardware Selection - Final Version

Now the time has come to do some experiments.

car park, wide angle ccd cameras

PIR Module Configuration Notes

Now I am looking at my PIR module to decide how to config, based on Adrfruit's instructions.

pir_module

This is Adafruit's instruction

PIR Config

Now I know other's modules have two pots, me only one. Other guys have a jumper to set High Low, me no jumper, but soldered as High. I need to check up the chip spec to see what High level configs.

Now I am learning how to config the PIR chip

PIR Module config notes

Arduino, CircuitPython, but no Raspberry Pi!

Lady Ada teaches how to test the PIR, then shows example Arduino code, then CircuitPython code - BUT RASPBERRY PI CODE IS SKIPPED!

I don't know circuit python and I am too lazy to learn. What can I do?

AdaFruit PIR Motion Sensor Arduino and CircuitPython Code Example

/ to continue, ...

5
  • Yes that is a similar setup, i'm just don't understand exactly how to even start with the python code to integrate the motion sensor and determine the cameras. I have some basic command lines that seem to be running but typically for these cameras to initialize you set a run time to they don't run continuously while there is movement
    – Ben0547
    Commented Apr 11, 2019 at 1:20
  • Thank your for confirmation. Let us first see how to talk to PIR using python, and forget the cameras now.
    – tlfong01
    Commented Apr 11, 2019 at 1:40
  • I had some basic code that would tell me if there was currently movement or not. I imagine with this I could use a while to run the cameras I'm just not certain how to make the cameras run for the entirety and then encode the frames.
    – Ben0547
    Commented Apr 11, 2019 at 2:09
  • import RPi.GPIO as GPIO<br/> import time<br/> GPIO.setwarnings(False)<br/> GPIO.setmode(GPIO.BCM)<br/> GPIO.setup(4, GPIO.IN)<br/> <br/> while True:<br/> i = GPIO.unput(4)<br/> if i == 0:<br/> print"Movement", i<br/> if i == 1:<br/> print"No Movement", i<br/> time.sleep(1)<br/>
    – Ben0547
    Commented Apr 11, 2019 at 2:09
  • Ah, I forgot how the PIR thing works. So I am asking Lada Ada for help. See your later. learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/…
    – tlfong01
    Commented Apr 11, 2019 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.