├── esp32_ttgo ├── Makefile ├── platformio.ini └── esp32_ttgo.ino ├── pca9685 ├── Makefile ├── platformio.ini └── pca9685.ino ├── esp32_st7789v ├── Makefile ├── platformio.ini └── test.ino ├── wemos_d_duino ├── Makefile ├── platformio.ini └── wemos_d_duino.ino ├── cjmcu_8x8_sample ├── Makefile ├── platformio.ini ├── cjmcu_8x8_sample.ino └── README.md ├── esp32_c3_oled_0.42 ├── Makefile ├── platformio.ini └── esp32_c3_oled.ino ├── heltec_wifi_lora32 ├── Makefile ├── platformio.ini └── heltec_wifi_lora32.ino ├── sipeed_longan_nano ├── Makefile ├── platformio.ini-off └── sipeed_longnan_nano.ino ├── ssd1306_sample_u8g ├── Makefile ├── platformio.ini └── ssd1306_sample_u8g.ino ├── ssd1306_sample_adafruit ├── Makefile ├── platformio.ini └── ssd1306_sample_adafruit.ino ├── .envrc ├── images ├── TM1637.png ├── bmp280.png ├── heltec.jpg ├── jled.gif ├── pico.jpg ├── ftdi232.JPG ├── pca9685.png ├── ssd1306.jpg ├── wtv020a.png ├── wtv020b.png ├── colorduino.JPG ├── esp32-ttgo.png ├── mp3_modules.jpg ├── rpi_tft_35.jpg ├── esp32_c3_oled.jpg ├── sipeed_nano_1.jpg ├── sipeed_nano_2.jpg ├── ssd13006_back.jpg ├── wemos-d-duino.png ├── cjmcu-8x8 │ ├── cjmcu.jpg │ ├── cjmcu_back.jpg │ ├── cjmcu_front.jpg │ └── ws2812_detail.jpg ├── esp32-ttgo-back.png ├── esp32_st7789v_1.jpg ├── esp32_st7789v_2.jpg ├── esp32_st7789v_3.jpg ├── led_matrix_mono.jpg ├── led_matrix_rgb.JPG ├── rpi_tft_35_demo.jpg ├── rpi_tft_hdmi_1.jpg ├── rpi_tft_hdmi_2.jpg ├── WS2812_protection.jpg └── led_matrix_rgb_front.JPG ├── .gitignore ├── .common └── Makefile ├── .github └── workflows │ ├── stale.yml │ └── build.yml ├── LICENSE └── README.md /esp32_ttgo/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /pca9685/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /esp32_st7789v/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /wemos_d_duino/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /cjmcu_8x8_sample/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /esp32_c3_oled_0.42/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /heltec_wifi_lora32/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /sipeed_longan_nano/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /ssd1306_sample_u8g/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /ssd1306_sample_adafruit/Makefile: -------------------------------------------------------------------------------- 1 | ../.common/Makefile -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV=$HOME/.platformio/penv 2 | PATH_add $VIRTUAL_ENV/bin 3 | 4 | -------------------------------------------------------------------------------- /images/TM1637.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/TM1637.png -------------------------------------------------------------------------------- /images/bmp280.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/bmp280.png -------------------------------------------------------------------------------- /images/heltec.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/heltec.jpg -------------------------------------------------------------------------------- /images/jled.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/jled.gif -------------------------------------------------------------------------------- /images/pico.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/pico.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .pioenvs/ 3 | .piolibdeps/ 4 | libraries 5 | libraries/* 6 | **/.pio 7 | -------------------------------------------------------------------------------- /images/ftdi232.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/ftdi232.JPG -------------------------------------------------------------------------------- /images/pca9685.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/pca9685.png -------------------------------------------------------------------------------- /images/ssd1306.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/ssd1306.jpg -------------------------------------------------------------------------------- /images/wtv020a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/wtv020a.png -------------------------------------------------------------------------------- /images/wtv020b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/wtv020b.png -------------------------------------------------------------------------------- /images/colorduino.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/colorduino.JPG -------------------------------------------------------------------------------- /images/esp32-ttgo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/esp32-ttgo.png -------------------------------------------------------------------------------- /images/mp3_modules.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/mp3_modules.jpg -------------------------------------------------------------------------------- /images/rpi_tft_35.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/rpi_tft_35.jpg -------------------------------------------------------------------------------- /images/esp32_c3_oled.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/esp32_c3_oled.jpg -------------------------------------------------------------------------------- /images/sipeed_nano_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/sipeed_nano_1.jpg -------------------------------------------------------------------------------- /images/sipeed_nano_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/sipeed_nano_2.jpg -------------------------------------------------------------------------------- /images/ssd13006_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/ssd13006_back.jpg -------------------------------------------------------------------------------- /images/wemos-d-duino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/wemos-d-duino.png -------------------------------------------------------------------------------- /images/cjmcu-8x8/cjmcu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/cjmcu-8x8/cjmcu.jpg -------------------------------------------------------------------------------- /images/esp32-ttgo-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/esp32-ttgo-back.png -------------------------------------------------------------------------------- /images/esp32_st7789v_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/esp32_st7789v_1.jpg -------------------------------------------------------------------------------- /images/esp32_st7789v_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/esp32_st7789v_2.jpg -------------------------------------------------------------------------------- /images/esp32_st7789v_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/esp32_st7789v_3.jpg -------------------------------------------------------------------------------- /images/led_matrix_mono.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/led_matrix_mono.jpg -------------------------------------------------------------------------------- /images/led_matrix_rgb.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/led_matrix_rgb.JPG -------------------------------------------------------------------------------- /images/rpi_tft_35_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/rpi_tft_35_demo.jpg -------------------------------------------------------------------------------- /images/rpi_tft_hdmi_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/rpi_tft_hdmi_1.jpg -------------------------------------------------------------------------------- /images/rpi_tft_hdmi_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/rpi_tft_hdmi_2.jpg -------------------------------------------------------------------------------- /images/WS2812_protection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/WS2812_protection.jpg -------------------------------------------------------------------------------- /images/cjmcu-8x8/cjmcu_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/cjmcu-8x8/cjmcu_back.jpg -------------------------------------------------------------------------------- /images/cjmcu-8x8/cjmcu_front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/cjmcu-8x8/cjmcu_front.jpg -------------------------------------------------------------------------------- /images/led_matrix_rgb_front.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/led_matrix_rgb_front.JPG -------------------------------------------------------------------------------- /images/cjmcu-8x8/ws2812_detail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jandelgado/arduino/HEAD/images/cjmcu-8x8/ws2812_detail.jpg -------------------------------------------------------------------------------- /esp32_ttgo/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = esp32 3 | src_dir = . 4 | 5 | [env:esp32] 6 | platform = espressif32 7 | board = esp32dev 8 | framework = arduino 9 | lib_deps=olikraus/U8g2@2.36.2 10 | 11 | -------------------------------------------------------------------------------- /wemos_d_duino/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = esp8266 3 | src_dir = . 4 | 5 | [env:esp8266] 6 | platform = espressif8266 7 | board = nodemcuv2 8 | framework = arduino 9 | lib_deps=olikraus/U8g2@2.36.2 10 | -------------------------------------------------------------------------------- /heltec_wifi_lora32/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = esp32 3 | src_dir = . 4 | 5 | [env:esp32] 6 | platform = espressif32 7 | board = esp32dev 8 | framework = arduino 9 | lib_deps=olikraus/U8g2@2.36.2 10 | 11 | -------------------------------------------------------------------------------- /ssd1306_sample_u8g/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = nanoatmega328 3 | src_dir = . 4 | 5 | [env:nanoatmega328] 6 | platform = atmelavr 7 | board = nanoatmega328 8 | framework = arduino 9 | lib_deps=olikraus/U8glib@1.19.1 10 | 11 | -------------------------------------------------------------------------------- /esp32_c3_oled_0.42/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = esp32c3 3 | src_dir = . 4 | 5 | [env:esp32c3] 6 | platform = espressif32 7 | board = esp32-c3-devkitm-1 8 | framework = arduino 9 | lib_deps=olikraus/U8g2@2.36.2 10 | jandelgado/JLed@4.15.0 11 | -------------------------------------------------------------------------------- /esp32_st7789v/platformio.ini: -------------------------------------------------------------------------------- 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 11 | -------------------------------------------------------------------------------- /ssd1306_sample_adafruit/platformio.ini: -------------------------------------------------------------------------------- 1 | [platformio] 2 | default_envs = nanoatmega328 3 | src_dir = . 4 | 5 | [env:nanoatmega328] 6 | platform = atmelavr 7 | board = nanoatmega328 8 | framework = arduino 9 | lib_deps = adafruit/Adafruit GFX Library@1.11.11 10 | adafruit/Adafruit SSD1306@2.5.13 11 | 12 | -------------------------------------------------------------------------------- /sipeed_longan_nano/platformio.ini-off: -------------------------------------------------------------------------------- 1 | [platformio] 2 | env_default = sipeed_longan_nano 3 | src_dir = . 4 | 5 | ; no longer works an platformio does not support arduino framework 6 | ; for the sipeed-longan-nano using the nuclei sdk. 7 | [env:sipeed_longan_nano] 8 | platform = gd32v 9 | board = sipeed-longan-nano 10 | board_build.mcu = GD32VF103CBT6 11 | platform_packages = framework-arduino-gd32v @ https://github.com/sipeed/Longduino.git 12 | framework = arduino 13 | upload_protocol = dfu 14 | #lib_deps=jled 15 | 16 | -------------------------------------------------------------------------------- /.common/Makefile: -------------------------------------------------------------------------------- 1 | # makefile to build examples with platformi 2 | # 3 | .PHONY: phony 4 | 5 | run: phony 6 | pio run 7 | 8 | envdump: phony 9 | -pio run --target envdump 10 | 11 | clean: phony 12 | -pio run --target clean 13 | 14 | upload: phony 15 | pio run --target upload 16 | 17 | monitor: phony 18 | pio device monitor 19 | 20 | tags: phony 21 | ctags -R 22 | 23 | ci: 24 | find .. -maxdepth 2 -not -path '\.\./\.common/*' -name Makefile \ 25 | -exec sh -c 'make -C $$(dirname {})' \; 26 | phony: 27 | 28 | 29 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Stale issue handler' 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@main 12 | with: 13 | stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days' 14 | days-before-stale: 90 15 | days-before-close: 5 16 | exempt-issue-labels: 'blocked,must,should,keep' 17 | -------------------------------------------------------------------------------- /heltec_wifi_lora32/heltec_wifi_lora32.ino: -------------------------------------------------------------------------------- 1 | // Heltec Lora Wifi 32 OLED Demo 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16); 9 | 10 | void setup(void) 11 | { 12 | u8x8.begin(); 13 | 14 | u8x8.setFont(u8x8_font_amstrad_cpc_extended_f); 15 | u8x8.clear(); 16 | 17 | u8x8.setCursor(0,0); 18 | u8x8.print("Heltec Wifi"); 19 | u8x8.setCursor(0,1); 20 | u8x8.print("Lora 32"); 21 | } 22 | 23 | 24 | void loop(void) 25 | { 26 | delay(1000); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - master 5 | pull_request: 6 | branches: 7 | - master 8 | 9 | name: build examples 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: checkout code 15 | uses: actions/checkout@v4 16 | 17 | - name: install python 18 | uses: actions/setup-python@v4 19 | with: 20 | python-version: '3.13' 21 | 22 | - name: install tools 23 | run: | 24 | pip install platformio==6.1.10 25 | 26 | - name: build examples 27 | run: make -C .common ci 28 | -------------------------------------------------------------------------------- /esp32_ttgo/esp32_ttgo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Demo for ESP32 TTGO board w/ I2C SSD1306 based 128x64 OLED module 3 | * using u8glib2 in full screen mode. 4 | * Jan Delgado 11-2018 5 | */ 6 | 7 | #include "U8g2lib.h" 8 | #include 9 | 10 | U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, 4 /* SCL */, 5 /* SDA */); 11 | 12 | void setup(void) { 13 | u8g2.begin(); 14 | } 15 | 16 | void loop(void) { 17 | u8g2.clearBuffer(); 18 | u8g2.setFont(u8g2_font_torussansbold8_8r); 19 | u8g2.drawStr(0,20,"ESP32 TTGO"); 20 | u8g2.drawStr(0,40,"SSD1306 (I2C)"); 21 | u8g2.sendBuffer(); 22 | delay(1000); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /cjmcu_8x8_sample/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | default_envs = nanoatmega328 13 | src_dir = . 14 | 15 | [env:nanoatmega328] 16 | platform = atmelavr 17 | board = nanoatmega328 18 | framework = arduino 19 | lib_deps=fastled/FastLED@3.9.3 20 | 21 | -------------------------------------------------------------------------------- /sipeed_longan_nano/sipeed_longnan_nano.ino: -------------------------------------------------------------------------------- 1 | // sipseed longan nano demo - cycle through builtin LEDs 2 | // Jan Delgado 01-2020 3 | // 4 | #include 5 | 6 | void setup() { 7 | pinMode(LED_RED, OUTPUT); 8 | pinMode(LED_GREEN, OUTPUT); 9 | pinMode(LED_BLUE, OUTPUT); 10 | } 11 | 12 | void loop() { 13 | // builtin LEDs are low-active 14 | static PinStatus levels[] = {LOW,HIGH,HIGH}; 15 | static auto level = 0; 16 | 17 | digitalWrite(LED_RED, levels[level%3]); 18 | digitalWrite(LED_GREEN, levels[(level+1)%3]); 19 | digitalWrite(LED_BLUE, levels[(level+2)%3]); 20 | level++; 21 | 22 | delay(500); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /pca9685/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | default_envs = esp32 13 | src_dir = . 14 | 15 | [env:esp32] 16 | platform = espressif32 17 | board = esp32dev 18 | framework = arduino 19 | lib_ldf_mode = deep+ 20 | lib_deps = adafruit/Adafruit PWM Servo Driver Library@3.0.2 21 | adafruit/Adafruit BusIO@1.16.2 22 | 23 | -------------------------------------------------------------------------------- /wemos_d_duino/wemos_d_duino.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Demo for WEMOS "D-DUINO" w/ I2C SSD1306 based 128x64 OLED module using u8glib2. 3 | */ 4 | 5 | #include "U8g2lib.h" 6 | #include 7 | 8 | // connected via I2C D1-SDA, D2-SCL 9 | U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, D2 /* SCL */, D1 /* SDA */); 10 | 11 | void setup(void) { 12 | u8g2.begin(); 13 | } 14 | 15 | /* draw something on the display with the `firstPage()`/`nextPage()` loop*/ 16 | void loop(void) { 17 | u8g2.firstPage(); 18 | do { 19 | u8g2.setFont(u8g2_font_torussansbold8_8r); 20 | u8g2.drawStr(0,20,"WEMOS D-DUINO"); 21 | u8g2.drawStr(0,40,"SSD1306 (I2C)"); 22 | } while ( u8g2.nextPage() ); 23 | delay(1000); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Jan Delgado 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ssd1306_sample_u8g/ssd1306_sample_u8g.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Demo for SSD1306 based 128x64 OLED module using u8glib. 3 | * See https://github.com/pacodelgado/arduino/wiki/SSD1306-based-OLED-connected-to-Arduino 4 | * for more information. 5 | * 6 | * --------------------------------------------------------------------- 7 | * U8glib library copyright notice: 8 | * Universal 8bit Graphics Library, http://code.google.com/p/u8glib/ 9 | * Copyright (c) 2012, olikraus@gmail.com 10 | * All rights reserved. 11 | */ 12 | 13 | #include "U8glib.h" 14 | 15 | /* Create an instance for the SSD1306 OLED display in SPI mode 16 | * connection scheme: 17 | * D0=sck=Pin 12 18 | * D1=mosi=Pin 11 19 | * CS=Pin 8 20 | * DC=A0=Pin 9 21 | * Reset=Pin 10 22 | */ 23 | U8GLIB_SSD1306_128X64 u8g(12, 11, 8, 9, 10); 24 | 25 | void setup() 26 | { 27 | /* nothing to do here */ 28 | } 29 | 30 | void loop() 31 | { 32 | u8g.firstPage(); 33 | 34 | /* Keep looping until finished drawing screen */ 35 | do 36 | { 37 | int steps = 16; 38 | int dx = 128/steps; 39 | int dy = 64/steps; 40 | int y = 0; 41 | for(int x=0; x<128; x+=dx) { 42 | u8g.drawLine(x, 0, 127, y); 43 | u8g.drawLine(127-x, 63, 0, 63-y); 44 | y+=dy; 45 | } 46 | 47 | } while(u8g.nextPage()); 48 | } 49 | -------------------------------------------------------------------------------- /cjmcu_8x8_sample/cjmcu_8x8_sample.ino: -------------------------------------------------------------------------------- 1 | // Demo for CJMCU-8*8 LED RGB Matrix. Demo assumes CJMCU connected 2 | // to an Arduino nano on PIN D9 3 | // Jan Delgado 2018 4 | #include 5 | 6 | // LED configutration 7 | #define LED_TYPE WS2812B // type of LED in use. CJMCU works with 8 | // WS2811,WS2812,WS2812B (compatible) 9 | 10 | constexpr auto LED_DT = 9; // Pin WS2812 Data in (DIN) is connected to 11 | constexpr auto COLOR_ORDER = GRB; 12 | constexpr auto NUM_LEDS = 64; 13 | constexpr auto SPEED_MS = 50; 14 | 15 | CRGB leds[NUM_LEDS]; 16 | 17 | void setup() { 18 | 19 | LEDS.addLeds(leds, NUM_LEDS); 20 | FastLED.setBrightness(128); 21 | 22 | // FastLED 2.1 Power management set at 5V, 500mA 23 | set_max_power_in_volts_and_milliamps(5, 500); 24 | CRGB cols[] = {CRGB::Red, CRGB::Green, CRGB::Blue}; 25 | 26 | for(auto c : cols) { 27 | for(auto i = 0; i 12 | #include 13 | 14 | constexpr auto LED_PIN = 15; // PIN where LED is connected on PCA9685 15 | constexpr auto I2C_ADDRESS = 0x40; // Default I2C address of PCA9685 16 | 17 | // Use Software I2C on Pins D2 and D4 18 | constexpr auto SDA_PIN = 2; 19 | constexpr auto SCL_PIN = 4; 20 | TwoWire i2c = TwoWire(0); 21 | Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(I2C_ADDRESS, i2c); 22 | 23 | // ...or just use the defaults with SDA=D21, SCL=D22 (ESP32) and 24 | // just construct a Adafruit_PWMServoDriver object like: 25 | // Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver() 26 | 27 | void setup() { 28 | i2c.begin(SDA_PIN, SCL_PIN); 29 | pwm.begin(); 30 | pwm.setPWMFreq(1000); 31 | } 32 | 33 | void loop() { 34 | static int count = 0; 35 | // setPin() sets PWM of given output to value in range [0,4095] 36 | pwm.setPin(LED_PIN, ((count % 256)<<4) | 15, false); 37 | count++; 38 | delay(2); 39 | } 40 | -------------------------------------------------------------------------------- /ssd1306_sample_adafruit/ssd1306_sample_adafruit.ino: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Demo for SSD1306 based 128x64 OLED module using Adafruit SSD1306 4 | * library (https://github.com/adafruit/Adafruit_SSD1306). 5 | * 6 | * See https://github.com/pacodelgado/arduino/wiki/SSD1306-based-OLED-connected-to-Arduino 7 | * for more information. 8 | * 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // If using software SPI (the default case): 17 | #define OLED_MOSI 11 //D1 18 | #define OLED_CLK 12 //D0 19 | #define OLED_DC 9 20 | #define OLED_CS 8 21 | #define OLED_RESET 10 22 | 23 | Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); 24 | 25 | void setup() { 26 | // Serial.begin(9600); 27 | display.begin(SSD1306_SWITCHCAPVCC); 28 | display.display(); 29 | delay(1000); 30 | display.clearDisplay(); 31 | display.setTextSize(1); 32 | display.setTextColor(WHITE); 33 | } 34 | 35 | void loop() 36 | { 37 | static unsigned long thisMicros = 0; 38 | static unsigned long lastMicros = 0; 39 | display.clearDisplay(); 40 | display.setCursor(0,0); 41 | display.print("Now is the time for all good men to come to the aid the party \n"); 42 | display.print("The quick brown fox jumps over a lazy dog \n"); 43 | display.print(thisMicros - lastMicros); 44 | display.print(" microseconds"); 45 | display.display(); 46 | lastMicros = thisMicros; 47 | thisMicros = micros(); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /cjmcu_8x8_sample/README.md: -------------------------------------------------------------------------------- 1 | # CJMCU-8*8 LED RGB Matrix 2 | 3 | CJMCU-8*8 4 | 5 | I recently got some of those `CJMCU-8*8` labeled LED RGB Matrix boards. 6 | According to what is printed on the boards, they are opposed to be built 7 | up on `WS2812B` RGB "Neopixel" LEDs. Connecting the matrix to an Arduino however, 8 | I had no luck at all on my first attempt. Later I found that these PCBs were 9 | totally misleadingly labeled: 10 | 11 | * `DIN` and `DOUT` labels are exchanged (!) 12 | * the board uses `WS2812` LEDs, which use the WS2811 driver IC (but is labeled as 13 | `WS2812B`) 14 | 15 | | Front | Back | 16 | | ----- | ---- | 17 | | ![CJMCU-8*8 front](../images/cjmcu-8x8/cjmcu_front.jpg) | ![CJMCU-8*8 back](../images/cjmcu-8x8/cjmcu_back.jpg) | 18 | 19 | Knowing that, I could get the board up and running using the FastLED library 20 | without problem. [See the Demo sketch for an example](cjmcu_8x8_sample.ino). 21 | The sketch assumes the CJMCU board is connected to pin D9 of an Arduino. 22 | 23 | Since the WS2812 (which is an WS2811 driver IC packaged with a LED) and the WS2812B 24 | use the same protocol, the difference in type make no difference in interfacing 25 | the LEDs with e.g. the [FastLED library](https://github.com/FastLED/FastLED). 26 | 27 | ## Spot the difference 28 | 29 | The WS2812 uses a 6 pin package. So if your LEDs have 6 pins instead of 4, 30 | then chances are your PCB is populated with WS2812 LEDs. 31 | 32 | ![ws2812 detail](../images/cjmcu-8x8/ws2812_detail.jpg) 33 | -------------------------------------------------------------------------------- /esp32_c3_oled_0.42/esp32_c3_oled.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * demo for tiny ESP32-C3 board with 0.42" OLED display using u8glib2. 3 | * The OLED is connected to I²C pins 5 (SDA) and 6 (SCL). 4 | * The on-board LED is connected to pin 8 and low-active. 5 | */ 6 | 7 | #include "U8g2lib.h" 8 | #include "jled.h" 9 | #include 10 | #include 11 | 12 | #define SDA_PIN 5 13 | #define SCL_PIN 6 14 | 15 | U8G2_SH1106_72X40_WISE_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE); 16 | auto led = JLed(8).Breathe(4000).MinBrightness(20).LowActive().Forever(); 17 | 18 | void setup(void) { 19 | // initialize I²C 20 | Wire.begin(SDA_PIN, SCL_PIN); 21 | u8g2.begin(); 22 | 23 | // Initialize temperature sensor 24 | temp_sensor_config_t temp_sensor = { 25 | .dac_offset = TSENS_DAC_DEFAULT, 26 | .clk_div = 6, 27 | }; 28 | temp_sensor_set_config(temp_sensor); 29 | temp_sensor_start(); 30 | } 31 | 32 | void loop(void) { 33 | static long last_update = 0; 34 | 35 | if (millis() - last_update > 1000) { 36 | u8g2.firstPage(); 37 | do { 38 | float temp; 39 | temp_sensor_read_celsius(&temp); 40 | 41 | u8g2.setFont(u8g2_font_torussansbold8_8r); 42 | u8g2.drawFrame(0, 0, 72, 40); 43 | u8g2.drawStr(2, 10, "Hello"); 44 | u8g2.drawStr(2, 18, "ESP32-C3"); 45 | u8g2.drawStr(2, 26, (String("T=") + String(temp, 1)).c_str()); 46 | u8g2.drawStr(2, 34, (String(last_update / 1000)).c_str()); 47 | 48 | } while (u8g2.nextPage()); 49 | last_update = millis(); 50 | } 51 | 52 | led.Update(); 53 | delay(1); 54 | } 55 | -------------------------------------------------------------------------------- /esp32_st7789v/test.ino: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | Source: https://github.com/adafruit/Adafruit-ST7735-Library/blob/c7882bfd42adf196f34c7080c7206d2f0d6939da/examples/graphicstest/graphicstest.ino 3 | Minor changes (i.e. enable backlight and removal of unused code) for 4 | ESP32 ST7789V 1.14" demo by Jan Delgado 12/2024. 5 | 6 | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 7 | This is a library for several Adafruit displays based on ST77* drivers. 8 | 9 | Works with the Adafruit 1.8" TFT Breakout w/SD card 10 | ----> http://www.adafruit.com/products/358 11 | The 1.8" TFT shield 12 | ----> https://www.adafruit.com/product/802 13 | The 1.44" TFT breakout 14 | ----> https://www.adafruit.com/product/2088 15 | The 1.14" TFT breakout 16 | ----> https://www.adafruit.com/product/4383 17 | The 1.3" TFT breakout 18 | ----> https://www.adafruit.com/product/4313 19 | The 1.54" TFT breakout 20 | ----> https://www.adafruit.com/product/3787 21 | The 1.69" TFT breakout 22 | ----> https://www.adafruit.com/product/5206 23 | The 2.0" TFT breakout 24 | ----> https://www.adafruit.com/product/4311 25 | as well as Adafruit raw 1.8" TFT display 26 | ----> http://www.adafruit.com/products/618 27 | 28 | Check out the links above for our tutorials and wiring diagrams. 29 | These displays use SPI to communicate, 4 or 5 pins are required to 30 | interface (RST is optional). 31 | 32 | Adafruit invests time and resources providing this open source code, 33 | please support Adafruit and open-source hardware by purchasing 34 | products from Adafruit! 35 | 36 | Written by Limor Fried/Ladyada for Adafruit Industries. 37 | MIT license, all text above must be included in any redistribution 38 | 39 | **************************************************************************/ 40 | 41 | #include // Core graphics library 42 | #include // Hardware-specific library for ST7789 43 | #include 44 | 45 | // using software SPI 46 | #define TFT_CS 5 47 | #define TFT_RST 23 48 | #define TFT_DC 16 49 | #define TFT_MOSI 19 // Data out 50 | #define TFT_SCLK 18 // Clock out 51 | 52 | // JD: backlight 53 | #define BL 4 54 | 55 | Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); 56 | 57 | float p = 3.1415926; 58 | 59 | void setup(void) { 60 | Serial.begin(9600); 61 | Serial.print(F("Hello! ST77xx TFT Test")); 62 | 63 | // JD: turn backlight on 64 | pinMode(BL, OUTPUT); 65 | digitalWrite(BL, 1); 66 | 67 | tft.init(135, 240); // Init ST7789 240x135 68 | 69 | Serial.println(F("Initialized")); 70 | 71 | uint16_t time = millis(); 72 | tft.fillScreen(ST77XX_BLACK); 73 | time = millis() - time; 74 | 75 | Serial.println(time, DEC); 76 | delay(500); 77 | 78 | // large block of text 79 | tft.fillScreen(ST77XX_BLACK); 80 | testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", ST77XX_WHITE); 81 | delay(1000); 82 | 83 | // tft print function! 84 | tftPrintTest(); 85 | delay(4000); 86 | 87 | // a single pixel 88 | tft.drawPixel(tft.width()/2, tft.height()/2, ST77XX_GREEN); 89 | delay(500); 90 | 91 | // line draw test 92 | testlines(ST77XX_YELLOW); 93 | delay(500); 94 | 95 | // optimized lines 96 | testfastlines(ST77XX_RED, ST77XX_BLUE); 97 | delay(500); 98 | 99 | testdrawrects(ST77XX_GREEN); 100 | delay(500); 101 | 102 | testfillrects(ST77XX_YELLOW, ST77XX_MAGENTA); 103 | delay(500); 104 | 105 | tft.fillScreen(ST77XX_BLACK); 106 | testfillcircles(10, ST77XX_BLUE); 107 | testdrawcircles(10, ST77XX_WHITE); 108 | delay(500); 109 | 110 | testroundrects(); 111 | delay(500); 112 | 113 | testtriangles(); 114 | delay(500); 115 | 116 | mediabuttons(); 117 | delay(500); 118 | 119 | Serial.println("done"); 120 | delay(1000); 121 | } 122 | 123 | void loop() { 124 | tft.invertDisplay(true); 125 | delay(500); 126 | tft.invertDisplay(false); 127 | delay(500); 128 | } 129 | 130 | void testlines(uint16_t color) { 131 | tft.fillScreen(ST77XX_BLACK); 132 | for (int16_t x=0; x < tft.width(); x+=6) { 133 | tft.drawLine(0, 0, x, tft.height()-1, color); 134 | delay(0); 135 | } 136 | for (int16_t y=0; y < tft.height(); y+=6) { 137 | tft.drawLine(0, 0, tft.width()-1, y, color); 138 | delay(0); 139 | } 140 | 141 | tft.fillScreen(ST77XX_BLACK); 142 | for (int16_t x=0; x < tft.width(); x+=6) { 143 | tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color); 144 | delay(0); 145 | } 146 | for (int16_t y=0; y < tft.height(); y+=6) { 147 | tft.drawLine(tft.width()-1, 0, 0, y, color); 148 | delay(0); 149 | } 150 | 151 | tft.fillScreen(ST77XX_BLACK); 152 | for (int16_t x=0; x < tft.width(); x+=6) { 153 | tft.drawLine(0, tft.height()-1, x, 0, color); 154 | delay(0); 155 | } 156 | for (int16_t y=0; y < tft.height(); y+=6) { 157 | tft.drawLine(0, tft.height()-1, tft.width()-1, y, color); 158 | delay(0); 159 | } 160 | 161 | tft.fillScreen(ST77XX_BLACK); 162 | for (int16_t x=0; x < tft.width(); x+=6) { 163 | tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color); 164 | delay(0); 165 | } 166 | for (int16_t y=0; y < tft.height(); y+=6) { 167 | tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color); 168 | delay(0); 169 | } 170 | } 171 | 172 | void testdrawtext(char *text, uint16_t color) { 173 | tft.setCursor(0, 0); 174 | tft.setTextColor(color); 175 | tft.setTextWrap(true); 176 | tft.print(text); 177 | } 178 | 179 | void testfastlines(uint16_t color1, uint16_t color2) { 180 | tft.fillScreen(ST77XX_BLACK); 181 | for (int16_t y=0; y < tft.height(); y+=5) { 182 | tft.drawFastHLine(0, y, tft.width(), color1); 183 | } 184 | for (int16_t x=0; x < tft.width(); x+=5) { 185 | tft.drawFastVLine(x, 0, tft.height(), color2); 186 | } 187 | } 188 | 189 | void testdrawrects(uint16_t color) { 190 | tft.fillScreen(ST77XX_BLACK); 191 | for (int16_t x=0; x < tft.width(); x+=6) { 192 | tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color); 193 | } 194 | } 195 | 196 | void testfillrects(uint16_t color1, uint16_t color2) { 197 | tft.fillScreen(ST77XX_BLACK); 198 | for (int16_t x=tft.width()-1; x > 6; x-=6) { 199 | tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1); 200 | tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2); 201 | } 202 | } 203 | 204 | void testfillcircles(uint8_t radius, uint16_t color) { 205 | for (int16_t x=radius; x < tft.width(); x+=radius*2) { 206 | for (int16_t y=radius; y < tft.height(); y+=radius*2) { 207 | tft.fillCircle(x, y, radius, color); 208 | } 209 | } 210 | } 211 | 212 | void testdrawcircles(uint8_t radius, uint16_t color) { 213 | for (int16_t x=0; x < tft.width()+radius; x+=radius*2) { 214 | for (int16_t y=0; y < tft.height()+radius; y+=radius*2) { 215 | tft.drawCircle(x, y, radius, color); 216 | } 217 | } 218 | } 219 | 220 | void testtriangles() { 221 | tft.fillScreen(ST77XX_BLACK); 222 | uint16_t color = 0xF800; 223 | int t; 224 | int w = tft.width()/2; 225 | int x = tft.height()-1; 226 | int y = 0; 227 | int z = tft.width(); 228 | for(t = 0 ; t <= 15; t++) { 229 | tft.drawTriangle(w, y, y, x, z, x, color); 230 | x-=4; 231 | y+=4; 232 | z-=4; 233 | color+=100; 234 | } 235 | } 236 | 237 | void testroundrects() { 238 | tft.fillScreen(ST77XX_BLACK); 239 | uint16_t color = 100; 240 | int i; 241 | int t; 242 | for(t = 0 ; t <= 4; t+=1) { 243 | int x = 0; 244 | int y = 0; 245 | int w = tft.width()-2; 246 | int h = tft.height()-2; 247 | for(i = 0 ; i <= 16; i+=1) { 248 | tft.drawRoundRect(x, y, w, h, 5, color); 249 | x+=2; 250 | y+=3; 251 | w-=4; 252 | h-=6; 253 | color+=1100; 254 | } 255 | color+=100; 256 | } 257 | } 258 | 259 | void tftPrintTest() { 260 | tft.setTextWrap(false); 261 | tft.fillScreen(ST77XX_BLACK); 262 | tft.setCursor(0, 30); 263 | tft.setTextColor(ST77XX_RED); 264 | tft.setTextSize(1); 265 | tft.println("Hello World!"); 266 | tft.setTextColor(ST77XX_YELLOW); 267 | tft.setTextSize(2); 268 | tft.println("Hello World!"); 269 | tft.setTextColor(ST77XX_GREEN); 270 | tft.setTextSize(3); 271 | tft.println("Hello World!"); 272 | tft.setTextColor(ST77XX_BLUE); 273 | tft.setTextSize(4); 274 | tft.print(1234.567); 275 | delay(1500); 276 | tft.setCursor(0, 0); 277 | tft.fillScreen(ST77XX_BLACK); 278 | tft.setTextColor(ST77XX_WHITE); 279 | tft.setTextSize(0); 280 | tft.println("Hello World!"); 281 | tft.setTextSize(1); 282 | tft.setTextColor(ST77XX_GREEN); 283 | tft.print(p, 6); 284 | tft.println(" Want pi?"); 285 | tft.println(" "); 286 | tft.print(8675309, HEX); // print 8,675,309 out in HEX! 287 | tft.println(" Print HEX!"); 288 | tft.println(" "); 289 | tft.setTextColor(ST77XX_WHITE); 290 | tft.println("Sketch has been"); 291 | tft.println("running for: "); 292 | tft.setTextColor(ST77XX_MAGENTA); 293 | tft.print(millis() / 1000); 294 | tft.setTextColor(ST77XX_WHITE); 295 | tft.print(" seconds."); 296 | } 297 | 298 | void mediabuttons() { 299 | // play 300 | tft.fillScreen(ST77XX_BLACK); 301 | tft.fillRoundRect(25, 10, 78, 60, 8, ST77XX_WHITE); 302 | tft.fillTriangle(42, 20, 42, 60, 90, 40, ST77XX_RED); 303 | delay(500); 304 | // pause 305 | tft.fillRoundRect(25, 90, 78, 60, 8, ST77XX_WHITE); 306 | tft.fillRoundRect(39, 98, 20, 45, 5, ST77XX_GREEN); 307 | tft.fillRoundRect(69, 98, 20, 45, 5, ST77XX_GREEN); 308 | delay(500); 309 | // play color 310 | tft.fillTriangle(42, 20, 42, 60, 90, 40, ST77XX_BLUE); 311 | delay(50); 312 | // pause color 313 | tft.fillRoundRect(39, 98, 20, 45, 5, ST77XX_RED); 314 | tft.fillRoundRect(69, 98, 20, 45, 5, ST77XX_RED); 315 | // play color 316 | tft.fillTriangle(42, 20, 42, 60, 90, 40, ST77XX_GREEN); 317 | } 318 | 319 | 320 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino 2 | 3 | Notes on Arduino libraries and sketches and other related stuff. 4 | 5 | 6 | 7 | * [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) 13 | * [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) 32 | * [ESP32 board with 1.14" RGB ST7789V TFT display](#esp32-board-with-114-rgb-st7789v-tft-display) 33 | * [ESP32-C3 with 0.42" I²C OLED display](#esp32-c3-with-042-ic-oled-display) 34 | * [Misc](#misc) 35 | * [WS2812 protection circuit](#ws2812-protection-circuit) 36 | * [Author](#author) 37 | 38 | 39 | 40 | ## My Libraries and projects 41 | 42 | ### JLed 43 | 44 | JLed is an Arduino library to control LEDs. It uses a non-blocking approach and 45 | can control LEDs in simple (on/off) and complex (blinking, breathing) ways in a 46 | time-driven manner. It's available as a C++ or Python lib. 47 | 48 | jled 49 | 50 | ```c++ 51 | // breathe LED (on gpio 9) 6 times for 1500ms, waiting for 500ms after each run 52 | #include 53 | 54 | auto led_breathe = JLed(9).Breathe(1500).Repeat(6).DelayAfter(500); 55 | 56 | void setup() { } 57 | 58 | void loop() { 59 | led_breathe.Update(); 60 | } 61 | ``` 62 | 63 | The Python API mirrors the C++ API: 64 | 65 | ```python 66 | import board 67 | from jled import JLed 68 | 69 | led = JLed(board.LED).blink(500, 500).forever() 70 | 71 | while True: 72 | led.update() 73 | ``` 74 | 75 | * https://github.com/jandelgado/jled 76 | * https://github.com/jandelgado/jled-circuitpython 77 | 78 | ### log4arduino 79 | 80 | A lightweight, no-frills logging library for Arduino & friends. 81 | 82 | ```c++ 83 | LOG("hello, log4arduino."); 84 | delay(42); 85 | LOG("use %s formatting: %d %c %d %c %d", "printf", 9, '+', 1, '=', 10); 86 | ``` 87 | 88 | Allows simple printf-like formatting and shows current time in millis and 89 | available memory, e.g. 90 | 91 | ``` 92 | 0(1623): hello, log4arduino. 93 | 42(1609): use printf formatting: 9 + 1 = 10 94 | ``` 95 | 96 | * https://github.com/jandelgado/log4arduino 97 | 98 | ### eps32-aws-iot 99 | 100 | Code, tools and instructions on how to connect ESP32 securely to the AWS IOT 101 | cloud. 102 | 103 | * https://github.com/jandelgado/esp32-aws-iot 104 | 105 | ### USB Spinner Game Controller 106 | 107 | An Arduino Pro Micro based USB spinner (like a paddle) game controller. Great 108 | to play games like e.g. Arkanoid. Simulates an USB mouse and needs no drivers. 109 | 110 | * https://github.com/jandelgado/usb-spinner 111 | 112 | ### Simpson Device (virtual Drinking Bird) 113 | 114 | Simulates an USB mouse using an Attiny85 (Digispark board) and randomly moves 115 | your mouse (see The Simpsons S07E07). 116 | 117 | * https://github.com/jandelgado/simpson-device 118 | 119 | ## Sketches 120 | 121 | To build the demo sketches you can either copy the folders to the source 122 | folder of your Arduino IDE or use PlatformIO and the provided makefiles, e.g.: 123 | 124 | ``` 125 | $ cd cjmcu_8x8_sample 126 | $ make upload 127 | ``` 128 | 129 | The following make targets can be used: run, envdump, clean, upload, monitor 130 | 131 | ### Interfacing SSD1306 based OLED displays (SPI) 132 | 133 | ssd1306 134 | 135 | * [ssd1306_sample_adafruit](ssd1306_sample_adafruit) - sample code for ssd1306 based oled display. see [wiki](http://github.com/jandelgado/arduino/wiki/SSD1306-based-OLED-connected-to-Arduino) for detailed information 136 | * [ssd1306_sample_u8g](ssd1306_sample_u8g) - sample code for ssd1306 based oled display. see [wiki](http://github.com/jandelgado/arduino/wiki/SSD1306-based-OLED-connected-to-Arduino) for detailed information 137 | 138 | 139 | ### Colorduino RGB matrix driver 140 | 141 | Driver for 8x8 RGB LED matrix. 142 | 143 | Colorduino 144 | 145 | * see [wiki](https://github.com/jandelgado/arduino/wiki/Colorduino) for detailed information 146 | 147 | 148 | ### CJMCU-8x8 RGB matix 149 | 150 | An 8x8 LED RGB matrix based on WS2812 "NeoPixels". 151 | 152 | CJMCU-8*8 153 | 154 | * see [README of example sketch](cjmcu_8x8_sample/README.md) for detailed info 155 | rmation. 156 | 157 | ### WEMOS D-Duino 158 | 159 | The Wemos D-Duino is an ESP8266 board with an integrated SSD1306 OLED display 160 | connected via I2C. 161 | 162 | wemos-d-duino 163 | 164 | * SSD1306 is connected with I2C and SCL connected to D2 and SDA connected 165 | to D1. 166 | * see [example sketch](wemos_d_duino) for an example on how to use it with 167 | the u8g2 library. 168 | 169 | ### ESP32 TTGO 170 | 171 | The ESP32 TTGO is an EPS32 with an integrated SSD1306 OLED display connected 172 | via I2C. The board also has a 18650 battery holder on the back, and and on-off 173 | switch. 174 | 175 |

