TTGO T8 ESP32 is an ESP32-powered board. Supports programming for ESP-IDF, Arduino and MicroPython. In addition, the highlight of this board is Built-in memory, 4MB external RAM available, TF Card reader slot, can read/write SD card, turn on/off switch, reset button, 3D antenna, external antenna socket, charging circuit and using a rechargeable battery.
This article introduces the board features and programming to command on-board devices in Python using MicroPython version 1.13 and Thonny as a connector to the board and programming.
The following figure is a board and accessories that come with the board.
Property
The features of TTGO T8 ESP32 are as follows.
- The central processor is a Xtensa(R) Dual-Core 32-bit LX6.
- Supports HT40 802.11 b/g/n WiFi
- Supports Bluetooth version 4.2 BR/EDR + BLE (Bluetooth Low Energy).
- Clock frequency 160MHz/240MHz
- Internal RAM memory 520KB
- 4MB SPI Flash memory program storage
- 4MB PSRAM external RAM
- 36 active GPIO(General Purpose I/O) ports
- It has 1 hardware PWM and 16 PWM software.
- Supports 4 SPI buses.
- Support 2 I2C bus.
- Supports 2 I2S buses.
- Supports 2 UART buses.
- It has a 12-bit analog-to-digital converter circuit.
- There are two 10-bit digital-to-analog converters.
- Supports 1 CAN bus.
- Support Touch Sensor.
- It has a built-in magnetic intensity sensor.
- Built-in temperature sensor.
- Can operate from -40 to 125 degrees Celsius.
- 3D Antenna for WiFi and Bluetooth communication.
- IPX/U.FL connector for external antenna
- There is a TF card slot for inserting a Micro SD Card.
- Lithium battery charging circuit which supports a maximum current of 500mA.
- Using CP2104 chip for USB to UART conversion.
The pin arrangement of the TTGO T8 ESP32 is as follows.
Board properties
Example code reads detailed information of the TTFO T8 ESP32 to show the size of the flash ROM, RAM usage, version of Micropython, the current operating frequency, the temperature, and the magnetic intensity from code6-1 and the result is as follows.
# code6-1
# (C) 2020, JarutEx
import esp
import esp32
import os
import sys
import machine as mc
import gc
import time
gc.enable()
gc.collect()
uname = os.uname()
mem_total = gc.mem_alloc()+gc.mem_free()
free_percent = str((gc.mem_free())/mem_total*100.0)+"%"
alloc_percent = str((gc.mem_alloc())/mem_total*100.0)+"%"
print("ID ............: {}".format(mc.unique_id()))
print("Platform ......: {}".format(sys.platform))
print("Version .......: {}".format(sys.version))
print("ROM Size ......: {} MBytes".format(esp.flash_size()/(1024*1024)))
print("Memory")
print(" total ......: {} Bytes or {} MBytes".format(mem_total, mem_total/(1024*1024)))
print(" usage ......: {} Bytes or {}".format( gc.mem_alloc(), alloc_percent))
print(" free .......: {} Bytes or {}".format( gc.mem_free(), free_percent))
print("system name ...: {}".format(uname.sysname))
print("node name .....: {}".format(uname.nodename))
print("release .......: {}".format(uname.release))
print("version .......: {}".format(uname.version))
print("machine .......: {}".format(uname.machine))
print("Frequency .....: {} MHz".format(mc.freq()/1000000.0))
print("Temperature ...: {}F".format(esp32.raw_temperature()))
print("Hall ..........: {}".format(esp32.hall_sensor()))
Read/Write SD-Card
Example code for accessing the SD Card and writing the date and time data into log.txt, reading it, and display via the console is shown in the following figure.
#code6-2.py
# (C) 2020, JarutEx
import os
import time
from machine import SDCard
if (not('sd' in os.listdir())):
sd = SDCard()
os.mount(sd,'/sd')
print(os.listdir('/'))
print(os.listdir('/sd'))
if ('log.txt' in os.listdir('/sd')):
log = open('/sd/log.txt','a')
else:
log = open('/sd/log.txt','w')
lcTime = time.localtime()
log.write("date {}/{}/{} , time {}:{}:{}\n".format( lcTime[0], lcTime[1], lcTime[2], lcTime[4], lcTime[5], lcTime[6]))
log.close()
log = open('/sd/log.txt','r')
dLog = log.read()
log.close()
print("data from log.txt\n{}".format(dLog))
Conclusion
From the features of the TTGO T8 ESP32 board, it can be found that it is an ESP32 board with a large amount of memory, has an SD card reader unit and the battery charger. Thus, it is a board that is suitable for programming with a large amount of memory, such as a data logger or use with a TFT LCD that requires memory for the double buffer.
Finally, if anyone is interested in this board, you can buy it from different stores or order from our team as well. Because we focus on ordering to test, build the hardware, and develop software on the ESP32 system which often exceeds the required quantity. So we can share it.
If you want to discuss something, feel free to leave comments below.
(C) 2020, Danai Jedsadathitikul and Jarut Busarathid
Updated 2020-10-12