CM Panel technical documentation Buy

Using the Raspicam with the CM-Panel

Enable the camera using the raspi-config utility:

$ sudo raspi-config

Python example

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

Python example

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

MJPG streaming example

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:

Links

Products related

CM-Panel-Basic

Features Index Buy

All-in-one 7 inch touch WiFi terminal powered by Raspberry Pi CM4S
  • 7 inch TFT display 800x480
  • Capacitive touch
  • MIPI Camera connector
  • WiFi @ 2.4 GHz
CM-Panel-POE

Features Index Buy

All-in-one 7 inch touch POE terminal powered by Raspberry Pi CM4S
  • 7 inch TFT display 800x480 pixel
  • Capacitive touch
  • Embedded micro UPS for safe shutdown
  • Power Over Ethernet @ 10/100 Mbit
  • Hi-resolution audio up to 384KHz@32bit
  • Real Time Clock with backup battery
  • 3 USB Host port
  • 1 RS485/422/RS232 port
  • 1 Relay
  • MIPI Camera connector
  • WiFi @ 2.4 GHz (optional)
CM-Home

Features Index Buy

Home Automation board powered by Raspberry Pi CM4S lite module
  • Power-in @ 12 to 24VDC
  • Double opto-isolated RS-485 ports
  • 2 relays
  • 2 USB 2.0 host port
  • Ethernet port at 10/100Mbit
  • MIPI Camera connector
  • Stereo audio out on 3.5 mm jack

Home page CM Panel technical documentation Buy