176 | esp32-ttgo 177 | esp32-ttgo-back 178 |

179 | 180 | * SSD1306 is connected with I2C and SCL connected to GPIO4 and SDA connected 181 | to GPIO5. 182 | * the builtin blue LED is connected to GPIO 16 183 | * see [example sketch](esp32_ttgo) for an example on how to use it with 184 | the u8g2 library. 185 | 186 | ### Heltec WiFi Lora 32 187 | 188 | The Heltec Wifi Lora 32 is an ESP32 board with a builtin OLED display and LORA 189 | transceiver. 190 | 191 | heltec-wifi-lora-32 192 | 193 | * the builtin LED is connected to `GPIO 25` (e.g. use `digitalWrite(25, 255)`) 194 | * OLED: u8glib configuration `U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16);` 195 | * see [example sketch](heltec_wifi_lora32) for an example on how to use the OLED 196 | * TODO will add Lora example later ... 197 | 198 | ### Raspberry Pi 480x320 SPI TFT Display (3.5 inches) 199 | 200 |

201 | RPi SPI display 480x320 202 | RPi SPI display 480x320 demo 203 |

204 | 205 | The display is labeled with `RPi Display 480x320 Pixel XPT246 Touch Controller` 206 | and uses an `ILI9486` controller. In raspian (tested with `2018-11-13 Raspian`). 207 | no additional drivers are needed. I got it running with the following configuration: 208 | 209 | Add to `/boot/config.txt`: 210 | ``` 211 | dtparam=spi=on 212 | dtoverlay=piscreen,speed=16000000,rotate=270,fps=20 213 | ``` 214 | 215 | (note that the 20 fps are not reached), After reboot, check with `dmesg` that 216 | the driver was loaded (framebuffer and touchscreen): 217 | 218 | ``` 219 | 12.814215] ads7846 spi0.1: touchscreen, irq 169 220 | [ 12.815503] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input0 221 | [ 12.839795] fbtft: module is from the staging directory, the quality is unknown, you have been warned. 222 | [ 12.852267] fb_ili9486: module is from the staging directory, the quality is unknown, you have been warned. 223 | [ 12.853073] fbtft_of_value: regwidth = 16 224 | [ 12.853083] fbtft_of_value: buswidth = 8 225 | [ 12.853092] fbtft_of_value: debug = 0 226 | [ 12.853098] fbtft_of_value: rotate = 90 227 | [ 12.853105] fbtft_of_value: fps = 20 228 | ... 229 | [ 13.613788] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 4 KiB buffer memory, fps=20, spi0.0 at 16 MHz 230 | ``` 231 | 232 | Test the display by loading an image using the `fbi` tool: 233 | ``` 234 | $ sudo fbi -noverbose -T 1 -a -d /dev/fb1 image-test.gif 235 | ``` 236 | 237 | (sudo is needed when command is run from ssh session). 238 | 239 | Start X11 on the framebuffer with `sudo FBDEV=/dev/fb1 startx`. 240 | 241 | #### Further info 242 | 243 | * http://ozzmaker.com/piscreen-driver-install-instructions-2/ 244 | * [Adafruit info on FPS and SPI speed](https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/help-faq#faq-11) 245 | * RPi case used: https://www.thingiverse.com/thing:1229473 246 | 247 | ### Sipeed Longan Nano RISC-V proto board (GD32VF103CBT6) 248 | 249 |

