Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Jeff Epler for Adafruit Industries
# SPDX-License-Identifier: Unlicense
Take a 10-frame stop motion GIF image.
This example requires:
* `Espressif Kaluga v1.3 <>`_ with compatible LCD display
* `MicroSD card breakout board + <>`_ connected as follows:
* CLK to board.IO18
* DI to board.IO14
* DO to board.IO17
* CS to IO12
* GND to GND
* 5V to 5V
* A compatible SD card inserted in the SD card slot
* A compatible camera module (such as OV5640) connected to the camera header
To use:
Insert an SD card and power on.
Set up the first frame using the viewfinder. Click the REC button to take a frame.
Set up the next frame using the viewfinder. The previous and current frames are blended together on the display, which is called an "onionskin". Click the REC button to take the next frame.
After 10 frames are recorded, the GIF is complete and you can begin recording another.
About the Kaluga development kit:
The Kaluga development kit comes in two versions (v1.2 and v1.3); this demo is
tested on v1.3.
The audio board must be mounted between the Kaluga and the LCD, it provides the
I2C pull-ups(!)
The v1.3 development kit's LCD can have one of two chips, the ili9341 or
st7789. Furthermore, there are at least 2 ILI9341 variants, which differ
by rotation. This example is written for one if the ILI9341 variants,
the one which usually uses rotation=90 to get a landscape display.
import os
import struct
import time
import adafruit_ticks
import esp32_camera
import analogio
import board
import busio
import bitmaptools
import digitalio
import displayio
from adafruit_st7789 import ST7789
cam = esp32_camera.Camera(
cam.vflip = True
board.DISPLAY.auto_refresh = False
display_bus = board.DISPLAY.bus
display_bus.send(36, struct.pack(">hh", 0, 239))
display_bus.send(42, struct.pack(">hh", 0, 239))
display_bus.send(43, struct.pack(">hh", 0, 80+239))
t0 = adafruit_ticks.ticks_ms()
while True:
frame = cam.take(1)
if isinstance(frame, displayio.Bitmap):
display_bus.send(44, frame)
t1 = adafruit_ticks.ticks_ms()
fps = 1000 / (t1-t0)
t0 = t1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment