{"id":16623711,"url":"https://github.com/jandelgado/arduino","last_synced_at":"2025-04-10T02:29:03.839Z","repository":{"id":29415966,"uuid":"32951542","full_name":"jandelgado/arduino","owner":"jandelgado","description":"Arduino libraries and sketches and related stuff","archived":false,"fork":false,"pushed_at":"2025-02-11T19:22:41.000Z","size":29647,"stargazers_count":65,"open_issues_count":0,"forks_count":13,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-03T00:07:58.989Z","etag":null,"topics":["arduino","cjmcu","colorduino","esp32","esp8266","neopixel","oled-displays","ssd1306"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jandelgado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-26T20:57:55.000Z","updated_at":"2025-03-26T20:01:20.000Z","dependencies_parsed_at":"2025-01-06T12:37:58.783Z","dependency_job_id":null,"html_url":"https://github.com/jandelgado/arduino","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"286584041a44cb19fc3c8219e65aa17c5732ab1b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Farduino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Farduino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Farduino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jandelgado%2Farduino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jandelgado","download_url":"https://codeload.github.com/jandelgado/arduino/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143980,"owners_count":21054858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","cjmcu","colorduino","esp32","esp8266","neopixel","oled-displays","ssd1306"],"created_at":"2024-10-12T03:24:44.307Z","updated_at":"2025-04-10T02:29:03.805Z","avatar_url":"https://github.com/jandelgado.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Arduino\n\nNotes on Arduino libraries and sketches and other related stuff.\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n* [My Libraries and projects](#my-libraries-and-projects)\n  * [JLed](#jled)\n  * [log4arduino](#log4arduino)\n  * [eps32-aws-iot](#eps32-aws-iot)\n  * [USB Spinner Game Controller](#usb-spinner-game-controller)\n  * [Simpson Device (virtual Drinking Bird)](#simpson-device-virtual-drinking-bird)\n* [Sketches](#sketches)\n  * [Interfacing SSD1306 based OLED displays (SPI)](#interfacing-ssd1306-based-oled-displays-spi)\n  * [Colorduino RGB matrix driver](#colorduino-rgb-matrix-driver)\n  * [CJMCU-8x8 RGB matix](#cjmcu-8x8-rgb-matix)\n  * [WEMOS D-Duino](#wemos-d-duino)\n  * [ESP32 TTGO](#esp32-ttgo)\n  * [Heltec WiFi Lora 32](#heltec-wifi-lora-32)\n  * [Raspberry Pi 480x320 SPI TFT Display (3.5 inches)](#raspberry-pi-480x320-spi-tft-display-35-inches)\n    * [Further info](#further-info)\n  * [Sipeed Longan Nano RISC-V proto board (GD32VF103CBT6)](#sipeed-longan-nano-risc-v-proto-board-gd32vf103cbt6)\n    * [DFU mode](#dfu-mode)\n    * [Upload demo sketch](#upload-demo-sketch)\n  * [Raspberry Pi HDMI LCD display (800x480, 4\")](#raspberry-pi-hdmi-lcd-display-800x480-4)\n  * [Raspberry Pi Pico (RP2040)](#raspberry-pi-pico-rp2040)\n  * [PCA9685 driver board](#pca9685-driver-board)\n  * [MP3 Modules](#mp3-modules)\n    * [VS1053 notes](#vs1053-notes)\n  * [Bosch BMP280](#bosch-bmp280)\n  * [TM1637 based Display](#tm1637-based-display)\n  * [ESP32 board with 1.14\" RGB ST7789V TFT display](#esp32-board-with-114-rgb-st7789v-tft-display)\n  * [ESP32-C3 with 0.42\" I²C OLED display](#esp32-c3-with-042-ic-oled-display)\n* [Misc](#misc)\n  * [WS2812 protection circuit](#ws2812-protection-circuit)\n* [Author](#author)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## My Libraries and projects\n\n### JLed\n\nJLed is an Arduino library to control LEDs. It uses a non-blocking approach and\ncan control LEDs in simple (on/off) and complex (blinking, breathing) ways in a\ntime-driven manner. It's available as a C++ or Python lib.\n\n\u003cimg alt=\"jled\" width=256 src=\"images/jled.gif\"\u003e\n\n```c++\n// breathe LED (on gpio 9) 6 times for 1500ms, waiting for 500ms after each run\n#include \u003cjled.h\u003e\n\nauto led_breathe = JLed(9).Breathe(1500).Repeat(6).DelayAfter(500);\n\nvoid setup() { }\n\nvoid loop() {\n  led_breathe.Update();\n}\n```\n\nThe Python API mirrors the C++ API:\n\n```python\nimport board\nfrom jled import JLed\n\nled = JLed(board.LED).blink(500, 500).forever()\n\nwhile True:\n    led.update()\n```\n\n* https://github.com/jandelgado/jled\n* https://github.com/jandelgado/jled-circuitpython\n\n### log4arduino\n\nA lightweight, no-frills logging library for Arduino \u0026 friends.\n\n```c++\nLOG(\"hello, log4arduino.\");\ndelay(42);\nLOG(\"use %s formatting: %d %c %d %c %d\", \"printf\", 9, '+', 1, '=', 10);\n```\n\nAllows simple printf-like formatting and shows current time in millis and\navailable memory, e.g.\n\n```\n0(1623): hello, log4arduino.\n42(1609): use printf formatting: 9 + 1 = 10\n```\n\n* https://github.com/jandelgado/log4arduino\n\n### eps32-aws-iot\n\nCode, tools and instructions on how to connect ESP32 securely to the AWS IOT\ncloud.\n\n* https://github.com/jandelgado/esp32-aws-iot\n\n### USB Spinner Game Controller\n\nAn Arduino Pro Micro based USB spinner (like a paddle) game controller. Great\nto play games like e.g. Arkanoid. Simulates an USB mouse and needs no drivers.\n\n* https://github.com/jandelgado/usb-spinner\n\n### Simpson Device (virtual Drinking Bird)\n\nSimulates an USB mouse using an Attiny85 (Digispark board) and randomly moves\nyour mouse (see The Simpsons S07E07).\n\n* https://github.com/jandelgado/simpson-device\n\n## Sketches\n\nTo build the demo sketches you can either copy the folders to the source\nfolder of your Arduino IDE or use PlatformIO and the provided makefiles, e.g.:\n\n```\n$ cd cjmcu_8x8_sample\n$ make upload\n```\n\nThe following make targets can be used: run, envdump, clean, upload, monitor\n\n### Interfacing SSD1306 based OLED displays (SPI)\n\n\u003cimg alt=\"ssd1306\" width=256 src=\"images/ssd1306.jpg\"\u003e\n\n* [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\n* [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\n\n\n### Colorduino RGB matrix driver\n\nDriver for 8x8 RGB LED matrix.\n\n\u003cimg alt=\"Colorduino\" width=256 src=\"images/colorduino.JPG\"\u003e\n\n* see [wiki](https://github.com/jandelgado/arduino/wiki/Colorduino) for detailed information\n\n\n### CJMCU-8x8 RGB matix\n\nAn 8x8 LED RGB matrix based on WS2812 \"NeoPixels\".\n\n\u003cimg alt=\"CJMCU-8*8\" width=256 src=\"images/cjmcu-8x8/cjmcu.jpg\"\u003e\n\n* see [README of example sketch](cjmcu_8x8_sample/README.md) for detailed info\nrmation.\n\n### WEMOS D-Duino\n\nThe Wemos D-Duino is an ESP8266 board with an integrated SSD1306 OLED display\nconnected via I2C.\n\n\u003cimg alt=\"wemos-d-duino\" width=256 src=\"images/wemos-d-duino.png\"\u003e\n\n* SSD1306 is connected with I2C and SCL connected to D2 and SDA connected\n  to D1.\n* see [example sketch](wemos_d_duino) for an example on how to use it with\n  the u8g2 library.\n\n### ESP32 TTGO\n\nThe ESP32 TTGO is an EPS32 with an integrated SSD1306 OLED display connected\nvia I2C. The board also has a 18650 battery holder on the back, and and on-off\nswitch.\n\n\u003cp float=\"left\"\u003e\n  \u003cimg alt=\"esp32-ttgo\" width=256 src=\"images/esp32-ttgo.png\"\u003e\n  \u003cimg alt=\"esp32-ttgo-back\" width=256 src=\"images/esp32-ttgo-back.png\"\u003e\n\u003c/p\u003e\n\n* SSD1306 is connected with I2C and SCL connected to GPIO4 and SDA connected\n  to GPIO5.\n* the builtin blue LED is connected to GPIO 16\n* see [example sketch](esp32_ttgo) for an example on how to use it with\n  the u8g2 library.\n\n### Heltec WiFi Lora 32\n\nThe Heltec Wifi Lora 32 is an ESP32 board with a builtin OLED display and LORA\ntransceiver.\n\n\u003cimg alt=\"heltec-wifi-lora-32\" width=256 src=\"images/heltec.jpg\"\u003e\n\n* the builtin LED is connected to `GPIO 25` (e.g. use `digitalWrite(25, 255)`)\n* OLED: u8glib configuration `U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16);`\n* see [example sketch](heltec_wifi_lora32) for an example on how to use the OLED\n* TODO will add Lora example later ...\n\n### Raspberry Pi 480x320 SPI TFT Display (3.5 inches)\n\n\u003cp float=\"left\"\u003e\n  \u003cimg alt=\"RPi SPI display 480x320\" width=256 src=\"images/rpi_tft_35.jpg\"\u003e\n  \u003cimg alt=\"RPi SPI display 480x320 demo\" width=256 src=\"images/rpi_tft_35_demo.jpg\"\u003e\n\u003c/p\u003e\n\nThe display is labeled with `RPi Display 480x320 Pixel XPT246 Touch Controller`\nand uses an `ILI9486` controller. In raspian (tested with `2018-11-13 Raspian`).\nno additional drivers are needed. I got it running with the following configuration:\n\nAdd to `/boot/config.txt`:\n```\ndtparam=spi=on\ndtoverlay=piscreen,speed=16000000,rotate=270,fps=20\n```\n\n(note that the 20 fps are not reached), After reboot, check with `dmesg` that\nthe driver was loaded (framebuffer and touchscreen):\n\n```\n 12.814215] ads7846 spi0.1: touchscreen, irq 169\n[   12.815503] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input0\n[   12.839795] fbtft: module is from the staging directory, the quality is unknown, you have been warned.\n[   12.852267] fb_ili9486: module is from the staging directory, the quality is unknown, you have been warned.\n[   12.853073] fbtft_of_value: regwidth = 16\n[   12.853083] fbtft_of_value: buswidth = 8\n[   12.853092] fbtft_of_value: debug = 0\n[   12.853098] fbtft_of_value: rotate = 90\n[   12.853105] fbtft_of_value: fps = 20\n...\n[   13.613788] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 4 KiB buffer memory, fps=20, spi0.0 at 16 MHz\n```\n\nTest the display by loading an image using the `fbi` tool:\n```\n$ sudo fbi -noverbose -T 1 -a -d /dev/fb1 image-test.gif\n```\n\n(sudo is needed when command is run from ssh session).\n\nStart X11 on the framebuffer with `sudo FBDEV=/dev/fb1 startx`.\n\n#### Further info\n\n* http://ozzmaker.com/piscreen-driver-install-instructions-2/\n* [Adafruit info on FPS and SPI speed](https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/help-faq#faq-11)\n* RPi case used: https://www.thingiverse.com/thing:1229473\n\n### Sipeed Longan Nano RISC-V proto board (GD32VF103CBT6)\n\n\u003cp float=\"left\"\u003e\n  \u003cimg alt=\"sipeed nano\" width=256 src=\"images/sipeed_nano_1.jpg\"\u003e\n  \u003cimg alt=\"sipeed nano\" width=256 src=\"images/sipeed_nano_2.jpg\"\u003e\n\u003c/p\u003e\n\nThe Sipeed Longan Nano GD32VF103CBT6 board hosts a 32-bit RISC-V cpu with 32KB\nof SRAM and 128KB of Flash and a 160x80 Pixel RGB LCD display.\n\n#### DFU mode\n\nTo upload a firmware image to the MCU, it has to be put into DFU mode first:\nPress and hold `Boot` before connecting the board using USB. Alternatively when\nthe board is already connected: Press and hold `boot` and then `reset` to put\nthe board in DFU mode, otherwise no upload is possible.\n\nCheck with `lsusb|grep GD32` if the board was successfully detected, the output\nshould look like:\n\n```\nBus 001 Device 007: ID 28e9:0189 GDMicroelectronics GD32 0x418 DFU Bootloader\n```\n\nRunning `sudo dfu-util -l` yields:\n\n```\ndfu-util 0.9\n...\nFound DFU: [28e9:0189] ver=1000, devnum=7, cfg=1, intf=0, path=\"1-2\", alt=1, name=\"@Option Bytes  /0x1FFFF800/01*016 g\", serial=\"??\"\nFound DFU: [28e9:0189] ver=1000, devnum=7, cfg=1, intf=0, path=\"1-2\", alt=0, name=\"@Internal Flash  /0x08000000/512*002Kg\", serial=\"??\"\n```\n\n#### Upload demo sketch\n\nBefore 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\n`udevadm control --reload-rules \u0026\u0026 udevadm trigger` (as root) might be necessary.\n\nThe [demo sketch](sipeed_longan_nano) can be compiled\nand uploaded with `make upload`, after the board was set to DFU mode. The\nfollowing error seems to have no effect, and can be ignored:\n\n```\ndfu-util: dfuse_download: libusb_control_transfer returned -1\n*** [upload] Error 74\n```\n\nIf the demo sketch works, you should now see the builtin LEDs cycle in colors\nred, green and blue.\n\nTODO\n\n- [ ] LCD demo w/ arduino framework\n- [ ] JLed demo\n\n### Raspberry Pi HDMI LCD display (800x480, 4\")\n\n\u003cp float=\"left\"\u003e\n  \u003cimg alt=\"rpi tft hdmi\" width=256 src=\"images/rpi_tft_hdmi_1.jpg\"\u003e\n  \u003cimg alt=\"rpi tft hdmi\" width=256 src=\"images/rpi_tft_hdmi_2.jpg\"\u003e\n\u003c/p\u003e\n\nThe display is labelled \"4inch HDMI LCD\". The resolution is 800x480 and the\ndisplay has a built in XPT2046 touch controller.\n\nI had to power both the Raspi (RPi 3) and the display to get it run. The display\nneeds a custom resolution in `/boot/config.txt`, which is set by  `hdmi_mode=87`\nand `hdmi_cvt`.\n\nAdd to `/boot/config.txt`:\n\n```\nframebuffer_width=800\nframebuffer_height=480\n\nhdmi_group=2\nhdmi_mode=87\nhdmi_cvt=480 800 60 6\ndisplay_hdmi_rotate=3\n```\n\n- [ ] Test the touch controller\n\n### Raspberry Pi Pico (RP2040)\n\n\u003cimg src=\"images/pico.jpg\" width=500\u003e\n\nThe Raspberry Pi Pico is a cheap but powerful new (end of 2020) micro\ncontroller. It features a dual core Arm cortex M0+ processor running with up to\n133Mhz, 264Kb SRAM and 2MB flash memory. It has no WiFi or Bluetooth.\n\nTo flash the Pico, press the `BOOTSEL` button and attach the Pico using USB to\nyour PC. The Pico will now act mass storage USB device. Simply copy the\nfirmware (`uf2` extension) to the drive. The Pico will automatically disconnect\nand reboot.\n\nThe Raspberry Pi Pico can be programmed in C/C++ or MicroPython. For C/C++ the\n[pico-sdk](https://github.com/raspberrypi/pico-sdk) and CMake must be used,\nwhich is not as easy to use as e.g. the Arduino IDE or platformio. To make\nthings easier, I have created a [docker\nimage](https://github.com/jandelgado/jled/blob/4.7.0/examples/raspi_pico/Dockerfile)\nand a [simple build script](https://github.com/jandelgado/jled/blob/4.7.0/examples/raspi_pico/build.sh).\n\n* [Look here for an example in my JLed library](https://github.com/jandelgado/jled/tree/4.7.0/examples/raspi_pico)\n* [official getting started guide](https://www.raspberrypi.org/documentation/pico/getting-started/)\n\n### PCA9685 driver board\n\nThe PCA9685 is an **I2C bus** controlled LED/Servo controller **with 16\nindividually controllable PWM channels**. Each channel has a resolution of 12\nbits, resulting in 4096 steps. All channels operate at the same fixed\nfrequency, which must be in the range between 24Hz and 1526Hz.\n\nThe board operates at 3V to 5V, which is fed through the VCC pin. The V+ pin\nis optional and is used to power servos or LEDs with up to 6V. The V+ voltage\ncan also be fed through the green terminal block and is routed to the red V+\npins.\n\nEach of the yellow PWM outputs on the board has a 220 Ohms resistor in series,\nwhich allows the direct connection of a LED. The output level is the same as\nVCC.\n\nSDA and SCL are the I2C data and clock pins. The OE pin is optional (and pulled\ndown by default) and is used to quickly disable all outputs (by setting OE to\nhigh level).\n\nThe I2C address is by default `0x40` and can be changed by closing the `A0` to\n`A5` pins using a soldering iron.\n\n\u003cimg src=\"images/pca9685.png\" width=400\u003e\n\nThere are many libraries for PCA9685 based boards out there, I successfully\nused the [Adafruit PWM Servo Driver\nlibrary](https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library).\nHave a look at [this example here](pca9685).\n\n### MP3 Modules\n\nI recently [built a Music Box for Kids](https://github.com/jandelgado/carl) and\nevaluated some MP3 modules to find the right one for the job (I finally ended\nup using the DFPlayer Mini).\n\n![MP3 Modules](images/mp3_modules.jpg)\n\n|                  | WTV020M01 V1.00                    | DFPlayer Mini                                          | Catalex Serial MP3 Player V1.0                              | VS1053 MP3 Shield (geeetech)                                                     | GPD2856A based                                      |\n|------------------|------------------------------------|--------------------------------------------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------|\n| Dimensions (mm)  | 22x17                              | 20x20                                                  | 40x23                                                       | 55x55                                                                            | 45x35, 22x34                                        |\n| VCC              | 3.3V                               | 3.2V-5V                                                | 3.2V-5.2V                                                   |                                                                                  | 3.7V-5V                                             |\n| Chip             | ?                                  | ?                                                      | YX5300                                                      | VLSI VS1053B                                                                     | GPOD2856A                                           |\n| Media            | Micro SD, 1 or 2GB, very picky     | Micro SD up to 32GB                                    | Micro SD up to GB                                           | Micro SD                                                                         |                                                     |\n| Filesystem       | FAT16/32                           | FAT16/32                                               | FAT16/32                                                    | FAT16/32                                                                         |                                                     |\n| Max Files        | 512                                | 100*255                                                | ?                                                           | ?                                                                                | ?                                                   |\n| Formats          | AD4,NO MP3                         | MP3, WAV                                               | MP3, WAV                                                    | MP1, MP2, MP3, MP4, AAC, OGG, WAV and more                                       |                                                     |\n| Frequency        | 32kHz                              | 8-48kHz                                                | 11-48kHz                                                    |                                                                                  |                                                     |\n| Amplifier        | Yes                                | Yes                                                    | Line out only                                               |                                                                                  | 2W Mono                                             |\n| Buttons          | Opt.: Play, Prev, Next, Vol+, Vol- | Optional                                               | No                                                          |                                                                                  | Play,  Prev, Next, Vol+, Vol-                       |\n| Serial Interface | 2 Line + CLK                       | UART 9600bps                                           | UART 9600bps                                                |                                                                                  |                                                     |\n| Microphone       | No                                 | No                                                     | No                                                          | Record in OGG, WAV                                                               |                                                     |\n| Misc             | Busy signal, Reset input           | Busy signal, Equalizer                                 |                                                             |                                                                                  |                                                     |\n| Price (04/2021)  | ca. 4€                             | Starting at 1€                                         | ca. 2€                                                      | ?                                                                                | starting at 1€                                      |\n| 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                                                 |\n| Site             |                                    |                                                        |                                                             |                                                                                  |                                                     |\n| Comment          | Better use DFPlayer Mini instead   | Small, reliable w/ Amplifier                           |                                                             | Many features, good documentation                                                | Standalone Player, w/ and wo/ buttons and terminals |\n\nSummary:\n* WTV020M01 is not recommended since not supporting MP3 format and very\n  restrictive regarding SD cards used and audio encoding\n* The GPD2856A based boards are designed as stand alone players and are not\n  meant to be controlled by a micro controller.\n* The DFPlayer Mini is a reliable board which can be controlled by a micro\n  controller. It has an amplifier built in as well as an equalizer.\n* The VL1053 based shield supports many file formats and even recording of\n  audio. It lacks an amplifier but is otherwise feature-packed.\n* The Catalex board is very simple to use and can be controlled by a micro\n  controller. It lacks an amplifier and offers only a serial interface for\n  control.\n\nAddiontial links:\n* DFPlayerMini: https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299\n* Catalex: http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf\n* GPD2856A: https://www.petervis.com/Electronics_Kits/gpd2856a/gpd2856a-mp3-decoder-board.html\n* 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\n* Geeetch VS1053: http://www.geeetech.com/wiki/index.php/Arduino_MP3_shield_board_with_TF_card\n    * Profiles for the VS1053: http://www.vlsi.fi/en/support/software/vs10xxapplications.html\n\n#### VS1053 notes\n\nThe module is also capable to record audio on the SD card in OGG Vorbis and WAV\nformat. To encode the audio in OGG format, a plugin needs to be loaded from the\nSD card. The plugins are available [here at\nVLSI](http://www.vlsi.fi/fileadmin/software/VS10XX/vs1053-vorbis-encoder-170c.zip).\nPick yours from the `profiles/` directory (files with `.img` extension). The\nname of the plugin is passed to the `prepareRecordingOgg` function. I had to\nchange the name to conform to 8.3 naming (e.g. `v08k1q06.img`), otherwise the\nplugin did not load.  Refer to the\n[documentation](http://www.vlsi.fi/fileadmin/software/VS10XX/VorbisEncoder170c.pdf)\nfor more details.\n\nLibraries and examples:\n* https://github.com/adafruit/Adafruit_VS1053_Library\n* https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library\n\n### Bosch BMP280\n\n\u003cimg src=\"images/bmp280.png\" width=\"500\" alt=\"bmp280\"\u003e\n\nThe [Bosch\nBMP280](https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/)\nis an environmental sensor, capable of measuring temperature and barometric air\nPressure. The sensor supports both I²C and SPI.  There are many different\nboards available, mine is labeled `GY-BME/PM280` and costs about 1.60€\n(02/2023). I successfully connected it using I²C and CircuitPython, running on\nan Raspberry Pi Pico W using the\n[adafruit_bmp280](https://github.com/adafruit/Adafruit_CircuitPython_BMP280)\nlibrary (install on the Pico Pi with `circup adadfruit_bmp280`).\n\nIn the example I connected the sensor as follows:\n\n| GY-BME/PM280 | Pico Pi Signal | Pin |\n|--------------|----------------|-----|\n| VCC          | 3V3(OUT)       | 36  |\n| GND          | GND            | 23  |\n| SCL          | GP17/I2C0SCL   | 22  |\n| SDA          | GP16/I2C0SDA   | 21  |\n\nRunning an I²C bus scan in the CircuitPython REPL reveals that the device is\nhas address 0x76 (118):\n\n```\n\u003e\u003e\u003e import busio\n\u003e\u003e\u003e import board\n\u003e\u003e\u003e i2c = busio.I2C(board.GP1, board.GP0)\n\u003e\u003e\u003e i2c.try_lock()\nTrue\n\u003e\u003e\u003e i2c.scan()\n[118]\n```\n\nThis is important, since the Adafruit library defaults to 119. Reading values\nfrom the sensor is straight forward:\n\n\n```python\n# CircuitPython example\nimport busio\nimport board\nimport adafruit_bmp280\n\ni2c = busio.I2C(board.GP17, board.GP16)\nsensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, 118)\n\nprint(sensor.temperature)\nprint(sensor.pressure)\n```\n\nThe first sensor I tried was broken. It was correctly detected during the bus\nscan, but delivered wrong measurements all the time. Luckily I had some more\nat hand to test wether it was a software or a hardware problem.\n\n### TM1637 based Display\n\n\u003cimg src=\"images/TM1637.png\" width=\"500\" alt=\"bmp280\"\u003e\n\nThis is a 4 digit 7-segment display using a TM1637 driver, which uses a data\nand a clock line for connection to the MCU.\n\n| Display(TM1637) | Pico Pi Signal       | Pin |\n|-----------------|----------------------|-----|\n| CLK             | GP14                 | 19  |\n| DIO             | GP15                 | 20  |\n| VCC             | 3V3(OUT) or VBUS(5V) | 36  |\n| GND             | GND                  | 18  |\n\n```python\n# CircuitPython example using https://github.com/bablokb/circuitpython-tm1637\nimport board\nfrom TM1637 import TM1637\n\ndisplay = TM1637(board.GP14,board.GP15)\ndisplay.hex(0xcafe)\ndisplay.scroll(\"hello world\")\ndisplay.temperature(23)\n```\n\n### ESP32 board with 1.14\" RGB ST7789V TFT display\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/esp32_st7789v_3.jpg\" height=200\u003e\n  \u003cimg src=\"images/esp32_st7789v_1.jpg\" height=200\u003e\n  \u003cimg src=\"images/esp32_st7789v_2.jpg\" height=200\u003e\n\u003c/p\u003e\n\nThis module was sold on aliexpress in different variations as\n_T-Display T-PicoC3 ESP32 S3 1,9 Zoll WiFi und Bluetooth-kompatibles Modul\nESP32 C3 Entwicklungsboard 1,14 Zoll LCD für Arduino_. I ordered the ESP32-S3\nversion, but the one I got had an ESP32-D0WDQD6 and not an ESP32-S3, as\nadvertised. According to the specs, the display is a 1.14\" RGB TFT display with\nan ST7789V controller, connected through SPI and wired as follows:\n\n| Signal        | Pin |\n|-------------  |-----|\n| `MOSI`        | 19  |\n| `SCLK`        | 18  |\n| `CS`          | 5   |\n| `DC`          | 16  |\n| `RST`         | 23  |\n| `BL`          | 4   |\n\nI tested 2 different libraries to control the TFT:\n\n1. [deirvlon/ST7789v-Arduino](https://github.com/deirvlon/ST7789v-Arduino):\n   while I had initially success in getting displayed at least anything,\n   further inspection of the [code](https://github.com/deirvlon/ST7789v-Arduino/blob/main/ST7789v_arduino.cpp#L545)\n   revealed, that the lib is hardwired to a  resoultion of 240x320 pixels, resulting\n   in a wrong geometry of displayed graphics\n2. [adafruit/Adafruit ST7735 and ST7789 Library](https://github.com/adafruit/Adafruit-ST7735-Library):\n   this lib worked, and I have adapted one of the original [demos here](esp32_st7789v/test.ino),\n   with the proper configuration\n\nI eventually found out, that `BL` stands for `BACKLIGHT` and that the backlight\nmust be turned on for obvious reasons.For that, I added the following code:\n\n```c++\n...\n#define BL 4\n...\n\nvoid setup() {\n  ...\n  // turn the backlight on\n  pinMode(BL, OUTPUT);\n  digitalWrite(BL, 1);\n  ...\n}\n```\n\nSee this [sketch](esp32_st7789v/test.ino) for a working example.\n\n### ESP32-C3 with 0.42\" I²C OLED display\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/esp32_c3_oled.jpg\" height=200\u003e\n\u003c/p\u003e\n\nThis board features the\n[ESP32-C3](https://www.espressif.com/en/products/socs/esp32-c3), which is based\non a single core RISC-V CPU. This tiny board also hosts a 0.42\" OLED display,\nconnected by I²C through GPIO 5 (SDA) and GPIO 6 (SCL). The Display has a\nresolution of 72x40 pixels, and runs out of the box using the u8g2 library using\nthe `U8G2_SH1106_72X40_WISE_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE)`\nconstructor. The on-board LED is connected to GPIO 8 and low active. Look [here\nfor a demo sketch](./esp32_c3_oled_0.42/esp32_c3_oled.ino).\n\n## Misc\n\n### WS2812 protection circuit\n\nI use this circuit when I connect WS2812 \"neo pixels\" to micro controllers (connected to `DATA` pin).\n\n\u003cimg src=\"images/WS2812_protection.jpg\" width=600\u003e\n\n## Author\n\n(c) Copyright 2018-2021 by Jan Delgado. License: MIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjandelgado%2Farduino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjandelgado%2Farduino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjandelgado%2Farduino/lists"}