LILYGO T-WATCH-V3 User Guide
Version 1.0
Copyright © 2023
About This Guide
This document is intended to help users set up the basic software development environment for developing applications using hardware based on the T-Watch 2020. Through a simple example, this document illustrates how to use Arduino, including the menu based configuration wizard, compiling the Arduino and firmware download to the ESP32 module.
Release Notes
Date | Version | Release notes |
2023.04 | V1.0 | First release. |
1. Introduction
1.1. T-Watch 2020 V3
The T-WATCH-V3 is a development board that can work independently. It consists of an ESP32 MCU supporting Wi-Fi + BT+ BLE communication protocol and a motherboard PCB. This board features a 1.54-inch LCD screen.
It is suitable for applications ranging from low-power sensor networks to the most demanding tasks. At the core of this module is the ESP32-D0WD chip. The ESP32 integrates Wi-Fi (2.4 GHz band) and Bluetooth 4.2 solutions on a single chip, along with dual high-performance cores and many other versatile peripherals. Powered by 40 nm technology, the ESP32 provides a robust, highly integrated platform to meet the continuous demands for efficient power usage, compact design, and security.
Xinyuan provides the basic hardware and software resources that empower application developers to build their ideas around the ESP32 series hardware. The software development framework provided by Xinyuan is intended for rapidly developing Internet-of-Things (IoT) applications, with Wi-Fi, Bluetooth, flexible power management, and other advanced system features.
The RF frequency range is 2.402 GHz to 2.480 GHz.
1.2. Arduino
Arduino is a set of cross-platform applications written in Java. The Arduino Software IDE is derived from the Processing programming language and the integrated development environment of the Wiring program. Users can develop applications in Windows, Linux, and MacOS based on Arduino. It is recommended to use Windows 10. Windows OS has been used as an example in this document for illustration purposes.
1.3. Preparation
To develop applications for ESP32, you need:
- A PC loaded with either Windows, Linux, or Mac operating system.
- Toolchain to build the Application for ESP32.
- Arduino that essentially contains API for ESP32 and scripts to operate the Toolchain.
- CH9102 serial port driver.
- The ESP32 board itself and a USB cable to connect it to the PC.
2. Get Started
2.1. Download the Arduino Software
The quickest way to install the Arduino Software (IDE) on Windows machines.
2.1.1. Quick Start Guide
The website provides a quick start tutorial:
- Windows: https://www.arduino.cc/en/Guide/Windows
- Linux: https://www.arduino.cc/en/Guide/Linux
- Mac OS X: https://www.arduino.cc/en/Guide/MacOSX
2.1.2. Installation steps for Windows platform Arduino
Enter the download interface, select Windows installer to install directly.
The Arduino IDE download page offers various installation options, including:
- Windows Installer
- Windows ZIP file for non-admin install
- Windows app
- Mac OS X 10.7 Lion or newer
- Linux 32 bits
- Linux 64 bits
- Linux ARM
- Release Notes
- Source Code
- Checksums (sha512)
2.2. Install the Arduino Software
In the Arduino Setup: Installation Options window, check the components you want to install and uncheck the components you don't want to install. Click Next to continue.
The installation process will extract necessary files. Wait for the installation to complete.
2.3. Set up Path
This section is not detailed in the provided pages but typically involves adding the Arduino installation directory to your system's PATH environment variable.
3. Configure
3.1. Download Git
Download the installation package Git.exe from the official Git website.
The Git website provides downloads for Mac OS X, Linux/Unix, and Windows. It also offers GUI clients and information on obtaining the latest development version via Git itself.
3.2. Pre-build configuration
Click the Arduino icon, then right-click and select "Open folder where".
Select hardware.
Mouse Right-click.
Click Git Bash Here.
3.3. Cloning a remote repository
Use the following commands in Git Bash:
$ mkdir espressif
$ cd espressif
$ git clone --recursive https://github.com/espressif/arduino-esp32.git esp32
4. Connect
You are almost there. To proceed further, connect the ESP32 board to your PC. Check under which serial port the board is visible and verify if serial communication works.
5. Test Demo
Navigate to File >> Example >> WiFi >> WiFiScan in the Arduino IDE.
The example demonstrates various WiFi events and states, such as:
- SYSTEM_EVENT_STA_GOT_IP: Station got IP from connect.
- SYSTEM_EVENT_STA_LOST_IP: Station lost IP and the IP.
- SYSTEM_EVENT_AP_START: AP starts.
- SYSTEM_EVENT_AP_STOP: AP stops.
- SYSTEM_EVENT_AP_STA_CONNECTED: AP station connected.
- SYSTEM_EVENT_AP_STA_DISCONNECTED: AP station disconnected.
- SYSTEM_EVENT_SCAN_DONE: Scan done.
- SYSTEM_EVENT_STA_CONNECTED: Station connected.
- SYSTEM_EVENT_STA_DISCONNECTED: Station disconnected.
- SYSTEM_EVENT_WIFI_MODE_CHANGE: WiFi mode changed.
- SYSTEM_EVENT_AP_PROBEREQRECVED: AP probe request received.
- SYSTEM_EVENT_STA_AUTHMODE_CHANGE: Station auth mode changed.
- SYSTEM_EVENT_MAX: Max events.
6. Upload Sketch
6.1. Select Board
In the Arduino IDE, go to Tools >> Board and select the appropriate ESP32 development board. For example, choose "ESP32 Dev Module".
Ensure the correct Upload Speed, CPU Frequency, Flash Mode, Flash Size, Partition Scheme, Core Debug Level, PSRAM, and Arduino Runs On settings are selected.
Select the correct Port and Programmer (e.g., "ArduinolSP.org").
Available board options include:
- ESP32 Dev Module
- ESP32 Wrover Module
- ESP32 PICO-D4
- ESP32 Wrover Kit (all versions)
- UM TinyPICO
- UM FeatherS2
- UM TinyS2
- S.ODI Ultra v1
- microS2
- MagicBit
- Turta IoT Node
- TTGO LoRa32-OLED V1
- TTGO T1
- TTGO T7 V1.3 Mini32
- TTGO T7 V1.4 Mini32
- XinaBox CW02
- SparkFun ESP32 Thing
- SparkFun ESP32 Thing Plus
6.2. Upload
Select Sketch >> Upload to compile and upload your sketch to the ESP32 board.
6.2. Serial Monitor
Use the Serial Monitor (Tools >> Serial Monitor) to view output from the ESP32 board. The monitor displays scan results, network information, and connection status.
Example output:
scan start
scan done
2 networks found
1: MEO-620B4B (-39)*
2: MEO-WiFi (-39)
scan start
scan done
2 networks found
1: MEO-620B4B (-38)*
2: MEO-WiFi (-38)
Ensure the correct baud rate (e.g., 115200 baud) is selected in the Serial Monitor.
7. SSC Command Reference
This section lists common Wi-Fi commands for testing the module.
7.1. op
Description
The op
command is used to set and query the Wi-Fi mode of the system.
Example
op
op -S -o wmode
Parameter
Parameter | Description |
-S | Query Wi-Fi mode. |
-o wmode | Set Wi-Fi mode. There are 3 Wi-Fi modes:
|
7.2. sta
Description
The sta
command is used to scan the STA network interface, connect or disconnect AP, and query the connecting status of STA network interface.
Example
sta -S [-s ssid] [-b bssid] [-n channel] [-h]
sta -Q
sta -C [-s ssid] [-p password]
sta -D
Parameter
Parameter | Description |
-S | Scan Access Points. |
-s ssid | Scan or connect Access Points with the ssid. |
-b bssid | Scan the Access Points with the bssid. |
-n channel | Scan the channel. |
-h | Show scan results with hidden ssid Access Points. |
-Q | Show STA connect status. |
-D | Disconnected with current Access Points. |
7.3. ap
Description
The ap
command is used to set the parameter of AP network interface.
Example
ap -S [-s ssid] [-p password] [-t encrypt] [-n channel] [-h] [-m max_sta]
ap
ap -L
Parameter
Parameter | Description |
-S | Set AP mode. |
-s ssid | Set AP ssid. |
-p password | Set AP password. |
-t encrypt | Set AP encrypt mode. |
-h | Hide ssid. |
-m max_sta | Set AP max connections. |
-L | Show AP parameters. Show MAC Address and IP Address of the connected station. |
7.4. mac
Description
The mac
command is used to query the MAC address of the network interface.
Example
mac -Q [-o mode]
Parameter
Parameter | Description |
-Q | Show MAC address.
|
7.5. dhcp
Description
The dhcp
command is used to enable or disable DHCP server/client.
Example
dhcp -S [-o mode]
dhcp -E [-o mode]
dhcp -Q [-o mode]
Parameter
Parameter | Description |
-S | Start DHCP (Client/Server). |
-E | End DHCP (Client/Server). |
-Q | Show DHCP status.
|
7.6. ip
Description
The ip
command is used to set and query the IP address of the network interface.
Example
ip -Q [-o mode]
ip -S [-i ip] [-o mode] [-m mask] [-g gateway]
Parameter
Parameter | Description |
-Q | Show IP address.
|
-S | Set IP address. |
-i ip | IP address. |
-m mask | Subnet address mask. |
-g gateway | Default gateway. |
7.7. reboot
Description
The reboot
command is used to reboot the board.
Example
reboot
7.8. ram
Description
The ram
command is used to query the size of the remaining heap in the system.
Example
ram