Skip to content

LukeDitria/mini_ai_camera

Repository files navigation

Mini Raspberry Pi AI Wildlife monitor!

Video here: https://youtu.be/qhY_3XCSYsM

Installing Requirements

Steps for setting up your raspberry pi! You'll need to install a few things first...

Update Pi if you haven't already

sudo apt update && sudo apt full-upgrade

Picamera2

Picamera2 will already be install on the full desktop version

On systems where Picamera2 is supported but not pre-installed (Such as the Lite OS), you can install it with

sudo apt install python3-picamera2

OR to get a slightly reduced installation with fewer of the window system related elements (USE THIS for installing on a Raspberry Pi OS Lite system)

sudo apt install python3-picamera2 --no-install-recommends

Other Requirements

IMX500 (AI Camera)

sudo apt install imx500-all

picamera2 tells us to install system wide

Therefore we need to install opencv etc, also at the system level...

E.G.

sudo apt install python3-opencv

OS Lite!

If you're using the Lite OS you will also need to install:

sudo apt install python3-picamera2 --no-install-recommends
sudo apt install git

Reboot Pi after install!

sudo reboot now

Git Clone the repo!

If using the Lite OS first

mkdir Documents

then

cd Documents
git clone https://github.com/LukeDitria/mini_ai_camera.git

Install pip requirements including system-wide packages (we need to use the system picamera2 install...)

cd mini_ai_camera/
python -m venv venv --system-site-packages
source venv/bin/activate
pip install -r requirements.txt
deactivate

Check file paths in data_logger.sh and data_logger.service are correct for you!!

Activate script

chmod +x data_logger.sh

Test run!

./data_logger.sh

Creating a service

sudo cp data_logger.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable data_logger.service
sudo systemctl start data_logger.service

You can also use the "status", "stop" and "restart" commands!

sudo systemctl status data_logger.service
sudo systemctl stop data_logger.service
sudo systemctl restart data_logger.service

It's a good idea to stop the service running if you are still setting up the Pi!

Auto Mounting a USB Drive!

If you are using the full desktop OS then ANY USB storage device will be automatically mounted in /media

However, if you are using the OS Lite this will not happen and you will need to configure every USB device you want to use so it will auto mount when plugged in...

📂 Auto-Mounting a USB Drive by UUID

If you want your Raspberry Pi (or Linux system) to automatically mount a USB drive at boot, you can use its UUID in /etc/fstab. This ensures the correct drive is mounted every time, even if the device path (/dev/sda1, /dev/sdb1, etc.) changes.

1. Find the UUID of Your USB Drive

First, plug in your USB drive and find its partition (e.g /dev/sda1):

lsblk -o NAME,SIZE,MODEL,MOUNTPOINT

then find it's UUID (replace /dev/sda1 with your USB device partition)

sudo blkid /dev/sda1

You'll see something like:

/dev/sda1: UUID="17F8-3814" BLOCK_SIZE="512" TYPE="vfat"

Note down the UUID and TYPE

Create a mount point

sudo mkdir -p /media/pi/myusb
sudo chown -R pi:pi /media/pi/myusb/

Edit /etc/fstab to include your device

sudo nano /etc/fstab

Add this line at the end using YOUR UUID and TYPE!!

UUID=17F8-3814  /media/pi/myusb  vfat  defaults,uid=1000,gid=1000,umask=000  0  0

You may need to run

systemctl daemon-reload

Testing that it works

sudo mount -a
df -h

You should see a line like

/dev/sda1       115G  140M  115G   1% /media/pi/myusb

Reboot!

Reboot your Pi and then run

df -h

To see if it has mounted automatically!

About

mini raspberry pi ai wildlife monitor using the imx500

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published