Skip to content
Nicolas Liaudat edited this page Oct 3, 2025 · 3 revisions

Setup :

Prerequisites

  • Python (python.org)
  • Esphome (pip install esphome)

Download

Download full repo or git clone

Adapt for your needs

config.yaml :

  • [optional] change the name in the substitutions section
  • [optional] change the timezone
  • meter_reader_tflite : Start with a minimal config with no camera_window (zoom) Copy the model you choose from ./model to the config.yaml directory set it's name in model: "dig-class100-0180-s2-q.tflite"
  • packages : Select the board by commenting or not the board include

secrets.yaml

change your wifi passwords and SSID

The number of wifi must be adapt in wifi.yaml

globals_AI_component.yaml

comment out or clear "initial_value" initial_value: ""[]"" This are the crop zone for digit identification

Compile and upload

esphome compile config.yaml

If success - connect your board with usb (only needed the first time, the next upload can be done with OTA)

  esphome run config.yaml

Go to your hassio

  • Add the new detected board
  • Pause the AI processing
  • Enabled Flash LED
  • You can view and download the image by clicking the camera.
image

[Optional] Zoom ROI

If you have OV2640, OV3660, OV5640, SC101IOT, SC030IOT camera

Go to and test zoom factors http://[hassio]/developer-tools/action > esphome.[s3cam_tflite]_set_camera_window

When your parameters are good, you can set them in config.yaml

meter_reader_tflite:
camera_window:  # can be set in http://[hassio]/developer-tools/action > esphome.[s3cam_tflite]_set_camera_window
offset_x: 928 # multiple of 4
offset_y: 480 # multiple of 4
width: 448 # multiple of 4 and 4:3 proportions with height for best quality
height: 88 #  multiple of 4 and 4:3 proportions with width for best quality

Set crop zones

  • Download the image
  • Copy it into ./tools folder

run

python draw_regions.py myimage.jpg

Draw you crop zones, press s key to save and q to quit regions.json is generated with your crop zones

You can set them in globals_AI_component.yaml or test them in http://[hassio]/developer-tools/action >esphome.[s3cam_tflite]_set_crop_zones

Final compile

  esphome run config.yaml
Clone this wiki locally