Stamp CAM0308/CAM3660 Camera ============================ .. sku: A178/A182 .. include:: ../refs/stamp.cam0308.ref The Stamp camera add-on is available with either a GC0308 sensor (CAM0308) or an OV3660 sensor (CAM3660). The current UiFlow2 firmware supports both variants on the StampS3Bat host and automatically detects when ``camera.init`` is called. Support the following products: ============================ ============================ |Stamp-AddOn Cam0308| |Stamp-AddOn Cam3660| ============================ ============================ Supported sensors ----------------- The sensor driver identifies the camera over SCCB (the I2C-compatible camera control bus). The supported sensor variants are: .. list-table:: Stamp camera sensor variants :header-rows: 1 * - Product - Sensor - SCCB address - Maximum resolution - Supported output formats * - CAM0308 - GC0308 - ``0x21`` - 640 x 480 (VGA) - RGB565, YUV422, grayscale * - CAM3660 - OV3660 - ``0x3C`` - 2048 x 1536 (QXGA) - RGB565, YUV422, JPEG The camera wiring and power-control configuration in the current firmware is specific to the StampS3Bat controller. Attach the camera add-on before initializing the camera. UiFlow2 Example --------------- Capture and draw on an image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Open the |cam0308_image_example.m5f2| project in UiFlow2. The example initializes the camera at QVGA/RGB565, captures one frame, draws text and shapes on it, and prints the image dimensions and format. |cam0308_image_example.png| Wi-Fi video streaming with QR recognition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Open the |cam0308_video_streaming_example.m5f2| project in UiFlow2. Replace the Wi-Fi SSID and password in the project, then open the printed device IP address on port 8080 in a browser. The stream includes QR-code recognition results when a QR code is visible. |cam0308_video_streaming_example.png| MicroPython Example ------------------- Capture and draw on an image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. literalinclude:: ../../../examples/stamp/cam0308/cam0308_image_example.py :language: python :linenos: Wi-Fi video streaming with QR recognition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Set ``ssid`` and ``pwd`` in the example before running it. After the board connects to Wi-Fi, visit ``http://:8080/`` to view the MJPEG stream. .. literalinclude:: ../../../examples/stamp/cam0308/cam0308_video_streaming_example.py :language: python :linenos: API --- The camera add-on uses the shared ``camera`` module. See :doc:`../advanced/camera` for initialization, capture, frame-size, pixel format, mirror, and flip APIs. The image returned by ``camera.snapshot()`` uses the shared ``image`` module; see :doc:`../advanced/image` for image drawing and inspection methods.