Skip to content

Commit 2865840

Browse files
authored
add esp32 w/ st7789v tft (#14)
1 parent 57131f9 commit 2865840

File tree

7 files changed

+424
-39
lines changed

7 files changed

+424
-39
lines changed

README.md

Lines changed: 94 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,33 @@ Notes on Arduino libraries and sketches and other related stuff.
55
<!-- vim-markdown-toc GFM -->
66

77
* [My Libraries and projects](#my-libraries-and-projects)
8-
* [JLed](#jled)
9-
* [log4arduino](#log4arduino)
10-
* [eps32-aws-iot](#eps32-aws-iot)
11-
* [USB Spinner Game Controller](#usb-spinner-game-controller)
12-
* [Simpson Device (virtual Drinking Bird)](#simpson-device-virtual-drinking-bird)
8+
* [JLed](#jled)
9+
* [log4arduino](#log4arduino)
10+
* [eps32-aws-iot](#eps32-aws-iot)
11+
* [USB Spinner Game Controller](#usb-spinner-game-controller)
12+
* [Simpson Device (virtual Drinking Bird)](#simpson-device-virtual-drinking-bird)
1313
* [Sketches](#sketches)
14-
* [Interfacing SSD1306 based OLED displays (SPI)](#interfacing-ssd1306-based-oled-displays-spi)
15-
* [Colorduino RGB matrix driver](#colorduino-rgb-matrix-driver)
16-
* [CJMCU-8x8 RGB matix](#cjmcu-8x8-rgb-matix)
17-
* [WEMOS D-Duino](#wemos-d-duino)
18-
* [ESP32 TTGO](#esp32-ttgo)
19-
* [Heltec WiFi Lora 32](#heltec-wifi-lora-32)
20-
* [Raspberry Pi 480x320 SPI TFT Display (3.5 inches)](#raspberry-pi-480x320-spi-tft-display-35-inches)
21-
* [Further info](#further-info)
22-
* [Sipeed Longan Nano RISC-V proto board (GD32VF103CBT6)](#sipeed-longan-nano-risc-v-proto-board-gd32vf103cbt6)
23-
* [DFU mode](#dfu-mode)
24-
* [Upload demo sketch](#upload-demo-sketch)
25-
* [Raspberry Pi HDMI LCD display (800x480, 4")](#raspberry-pi-hdmi-lcd-display-800x480-4)
26-
* [Raspberry Pi Pico (RP2040)](#raspberry-pi-pico-rp2040)
27-
* [PCA9685 driver board](#pca9685-driver-board)
28-
* [MP3 Modules](#mp3-modules)
29-
* [VS1053 notes](#vs1053-notes)
30-
* [Bosch BMP280](#bosch-bmp280)
31-
* [TM1637 based Display](#tm1637-based-display)
14+
* [Interfacing SSD1306 based OLED displays (SPI)](#interfacing-ssd1306-based-oled-displays-spi)
15+
* [Colorduino RGB matrix driver](#colorduino-rgb-matrix-driver)
16+
* [CJMCU-8x8 RGB matix](#cjmcu-8x8-rgb-matix)
17+
* [WEMOS D-Duino](#wemos-d-duino)
18+
* [ESP32 TTGO](#esp32-ttgo)
19+
* [Heltec WiFi Lora 32](#heltec-wifi-lora-32)
20+
* [Raspberry Pi 480x320 SPI TFT Display (3.5 inches)](#raspberry-pi-480x320-spi-tft-display-35-inches)
21+
* [Further info](#further-info)
22+
* [Sipeed Longan Nano RISC-V proto board (GD32VF103CBT6)](#sipeed-longan-nano-risc-v-proto-board-gd32vf103cbt6)
23+
* [DFU mode](#dfu-mode)
24+
* [Upload demo sketch](#upload-demo-sketch)
25+
* [Raspberry Pi HDMI LCD display (800x480, 4")](#raspberry-pi-hdmi-lcd-display-800x480-4)
26+
* [Raspberry Pi Pico (RP2040)](#raspberry-pi-pico-rp2040)
27+
* [PCA9685 driver board](#pca9685-driver-board)
28+
* [MP3 Modules](#mp3-modules)
29+
* [VS1053 notes](#vs1053-notes)
30+
* [Bosch BMP280](#bosch-bmp280)
31+
* [TM1637 based Display](#tm1637-based-display)
32+
* [ESP32 board with 1.14" RGB ST7789V TFT display](#esp32-board-with-114-rgb-st7789v-tft-display)
3233
* [Misc](#misc)
33-
* [WS2812 protection circuit](#ws2812-protection-circuit)
34+
* [WS2812 protection circuit](#ws2812-protection-circuit)
3435
* [Author](#author)
3536

3637
<!-- vim-markdown-toc -->
@@ -112,11 +113,11 @@ to play games like e.g. Arkanoid. Simulates an USB mouse and needs no drivers.
112113
Simulates an USB mouse using an Attiny85 (Digispark board) and randomly moves
113114
your mouse (see The Simpsons S07E07).
114115
115-
* https://github.com/jandelgado/simpson-device
116+
* https://github.com/jandelgado/simpson-device
116117
117118
## Sketches
118119
119-
To build the demo sketches you can either copy the folders to the source
120+
To build the demo sketches you can either copy the folders to the source
120121
folder of your Arduino IDE or use PlatformIO and the provided makefiles, e.g.:
121122
122123
```
@@ -155,13 +156,13 @@ rmation.
155156
### WEMOS D-Duino
156157
157158
The Wemos D-Duino is an ESP8266 board with an integrated SSD1306 OLED display
158-
connected via I2C.
159+
connected via I2C.
159160
160161
<img alt="wemos-d-duino" width=256 src="images/wemos-d-duino.png">
161162
162163
* SSD1306 is connected with I2C and SCL connected to D2 and SDA connected
163164
to D1.
164-
* see [example sketch](wemos_d_duino) for an example on how to use it with
165+
* see [example sketch](wemos_d_duino) for an example on how to use it with
165166
the u8g2 library.
166167
167168
### ESP32 TTGO
@@ -178,7 +179,7 @@ switch.
178179
* SSD1306 is connected with I2C and SCL connected to GPIO4 and SDA connected
179180
to GPIO5.
180181
* the builtin blue LED is connected to GPIO 16
181-
* see [example sketch](esp32_ttgo) for an example on how to use it with
182+
* see [example sketch](esp32_ttgo) for an example on how to use it with
182183
the u8g2 library.
183184
184185
### Heltec WiFi Lora 32
@@ -201,7 +202,7 @@ transceiver.
201202
</p>
202203
203204
The display is labeled with `RPi Display 480x320 Pixel XPT246 Touch Controller`
204-
and uses an `ILI9486` controller. In raspian (tested with `2018-11-13 Raspian`).
205+
and uses an `ILI9486` controller. In raspian (tested with `2018-11-13 Raspian`).
205206
no additional drivers are needed. I got it running with the following configuration:
206207
207208
Add to `/boot/config.txt`:
@@ -275,7 +276,7 @@ Found DFU: [28e9:0189] ver=1000, devnum=7, cfg=1, intf=0, path="1-2", alt=1, nam
275276
Found DFU: [28e9:0189] ver=1000, devnum=7, cfg=1, intf=0, path="1-2", alt=0, name="@Internal Flash /0x08000000/512*002Kg", serial="??"
276277
```
277278
278-
#### Upload demo sketch
279+
#### Upload demo sketch
279280
280281
Before uploading to the MCU, make sure you installed [the udev rules as described here](https://docs.platformio.org/en/latest/faq.html#faq-udev-rules). Afterwards a
281282
`udevadm control --reload-rules && udevadm trigger` (as root) might be necessary.
@@ -304,7 +305,7 @@ TODO
304305
<img alt="rpi tft hdmi" width=256 src="images/rpi_tft_hdmi_2.jpg">
305306
</p>
306307
307-
The display is labelled "4inch HDMI LCD". The resolution is 800x480 and the
308+
The display is labelled "4inch HDMI LCD". The resolution is 800x480 and the
308309
display has a built in XPT2046 touch controller.
309310
310311
I had to power both the Raspi (RPi 3) and the display to get it run. The display
@@ -353,7 +354,7 @@ and a [simple build script](https://github.com/jandelgado/jled/blob/4.7.0/exampl
353354
The PCA9685 is an **I2C bus** controlled LED/Servo controller **with 16
354355
individually controllable PWM channels**. Each channel has a resolution of 12
355356
bits, resulting in 4096 steps. All channels operate at the same fixed
356-
frequency, which must be in the range between 24Hz and 1526Hz.
357+
frequency, which must be in the range between 24Hz and 1526Hz.
357358
358359
The board operates at 3V to 5V, which is fed through the VCC pin. The V+ pin
359360
is optional and is used to power servos or LEDs with up to 6V. The V+ voltage
@@ -368,14 +369,14 @@ SDA and SCL are the I2C data and clock pins. The OE pin is optional (and pulled
368369
down by default) and is used to quickly disable all outputs (by setting OE to
369370
high level).
370371
371-
The I2C address is by default `0x40` and can be changed by closing the `A0` to
372+
The I2C address is by default `0x40` and can be changed by closing the `A0` to
372373
`A5` pins using a soldering iron.
373374
374375
<img src="images/pca9685.png" width=400>
375376
376377
There are many libraries for PCA9685 based boards out there, I successfully
377378
used the [Adafruit PWM Servo Driver
378-
library](https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library).
379+
library](https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library).
379380
Have a look at [this example here](pca9685).
380381
381382
### MP3 Modules
@@ -410,7 +411,7 @@ Summary:
410411
* WTV020M01 is not recommended since not supporting MP3 format and very
411412
restrictive regarding SD cards used and audio encoding
412413
* The GPD2856A based boards are designed as stand alone players and are not
413-
meant to be controlled by a micro controller.
414+
meant to be controlled by a micro controller.
414415
* The DFPlayer Mini is a reliable board which can be controlled by a micro
415416
controller. It has an amplifier built in as well as an equalizer.
416417
* The VL1053 based shield supports many file formats and even recording of
@@ -419,7 +420,7 @@ Summary:
419420
controller. It lacks an amplifier and offers only a serial interface for
420421
control.
421422
422-
Addiontial links:
423+
Addiontial links:
423424
* DFPlayerMini: https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299
424425
* Catalex: http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf
425426
* GPD2856A: https://www.petervis.com/Electronics_Kits/gpd2856a/gpd2856a-mp3-decoder-board.html
@@ -440,7 +441,7 @@ plugin did not load. Refer to the
440441
[documentation](http://www.vlsi.fi/fileadmin/software/VS10XX/VorbisEncoder170c.pdf)
441442
for more details.
442443
443-
Libraries and examples:
444+
Libraries and examples:
444445
* https://github.com/adafruit/Adafruit_VS1053_Library
445446
* https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library
446447
@@ -456,7 +457,7 @@ boards available, mine is labeled `GY-BME/PM280` and costs about 1.60€
456457
(02/2023). I successfully connected it using I²C and CircuitPython, running on
457458
an Raspberry Pi Pico W using the
458459
[adafruit_bmp280](https://github.com/adafruit/Adafruit_CircuitPython_BMP280)
459-
library (install on the Pico Pi with `circup adadfruit_bmp280`).
460+
library (install on the Pico Pi with `circup adadfruit_bmp280`).
460461
461462
In the example I connected the sensor as follows:
462463
@@ -526,6 +527,60 @@ display.scroll("hello world")
526527
display.temperature(23)
527528
```
528529

530+
### ESP32 board with 1.14" RGB ST7789V TFT display
531+
532+
<p float="left">
533+
<img src="images/esp32_st7789v_3.jpg" height=200>
534+
<img src="images/esp32_st7789v_1.jpg" height=200>
535+
<img src="images/esp32_st7789v_2.jpg" height=200>
536+
</p>
537+
538+
This module was sold on aliexpress in different variations as
539+
_T-Display T-PicoC3 ESP32 S3 1,9 Zoll WiFi und Bluetooth-kompatibles Modul
540+
ESP32 C3 Entwicklungsboard 1,14 Zoll LCD für Arduino_. I ordered the ESP32-S3
541+
version, but the one I got had an ESP32-D0WDQD6 and not an ESP32-S3, as
542+
advertised. According to the specs, the display is a 1.14" RGB TFT display with
543+
an ST7789V controller, connected through SPI and wired as follows:
544+
545+
| Signal | Pin |
546+
|------------- |-----|
547+
| `MOSI` | 19 |
548+
| `SCLK` | 18 |
549+
| `CS` | 5 |
550+
| `DC` | 16 |
551+
| `RST` | 23 |
552+
| `BL` | 4 |
553+
554+
I tested 2 different libraries to control the TFT:
555+
556+
1. [deirvlon/ST7789v-Arduino](https://github.com/deirvlon/ST7789v-Arduino):
557+
while I had initially success in getting displayed at least anything,
558+
further inspection of the [code](https://github.com/deirvlon/ST7789v-Arduino/blob/main/ST7789v_arduino.cpp#L545)
559+
revealed, that the lib is hardwired to a resoultion of 240x320 pixels, resulting
560+
in a wrong geometry of displayed graphics
561+
2. [adafruit/Adafruit ST7735 and ST7789 Library](https://github.com/adafruit/Adafruit-ST7735-Library):
562+
this lib worked, and I have adapted one of the original [demos here](esp32_st7789v/test.ino),
563+
with the proper configuration
564+
565+
I eventually found out, that `BL` stands for `BACKLIGHT` and that the backlight
566+
must be turned on for obvious reasons.For that, I added the following code:
567+
568+
```c++
569+
...
570+
#define BL 4
571+
...
572+
573+
void setup() {
574+
...
575+
// turn the backlight on
576+
pinMode(BL, OUTPUT);
577+
digitalWrite(BL, 1);
578+
...
579+
}
580+
```
581+
582+
See this [sketch](esp32_st7789v/test.ino) for a working example.
583+
529584
## Misc
530585

531586
### WS2812 protection circuit

esp32_st7789v/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.common/Makefile

esp32_st7789v/platformio.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[platformio]
2+
default_envs = esp32
3+
src_dir = .
4+
5+
[env:esp32]
6+
platform = espressif32
7+
board = esp32dev
8+
framework = arduino
9+
monitor_speed = 9600
10+
lib_deps=adafruit/Adafruit ST7735 and ST7789 Library@1.10.4

0 commit comments

Comments
 (0)