CM Panel technical documentation Buy
Enable the camera using the raspi-config
utility:
$ sudo raspi-config
This example simply send the images captured by the camera to the LCD display.
$ sudo apt update
$ sudo apt install -y python-picamera
Create a file called camera.py
with this code inside:
#!/usr/bin/python
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(5)
camera.stop_preview()
Then launch it:
$ chmod +x camera.py
$ ./camera
This example send the images captured by the camera to a web browser via TCP/IP.
$ sudo apt install -y python-flask python-picamera git
$ git clone https://github.com/miguelgrinberg/flask-video-streaming.git
$ cd flask-video-streaming
Run command:
$ CAMERA=pi python app.py
Open a browser on your PC and go to the URL:
http://ip_address:5000
Install Python3 and Python3-picamera libraries
sudo apt update
sudo apt install python3
sudo apt install python3-picamera
Save this small Python program stream.py in /home/pi directory:
cd /home/pi
wget https://www.acmesystems.it/www/CM3-PANEL-7-BASIC_raspicam/stream.py
Create this file:
sudo nano /lib/systemd/system/stream.service
with this content:
[Unit]
Description=MJPG streaming with Raspicam
After=systemd-user-sessions.service
[Service]
ExecStart=/usr/bin/python3 stream.py
Restart=on-abort
User=pi
WorkingDirectory=/home/pi
[Install]
WantedBy=multi-user.target
save and launch the service:
sudo systemctl daemon-reload
sudo systemctl enable stream.service
sudo systemctl start stream.service
Open a browser on a PC on this url: