Posts

Showing posts with the label raspberrypi

Self-contained Raspberry Pi surveillance System Without Continue Internet

Image
                                                                gemini generated A  self-contained Raspberry Pi surveillance system that: Runs autonomously (like EyeOS) — camera always active and streaming. Keeps searching for a known Wi-Fi hotspot (your phone) . Starts streaming automatically when the phone hotspot is available. Lets you view the camera feed on your phone (via browser or app). Here’s a detailed, production-ready setup: ⚙️ Step 1: Setup Raspberry Pi Camera & Software 1. Enable the camera sudo raspi-config Go to Interface Options → Camera → Enable Reboot: sudo reboot 2. Install dependencies sudo apt update sudo apt install python3-picamera2 python3-flask git -y 📸 Step 2: Create a Local Flask Streaming App Create file /home/pi/camera_stream.py : from flask import Flas...

Run Two Systemd Services Alternately

To achieve the desired sequence where `app1` starts, runs for 10 minutes, then `app2` starts and runs for 10 minutes, and this cycle repeats, you can create two separate timer units and services, one for each application, and use a cyclic approach. Here's how you can do it: 1. Create two timer units, one for each application, with cyclic activation:    `myapp1.timer`:    ```ini    [Unit]    Description=Timer for My Application 1    [Timer]    OnBootSec=10min    OnUnitInactiveSec=10min    [Install]    WantedBy=timers.target    ```    `myapp2.timer`:    ```ini    [Unit]    Description=Timer for My Application 2    [Timer]    OnBootSec=20min    OnUnitInactiveSec=10min    [Install]    WantedBy=timers.target    ``` In this configuration, `myapp1.timer` is set to trigger `myapp1.service` 10 minut...

OTA for Python application running in raspberry pi

Image
  Photo by  Glenn Carstens-Peters  on  Unsplash Remote AI/Machine Learning application running on Raspberry Pi required to update whenever new files or models etc updated into the repo eg. GitHub We can use the Over The Air method to update them.  You should have a Python application running maybe with Flask or using another MVC. To run a Python Flask application as a server on a Raspberry Pi, you can follow these steps: Install Flask using pip. You can install Flask by running the following command in your terminal: pip install flask Create a Flask application in a Python script. Here is an example Flask application that responds with “Hello, world!” to all requests: from flask import Flask app = Flask(__name__) @app.route(‘/’) def hello_world(): return ‘Hello, world!’ if __name__ == ‘__main__’: app.run(debug=True, host=’0.0.0.0') Save the script to a file, for example /home/pi/my-flask-app.py. Start the Flask application by running the Python script in your te...