250 | sipeed nano 251 | sipeed nano 252 |

253 | 254 | The Sipeed Longan Nano GD32VF103CBT6 board hosts a 32-bit RISC-V cpu with 32KB 255 | of SRAM and 128KB of Flash and a 160x80 Pixel RGB LCD display. 256 | 257 | #### DFU mode 258 | 259 | To upload a firmware image to the MCU, it has to be put into DFU mode first: 260 | Press and hold `Boot` before connecting the board using USB. Alternatively when 261 | the board is already connected: Press and hold `boot` and then `reset` to put 262 | the board in DFU mode, otherwise no upload is possible. 263 | 264 | Check with `lsusb|grep GD32` if the board was successfully detected, the output 265 | should look like: 266 | 267 | ``` 268 | Bus 001 Device 007: ID 28e9:0189 GDMicroelectronics GD32 0x418 DFU Bootloader 269 | ``` 270 | 271 | Running `sudo dfu-util -l` yields: 272 | 273 | ``` 274 | dfu-util 0.9 275 | ... 276 | Found DFU: [28e9:0189] ver=1000, devnum=7, cfg=1, intf=0, path="1-2", alt=1, name="@Option Bytes /0x1FFFF800/01*016 g", serial="??" 277 | Found DFU: [28e9:0189] ver=1000, devnum=7, cfg=1, intf=0, path="1-2", alt=0, name="@Internal Flash /0x08000000/512*002Kg", serial="??" 278 | ``` 279 | 280 | #### Upload demo sketch 281 | 282 | 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 283 | `udevadm control --reload-rules && udevadm trigger` (as root) might be necessary. 284 | 285 | The [demo sketch](sipeed_longan_nano) can be compiled 286 | and uploaded with `make upload`, after the board was set to DFU mode. The 287 | following error seems to have no effect, and can be ignored: 288 | 289 | ``` 290 | dfu-util: dfuse_download: libusb_control_transfer returned -1 291 | *** [upload] Error 74 292 | ``` 293 | 294 | If the demo sketch works, you should now see the builtin LEDs cycle in colors 295 | red, green and blue. 296 | 297 | TODO 298 | 299 | - [ ] LCD demo w/ arduino framework 300 | - [ ] JLed demo 301 | 302 | ### Raspberry Pi HDMI LCD display (800x480, 4") 303 | 304 |

