CM Home technical documentation Buy

Camera interface

The CM-Home board features the same camera interface as the standard Raspberry Pi 4. Since the HDMI video interface is not available, this article explains how to use the camera over the network.

The MIPI connector for the Raspberry Pi cam is located in the middle of the board closed to the CM4S socket as shown below:

We chose this position for the camera to facilitate its placement on the front panel of the DIN rail case.

Insert the camera connector with the blue band facing towards the relay, then power on the board and access the Linux prompt via an SSH connection.

THE FOLLOWING PART OF THIS ARTICLE IS STILL UNDER REVIEW

Type to check if the camera is visible:

$ vcgencmd get_camera
supported=0 detected=0, libcamera interfaces=0

Run:

sudo raspi-config

Select Interfacing Options-->P1 Camera and enable the camera interface.

Install this overlay (dt-blob.bin) on the microSD by typing:

sudo wget http://goo.gl/U4t12b -O /boot/dt-blob.bin

Then check if the camera is enabled by typing:

vcgencmd get_camera

Python example

I found on this URL https://blog.miguelgrinberg.com/post/flask-video-streaming-revisited a very easy way to implement example of video streaming made in pure Python written by Miguel Grinberg.

I suggest to read this tutorial to understand how it works. But if you want to try quickly these are thet steps to do:

Install Flask, the Python support for the Pi Camera and git:

sudo apt update
sudo apt install -y python-flask python-picamera git

Clone the flask-video-streaming repository:

git clone https://github.com/miguelgrinberg/flask-video-streaming.git

Move inside the directory created by Git:

cd flask-video-streaming

and type:

CAMERA=pi python app.py

Open a browser on your PC and go to the URL:

Launch Flask server at startup

Create a filed called /lib/systemd/system/flask.service with the follow content:

[Unit]
Description=Flask
After=systemd-user-sessions.service

[Service]
Environment="CAMERA=pi"
ExecStart=python flask-video-streaming/app.py
Restart=on-abort
User=pi
WorkingDirectory=/home/pi

[Install]
WantedBy=multi-user.target

Enable the new service:

sudo systemctl daemon-reload
sudo systemctl enable flask.service
sudo systemctl start flask.service

Pinused to wire the camera connector

CD1 SDA  - GPIO0
CD1 SCL  - GPIO1
CAM1 IO1 - GPIO2
CAM1 IO0 - GPIO3

CAM1 D0 N
CAM1 D0 P
CAM1 D1 N
CAM1 D1 P
CAM1 C N
CAM1 C P

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 Home technical documentation Buy