This is a small customization to ESPHome to support the Weather Clock SmallTV by GeekMagic, a tiny TV screen based on an ESP with a 240x240 display. There are actually at least 3 models fo the SmallTV:
-
SmallTV (AliExpress) - ESP-12F, NO touch sensor
-
SmallTV Ultra (AliExpress) - ESP8266, ST7789V display / 240x240px , NO touch sensor
-
SmallTV Pro (AliExpress) - ESP32-WROOM-32 and touch sensor on the top side.
As the firmware provided by GeekMagic is only available as binary, it can only customized within constrains and it requires an app to configure it and relies on unknown remote servers.
The search for an alternative firmware led to ESPHome, which is a great open source project to create custom firmwares for ESP based devices with a lot of built-in functionality and easy configuration.
This thread in the ESPHome forum describes how people started to get ESPHome running on the SmallTV and their findings along the way.
This repository contains the necessary files to build a custom ESPHome firmware specifically for the SmallTV Pro, including the display configuration and a minimal custom watch layout.
Most of the work is based on the excellent work of Lucas Hartmann and his configuration.
Follow the instructions on the ESPHome installation guide to install ESPHome on your system. The standalone version using pip was used to install ESPHome on locally.
$ python3 -m venv venv # The last argument is the folder in which to install the virtual environment
$ source venv/bin/activate # For bash or compatible shells. If using a different shell, use activate.csh or activate.fish
(venv) $ pip install esphome # Installs ESPHome in the virtual environment
(venv) $ esphome versionThe provided smalltv.yml file contains the ESPHome configuration for the SmallTV Pro.
It includes the necessary display configuration and a watch layout.
The configuration omits secrets like WiFi credentials or OTA update passwords, which need to be added before compiling the firmware.
The secrets can be added directly in the smalltv.yml file or in a separate secrets.yaml file as described in the ESPHome documentation.
The latter has the benefit that the smalltv.yml file can be shared without exposing sensitive data.
The secrets.yaml file should contain an entry for every key (!secret <key>) from the smalltv.yml and look like this:
api_key: "12341234123412341234123412341234"
ota_password: "safe_ota_password"
wifi_ssid: "SSID_for_IoT_network"
wifi_password: "safe_wifi_password"
... add other secrets as neededAs the configuration file references a custom font file, make sure to download the Terminus font v4.49.1 and extract it into the same folder as the smalltv.yml file.
Now the firmware can be compiled with the following command:
(venv) $ esphome compile smalltv.ymlThere are two ways to flash the ESPHome firmware to the SmallTV Pro:
-
Using a USB to Serial adapter connected to the UART pins on the PCB.
-
Using OTA (Over The Air) updates after an initial flashing with an
firmware.ota.binfile.
The SmallTV Pro needs to be prepared to accept custom ESPHome firmware. At the bottom there are two screws. When removed it allows to remove the the inner "tray" which holds the PCB. There are 6 pads on the PCB for UART connection. The following connections are needed:
⬜️ 1 GND ⚪ 2 TXD0 # needs to be connected to the RX pin of the USB to Serial adapter ⚪ 3 RXD0 # needs to be connected to the TX pin of the USB to Serial adapter ⚪ 4 3V3 ⚪ 5 GPIO0 ⚪ 6 RST
The SmallTV Pro needs to be powered with 3.3V on the 4th pad.
The GPIO0 pad needs to be connected to GND while powering the device to enter the flashing mode.
Now the device can be flashed with the ESPHome firmware using a USB to Serial adapter.
(venv) $ esphome run smalltv.ymlThis command will scan all serial ports to find the connected SmallTV Pro device and try to flash the firmware.
Instead of run the command upload can be used to only upload the firmware without starting the logs.
After the initial flashing the device can be powered normally and connected to WiFi.