305 | rpi tft hdmi 306 | rpi tft hdmi 307 |

308 | 309 | The display is labelled "4inch HDMI LCD". The resolution is 800x480 and the 310 | display has a built in XPT2046 touch controller. 311 | 312 | I had to power both the Raspi (RPi 3) and the display to get it run. The display 313 | needs a custom resolution in `/boot/config.txt`, which is set by `hdmi_mode=87` 314 | and `hdmi_cvt`. 315 | 316 | Add to `/boot/config.txt`: 317 | 318 | ``` 319 | framebuffer_width=800 320 | framebuffer_height=480 321 | 322 | hdmi_group=2 323 | hdmi_mode=87 324 | hdmi_cvt=480 800 60 6 325 | display_hdmi_rotate=3 326 | ``` 327 | 328 | - [ ] Test the touch controller 329 | 330 | ### Raspberry Pi Pico (RP2040) 331 | 332 | 333 | 334 | The Raspberry Pi Pico is a cheap but powerful new (end of 2020) micro 335 | controller. It features a dual core Arm cortex M0+ processor running with up to 336 | 133Mhz, 264Kb SRAM and 2MB flash memory. It has no WiFi or Bluetooth. 337 | 338 | To flash the Pico, press the `BOOTSEL` button and attach the Pico using USB to 339 | your PC. The Pico will now act mass storage USB device. Simply copy the 340 | firmware (`uf2` extension) to the drive. The Pico will automatically disconnect 341 | and reboot. 342 | 343 | The Raspberry Pi Pico can be programmed in C/C++ or MicroPython. For C/C++ the 344 | [pico-sdk](https://github.com/raspberrypi/pico-sdk) and CMake must be used, 345 | which is not as easy to use as e.g. the Arduino IDE or platformio. To make 346 | things easier, I have created a [docker 347 | image](https://github.com/jandelgado/jled/blob/4.7.0/examples/raspi_pico/Dockerfile) 348 | and a [simple build script](https://github.com/jandelgado/jled/blob/4.7.0/examples/raspi_pico/build.sh). 349 | 350 | * [Look here for an example in my JLed library](https://github.com/jandelgado/jled/tree/4.7.0/examples/raspi_pico) 351 | * [official getting started guide](https://www.raspberrypi.org/documentation/pico/getting-started/) 352 | 353 | ### PCA9685 driver board 354 | 355 | The PCA9685 is an **I2C bus** controlled LED/Servo controller **with 16 356 | individually controllable PWM channels**. Each channel has a resolution of 12 357 | bits, resulting in 4096 steps. All channels operate at the same fixed 358 | frequency, which must be in the range between 24Hz and 1526Hz. 359 | 360 | The board operates at 3V to 5V, which is fed through the VCC pin. The V+ pin 361 | is optional and is used to power servos or LEDs with up to 6V. The V+ voltage 362 | can also be fed through the green terminal block and is routed to the red V+ 363 | pins. 364 | 365 | Each of the yellow PWM outputs on the board has a 220 Ohms resistor in series, 366 | which allows the direct connection of a LED. The output level is the same as 367 | VCC. 368 | 369 | SDA and SCL are the I2C data and clock pins. The OE pin is optional (and pulled 370 | down by default) and is used to quickly disable all outputs (by setting OE to 371 | high level). 372 | 373 | The I2C address is by default `0x40` and can be changed by closing the `A0` to 374 | `A5` pins using a soldering iron. 375 | 376 | 377 | 378 | There are many libraries for PCA9685 based boards out there, I successfully 379 | used the [Adafruit PWM Servo Driver 380 | library](https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library). 381 | Have a look at [this example here](pca9685). 382 | 383 | ### MP3 Modules 384 | 385 | I recently [built a Music Box for Kids](https://github.com/jandelgado/carl) and 386 | evaluated some MP3 modules to find the right one for the job (I finally ended 387 | up using the DFPlayer Mini). 388 | 389 | ![MP3 Modules](images/mp3_modules.jpg) 390 | 391 | | | WTV020M01 V1.00 | DFPlayer Mini | Catalex Serial MP3 Player V1.0 | VS1053 MP3 Shield (geeetech) | GPD2856A based | 392 | |------------------|------------------------------------|--------------------------------------------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------| 393 | | Dimensions (mm) | 22x17 | 20x20 | 40x23 | 55x55 | 45x35, 22x34 | 394 | | VCC | 3.3V | 3.2V-5V | 3.2V-5.2V | | 3.7V-5V | 395 | | Chip | ? | ? | YX5300 | VLSI VS1053B | GPOD2856A | 396 | | Media | Micro SD, 1 or 2GB, very picky | Micro SD up to 32GB | Micro SD up to GB | Micro SD | | 397 | | Filesystem | FAT16/32 | FAT16/32 | FAT16/32 | FAT16/32 | | 398 | | Max Files | 512 | 100*255 | ? | ? | ? | 399 | | Formats | AD4,NO MP3 | MP3, WAV | MP3, WAV | MP1, MP2, MP3, MP4, AAC, OGG, WAV and more | | 400 | | Frequency | 32kHz | 8-48kHz | 11-48kHz | | | 401 | | Amplifier | Yes | Yes | Line out only | | 2W Mono | 402 | | Buttons | Opt.: Play, Prev, Next, Vol+, Vol- | Optional | No | | Play, Prev, Next, Vol+, Vol- | 403 | | Serial Interface | 2 Line + CLK | UART 9600bps | UART 9600bps | | | 404 | | Microphone | No | No | No | Record in OGG, WAV | | 405 | | Misc | Busy signal, Reset input | Busy signal, Equalizer | | | | 406 | | Price (04/2021) | ca. 4€ | Starting at 1€ | ca. 2€ | ? | starting at 1€ | 407 | | Library | | [Link](https://github.com/DFRobot/DFRobotDFPlayerMini) | [Link](https://github.com/cefaloide/ArduinoSerialMP3Player) | [Link](https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library) | n/a | 408 | | Site | | | | | | 409 | | Comment | Better use DFPlayer Mini instead | Small, reliable w/ Amplifier | | Many features, good documentation | Standalone Player, w/ and wo/ buttons and terminals | 410 | 411 | Summary: 412 | * WTV020M01 is not recommended since not supporting MP3 format and very 413 | restrictive regarding SD cards used and audio encoding 414 | * The GPD2856A based boards are designed as stand alone players and are not 415 | meant to be controlled by a micro controller. 416 | * The DFPlayer Mini is a reliable board which can be controlled by a micro 417 | controller. It has an amplifier built in as well as an equalizer. 418 | * The VL1053 based shield supports many file formats and even recording of 419 | audio. It lacks an amplifier but is otherwise feature-packed. 420 | * The Catalex board is very simple to use and can be controlled by a micro 421 | controller. It lacks an amplifier and offers only a serial interface for 422 | control. 423 | 424 | Addiontial links: 425 | * DFPlayerMini: https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299 426 | * Catalex: http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf 427 | * GPD2856A: https://www.petervis.com/Electronics_Kits/gpd2856a/gpd2856a-mp3-decoder-board.html 428 | * WTV020M01: https://hackaday.io/project/3508-portable-trollmaster-3000/log/12391-the-joy-of-using-an-underdocumented-module-and-using-a-plan-b-at-the-last-minute 429 | * Geeetch VS1053: http://www.geeetech.com/wiki/index.php/Arduino_MP3_shield_board_with_TF_card 430 | * Profiles for the VS1053: http://www.vlsi.fi/en/support/software/vs10xxapplications.html 431 | 432 | #### VS1053 notes 433 | 434 | The module is also capable to record audio on the SD card in OGG Vorbis and WAV 435 | format. To encode the audio in OGG format, a plugin needs to be loaded from the 436 | SD card. The plugins are available [here at 437 | VLSI](http://www.vlsi.fi/fileadmin/software/VS10XX/vs1053-vorbis-encoder-170c.zip). 438 | Pick yours from the `profiles/` directory (files with `.img` extension). The 439 | name of the plugin is passed to the `prepareRecordingOgg` function. I had to 440 | change the name to conform to 8.3 naming (e.g. `v08k1q06.img`), otherwise the 441 | plugin did not load. Refer to the 442 | [documentation](http://www.vlsi.fi/fileadmin/software/VS10XX/VorbisEncoder170c.pdf) 443 | for more details. 444 | 445 | Libraries and examples: 446 | * https://github.com/adafruit/Adafruit_VS1053_Library 447 | * https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library 448 | 449 | ### Bosch BMP280 450 | 451 | bmp280 452 | 453 | The [Bosch 454 | BMP280](https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/) 455 | is an environmental sensor, capable of measuring temperature and barometric air 456 | Pressure. The sensor supports both I²C and SPI. There are many different 457 | boards available, mine is labeled `GY-BME/PM280` and costs about 1.60€ 458 | (02/2023). I successfully connected it using I²C and CircuitPython, running on 459 | an Raspberry Pi Pico W using the 460 | [adafruit_bmp280](https://github.com/adafruit/Adafruit_CircuitPython_BMP280) 461 | library (install on the Pico Pi with `circup adadfruit_bmp280`). 462 | 463 | In the example I connected the sensor as follows: 464 | 465 | | GY-BME/PM280 | Pico Pi Signal | Pin | 466 | |--------------|----------------|-----| 467 | | VCC | 3V3(OUT) | 36 | 468 | | GND | GND | 23 | 469 | | SCL | GP17/I2C0SCL | 22 | 470 | | SDA | GP16/I2C0SDA | 21 | 471 | 472 | Running an I²C bus scan in the CircuitPython REPL reveals that the device is 473 | has address 0x76 (118): 474 | 475 | ``` 476 | >>> import busio 477 | >>> import board 478 | >>> i2c = busio.I2C(board.GP1, board.GP0) 479 | >>> i2c.try_lock() 480 | True 481 | >>> i2c.scan() 482 | [118] 483 | ``` 484 | 485 | This is important, since the Adafruit library defaults to 119. Reading values 486 | from the sensor is straight forward: 487 | 488 | 489 | ```python 490 | # CircuitPython example 491 | import busio 492 | import board 493 | import adafruit_bmp280 494 | 495 | i2c = busio.I2C(board.GP17, board.GP16) 496 | sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, 118) 497 | 498 | print(sensor.temperature) 499 | print(sensor.pressure) 500 | ``` 501 | 502 | The first sensor I tried was broken. It was correctly detected during the bus 503 | scan, but delivered wrong measurements all the time. Luckily I had some more 504 | at hand to test wether it was a software or a hardware problem. 505 | 506 | ### TM1637 based Display 507 | 508 | bmp280 509 | 510 | This is a 4 digit 7-segment display using a TM1637 driver, which uses a data 511 | and a clock line for connection to the MCU. 512 | 513 | | Display(TM1637) | Pico Pi Signal | Pin | 514 | |-----------------|----------------------|-----| 515 | | CLK | GP14 | 19 | 516 | | DIO | GP15 | 20 | 517 | | VCC | 3V3(OUT) or VBUS(5V) | 36 | 518 | | GND | GND | 18 | 519 | 520 | ```python 521 | # CircuitPython example using https://github.com/bablokb/circuitpython-tm1637 522 | import board 523 | from TM1637 import TM1637 524 | 525 | display = TM1637(board.GP14,board.GP15) 526 | display.hex(0xcafe) 527 | display.scroll("hello world") 528 | display.temperature(23) 529 | ``` 530 | 531 | ### ESP32 board with 1.14" RGB ST7789V TFT display 532 | 533 |

534 | 535 | 536 | 537 |

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

588 | 589 |

590 | 591 | This board features the 592 | [ESP32-C3](https://www.espressif.com/en/products/socs/esp32-c3), which is based 593 | on a single core RISC-V CPU. This tiny board also hosts a 0.42" OLED display, 594 | connected by I²C through GPIO 5 (SDA) and GPIO 6 (SCL). The Display has a 595 | resolution of 72x40 pixels, and runs out of the box using the u8g2 library using 596 | the `U8G2_SH1106_72X40_WISE_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE)` 597 | constructor. The on-board LED is connected to GPIO 8 and low active. Look [here 598 | for a demo sketch](./esp32_c3_oled_0.42/esp32_c3_oled.ino). 599 | 600 | ## Misc 601 | 602 | ### WS2812 protection circuit 603 | 604 | I use this circuit when I connect WS2812 "neo pixels" to micro controllers (connected to `DATA` pin). 605 | 606 | 607 | 608 | ## Author 609 | 610 | (c) Copyright 2018-2021 by Jan Delgado. License: MIT 611 | 612 | --------------------------------------------------------------------------------