With the introduction of motorized zoom lenses, the next logical step was matching the sensor board. Sure there are countless suitable sensors from various manufacturers like Sony semiconductors, Onsemi, Aptina, and many more. But lack of good support from the SOC side suggested starting from IMX477. It is a reasonably modern 12M image sensor used by many single-board computers like Raspberry Pi, NVIDIA Jetson, and others.
Raspberry Pi locks cameras with a security chip and prohibits non-authorized cameras with standard boards. Luckily this security feature is not used by compute modules. Motorized lenses have dedicated, and in most cases, unique direct mount features. So a custom camera module is a must, thus introducing the IMX477 MIPI CSI2 camera board.
This is the first of a few upcoming camera modules. Note multiple mounting features – this allows single-board use with many lenses.
Features of the lens kit:
- Lens optical train – 3 stepper motors for Zoom, Focus and compensate lens groups
- Iris
- Two optical filters: IR CUT and NIR
- Reference optical train elements
- Runs on GRBL firmware ported on STM32 CPU with four axis motion planner
Using the camera with Raspberry Pi compute module
There is a great resource about the IMX477 camera on Raspberry Pi pages, feel free to learn how to control and use it from Raspberry Pi. Below is a simple recipe for streaming real-time video from RPI to a computer.
Run on computer first
gst-launch-1.0 udpsrc port=5004 ! "application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)JPEG,a-framerate=(string)40.000000,a-framesize=(string)1280-720,payload=(int)26" ! rtpjpegdepay ! decodebin ! autovideosink
Run on RPI as a second step
# Install librariessudo apt -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev# Start streamerraspivid -t 0 -cd MJPEG -awb greyworld -mm average -w 2028 -h 1520 -fps 30 -b 132000000 -o - | gst-launch-1.0 fdsrc ! "image/jpeg,framerate=30/1" ! jpegparse ! rtpjpegpay ! udpsink host=<COMPUTER_IP> port=5004
Control the lens
The SCE2-SDK control software can be forked from GitHub. Python code allows code reuse on many operating systems and keeps it human-readable, thus open for customizations.
- Download and install https://www.python.org/downloads/windows/ (tested with Python 3.10 on Win10 and Python 3.8.10 on Win7)
- Check
Add Python 3.8 to PATH
in the first setup window! - Restart computer
- Check
- Clone (or download zip archive) from GitHub repository: https://github.com/Kurokesu/SCE2-SDK in preferred directory
- Open console at
03_lens_tester_gui
folder - Install dependencies:
pip install -r requirements.txt
- Run demo with command
python main.py
Results
And finally, demonstration video cycling through a few presets and changing filters.
Links
- SCE2-SDK repository on GitHub
- E-store camera modules
- E-store motorized zoom lenses
- 3D model repository on GitHub