pdf-icon

TimerCAM/Unit CAM - UIFlow

Feature Description

Use the device to connect the TimerCAM/Unit CAM through the GROVE interface to achieve command control of the camera's UART transmission of images and preview them on the M5CORE screen, or configure a timed shooting and upload to the cloud function (returning a fixed HTTP API).

Driver Installation

Connect the device to the PC and open the device manager to install the FTDI driver for the device. For Windows 10, download the driver file matching your operating system, and unzip it. Install it through the device manager. (Note: In some system environments, it may be necessary to install the driver twice for it to take effect. Unrecognized device names are usually M5Stack or USB Serial. Windows recommends using the driver files directly in the device manager for installation (custom update). The executable file installation method may not work properly.) Click here to download the FTDI driver

For MacOS users, before installation, please check System Preferences -> Security & Privacy -> General -> Allow apps downloaded from: -> App Store and identified developers option.

Download the Firmware Burning Tool

Please download the M5Burner firmware burning tool according to your operating system. Unzip and open the application.

Software Version Download Link
M5Burner_Windows Download
M5Burner_MacOS Download
M5Burner_Linux Download

Firmware

The default firmware of TimerCAM that comes out of the factory is not compatible with this application, so you need to flash the firmware that matches UIFlow for the camera before use. Note: The factory firmware of UnitCAM is default compatible with UIFlow and does not need to be re-flashed. Open M5Burner, switch to the TimerCam option, select the appropriate version and click download, then click Burn to flash, and wait for the pop-up message "successful" to indicate that the flashing is complete.

Work Mode

UIFlow supports configuring the camera to switch between UART and Wi-Fi working modes. The Wi-Fi mode supports timed shooting and automatically uploading images to the M5 cloud and returning an image call interface (URL). In UART mode, it supports users "to obtain image frames through UART communication with other main control devices" and modifying image parameters. The following will use the main control CORE as an example, connect UnitCAM, and obtain image data.

Example

Before using, you need to click the add button in the lower left corner to add the corresponding camera expansion.
Operation instructions for the example:
Button A activates the WiFi connection mode, connects to the specified WiFi, and the camera takes pictures and uploads them to the M5 cloud every 5 seconds. Button B obtains the camera Token and creates a QR code using the cloud image URL generated by this Token.
Button C activates the UART connection mode, sets the image size to 320*240, and starts an image display thread to continuously refresh the image to the screen.
from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
timercam_0 = unit.get(unit.UNITCAM, unit.PORTB)
unitcam_0 = unit.get(unit.UNITCAM, unit.PORTB)
timercam_token = None

def buttonA_wasPressed():
  global timercam_token
  timercam_0.set_wifi('xxxxx', 'xxxxx')
  timercam_0.set_upload_time(5)
  timercam_0.set_mode(timercam_0.CLOUD_MODE)
  pass
btnA.wasPressed(buttonA_wasPressed)

def buttonB_wasPressed():
  global timercam_token
  timercam_token = timercam_0.get_token()
  if timercam_token:
    lcd.qrcode(('camera.m5stack.com/timer-cam/image?tok=' + timercam_0.get_token()), x=72, y=32, width=176, version=6)
  pass
btnB.wasPressed(buttonB_wasPressed)

def buttonC_wasPressed():
  global timercam_token
  timercam_0.set_show(True)
  timercam_0.set_image_size(timercam_0.SIZE_320_240)
  timercam_0.set_mode(timercam_0.UART_MODE)
  pass
btnC.wasPressed(buttonC_wasPressed)

API

timercam_0.set_wifi('ssid', 'password')
  • Configure the camera to connect to a specific WiFi network.
timercam_0.set_upload_time(5)
  • Configure the interval for the camera to upload images to the cloud.
timercam_0.set_upload_time(5)
  • Get the camera's Token.
'camera.m5stack.com/timer-cam/image?tok=' + timercam_0.get_token()
  • Get the camera's cloud image URL.
timercam_0.set_mode(timercam_0.UART_MODE)
timercam_0.set_mode(timercam_0.CLOUD_MODE)
  • Switch between UART/CLOUD modes.
timercam_0.set_image_size(timercam_0.SIZE_320_240)
  • Set the camera's image return size.
timercam_0.set_position(0, 0)
  • Set the image display position.
timercam_0.set_led_brightness(1024)
  • Set the brightness of the camera's onboard LED:
    • 0-1024

Video

On This Page