SenseCAP Indicator: Difference between revisions
Brian Wilson (talk | contribs) Created page with "== SenseCAP Indicator == https://www.seeedstudio.com/SenseCAP-Indicator-D1-p-5643.html This is a 4" LCD (480x480) with a RPi Pico and an ESP3-2S3. I want to use it in my car as a scangauge "work-alike". OBD-II CAN bus I had a Garmin EcoRoute for a few years but it no longer works. I miss the gauge displays, especially for engine temperature. I want to try to calculate MPG. I would normally expect a product like this to be Android/Debian/Ubuntu but this is lower lev..." |
Brian Wilson (talk | contribs) m →LVGL |
||
(32 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== SenseCAP Indicator == | == SenseCAP Indicator== | ||
https:// | [https://wiki.seeedstudio.com/Sensor/SenseCAP/SenseCAP_Indicator/Get_started_with_SenseCAP_Indicator/ Getting Started guide] | ||
This is a 4" LCD (480x480) with a RPi Pico and an ESP3-2S3. | This is a 4" LCD (480x480) with a RPi Pico and an ESP3-2S3. | ||
I want to use it in my car as a scangauge "work-alike". OBD-II CAN bus | I want to use it in my car as a [https://scangauge.com Scangauge] "work-alike". OBD-II CAN bus, I had a Garmin EcoRoute for a few years but it no longer works. I miss the gauge displays, especially for engine temperature. I want to try to calculate real-time MPG. | ||
I | I would normally expect a product like the D1 to be Android/Debian/Ubuntu but this is lower level, that intrigues me. I want to know the architecture and how to program it. | ||
I want to try to | Getting started: https://wiki.seeedstudio.com/SenseCAP_Indicator_Get_Started/ | ||
PDF user manual https://files.seeedstudio.com/products/SenseCAP/SenseCAP_Indicator/SenseCAP%20Indicator%20User%20Manual_2023.4.21.pdf | |||
There are two USB-C ports and an internal USB hub. Both processors are attached to the USB hub, the ESP32 has a USB->UART interface. | |||
=== Review with internal photos https://www.cnx-software.com/2023/05/27/sensecap-indicator-d1pro-review-an-esp32-s3-rp2040-iot-devkit-with-a-4-inch-display-lora-connectivity-sensors/ === | |||
=== ESP32-S3 === | |||
The ESP32 manages wireless (WiFi, BT 5 and LoRa) and the LCD/touch panel. My basic D1 does not include LoRa chip. | |||
Looks like SEEED modeled the ESP portion of the D1 on this Espressif reference design. [https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/index.html ESP32-S3 LCD EV Board] It uses a 480x480 display but does not have the audio portion implemented. The ESP board has a screen connector, the 480x480 board uses a GC9503CV display driver and a FT5x06 touch interface. The system diagram shows the LCD controller as a "RGB565". I think that's a description of the pixel color depth? R=5 bits, G=6 bits, B=5 bits. 16 bits. I feel like I am back at the Magicsoft / Unison World days! Or perhaps the AT&T Truevision ICB board that I paid a fortune for. | |||
===RP2040 === | |||
RP2040 has 2 Grove interfaces, one for I2C and one for analog. | |||
Grove 1 = GPIO20 (SDA), GPIO21 (SCL) It's on an I2C bus with the sensor chips, but we don't have any sensor chips in this model | |||
Grove 2 = GPIO26 = ADC0, GPIO27 = ADC1 | |||
It supports up to a 32GB SD card. | |||
It has the speaker too on GPIO19. | |||
Can I reprogram the RP2040 to support UART mode on the Grove connectors? I want to connect a CAN BUS and a GPS. (Today anyway) | |||
==Programming== | |||
Espressif is used to program the ESP32. | |||
They suggest Arduino for the RP2040 but I plan to try CircuitPython.[[File:SenseCAP Indicator.png|thumb|System diagram]] | |||
===Interprocessor communications=== | |||
The ESP32 and RP2040 talk over a serial port using "COBS" = [http://www.stuartcheshire.org/papers/COBSforToN.pdf <nowiki> "Consistent Overhead Byte Stuffing"], which I am hoping just works. I don't want to read about it. | |||
COBS is just a convenient way to move bytes without worrying about punctuation. More or less. Anyway. It's a low level element like PHY | |||
not a useful application level protocol like MQTT. | |||
I found this project for Python, https://pypi.org/project/cobs/ | |||
Might work with Circuit Python? | |||
===Programming the RP2040=== | |||
Refer to this page: [[Raspberry Pi RP2040]] | |||
==== What can I do with the RP2040? ==== | |||
Well, right off the bat, not much. But I want to try, so I note the buzzer is on port GPIO19. What do I need to get that working? I think I program it as a PWM output and see what happens. Ha ha ha supposedly I can play MP3 files on there? Seriously? Such a world. https://learn.adafruit.com/mp3-playback-rp2040/pico-mp3 | |||
I tried the sample and it kind of works. Sound came out. It's not like a Nakamichi Dragon Cassette Deck. When I tried a piano sample it locked up and I had to wipe and restore it. Go look at the RP2040 mentioned above. I won't play MP3 files through it ever again. | |||
==== Zephyr RTOS on the RP2040 ==== | |||
THERE IS NO LED TO BLINK! So GPIO19 + PWM = buzzzzzzz, | |||
I need to add the board to Zephyr, so that happens in source code, which I have checked out on Pearl. | |||
====Programming the ESP32-S3==== | |||
The "normal" approach using Espressif uses FreeRTOS. | |||
LCD -- The [https://wiki.seeedstudio.com/SenseCAP_Indicator_How_to_Create_your_own_UI/ example that Seeed provides] uses [https://docs.lvgl.io/master/intro/index.html LVGL] graphics library and (optionally) [https://docs.squareline.io/docs/squareline Squareline Studio] to design the UI. Squareline supports C/C++ and Micropython. Squareline appears to be built on [https://libsdl.org/ SDL], "Simple Directmedia Library". In github, https://github.com/libsdl-org | |||
==== Micropython on the ESP32-S3 ==== | |||
Refer to the generic description, https://micropython.org/download/ESP32_GENERIC_S3/ | |||
Use esptool.py to wipe flash and then load mpython. | |||
cd ~/Documents/source/esptool/ | |||
conda activate esphome | |||
On my computer I see two ports in Device Manager, one is marked as "USB-SERIAL CH340 - Com7" and I think that's the ESP32. The other is marked "USB Serial Device Com8", probably the RP2040 (currently with CircuitPython loaded.) I tried using things like "--port com7" and "--port com7:" but it failed. I dropped the option and let the script find the port on its own. For some reason after erasing the flash it showed up on port COM3 instead of COM7, ah the vagaries of serial port drivers! | |||
<code>python esptool.py --chip esp32s3 erase_flash</code> | |||
At this point, my D1 screen has gone dark, which is probably what I want. :-) | |||
Loading the binary looked like this. | |||
<pre> | |||
python esptool.py --chip esp32s3 write_flash -z 0 GENERIC_S3-20230426-v1.20.0.bin | |||
esptool.py v4.1-dev | |||
Found 2 serial ports | |||
Serial port COM8 | |||
Connecting...................................... | |||
COM8 failed to connect: Failed to connect to ESP32-S3: No serial data received. | |||
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html | |||
Serial port COM3 | |||
Connecting... | |||
Chip is ESP32-S3 | |||
Features: WiFi, BLE | |||
Crystal is 40MHz | |||
MAC: dc:54:75:d8:08:d0 | |||
Uploading stub... | |||
Running stub... | |||
Stub running... | |||
Configuring flash size... | |||
Flash will be erased from 0x00000000 to 0x00160fff... | |||
Compressed 1443040 bytes to 955816... | |||
Wrote 1443040 bytes (955816 compressed) at 0x00000000 in 84.3 seconds (effective 136.9 kbit/s)... | |||
Hash of data verified. | |||
</pre>I connected using Putty to COM3, and I can see the REPL. Now finally it's [[Micropython]] time. | |||
=== LVGL=== | |||
See my [[LVGL]] page. | |||
[https://docs.lvgl.io/8.3/index.html Docs page for LVGL] | |||
I did a simple UI design for a CanBus monitor in SquareLine Studio. Next I want to test it in an LVGL simulator. | |||
I am thinking I can install the simulator on [[Bellman]] and work with VSCode in remote shell mode. Except at the moment I am a few hundred miles away from Bellman. Might still be okay. | |||
Then I want to get the LVGL module added to MicroPython. Unless I switch to running [[Zephyr]] on the ESP32? Or programming it in C anyway. This is looking like a good option, [https://www.zephyrproject.org/?s=lvgl support seems to be there]. | |||
Then I want to test the UI in the D1. | |||
[[Category: IoT]] | |||
[[Category: Electronics]] |
Latest revision as of 00:55, 30 October 2024
SenseCAP Indicator
This is a 4" LCD (480x480) with a RPi Pico and an ESP3-2S3.
I want to use it in my car as a Scangauge "work-alike". OBD-II CAN bus, I had a Garmin EcoRoute for a few years but it no longer works. I miss the gauge displays, especially for engine temperature. I want to try to calculate real-time MPG.
I would normally expect a product like the D1 to be Android/Debian/Ubuntu but this is lower level, that intrigues me. I want to know the architecture and how to program it.
Getting started: https://wiki.seeedstudio.com/SenseCAP_Indicator_Get_Started/
PDF user manual https://files.seeedstudio.com/products/SenseCAP/SenseCAP_Indicator/SenseCAP%20Indicator%20User%20Manual_2023.4.21.pdf
There are two USB-C ports and an internal USB hub. Both processors are attached to the USB hub, the ESP32 has a USB->UART interface.
Review with internal photos https://www.cnx-software.com/2023/05/27/sensecap-indicator-d1pro-review-an-esp32-s3-rp2040-iot-devkit-with-a-4-inch-display-lora-connectivity-sensors/
ESP32-S3
The ESP32 manages wireless (WiFi, BT 5 and LoRa) and the LCD/touch panel. My basic D1 does not include LoRa chip.
Looks like SEEED modeled the ESP portion of the D1 on this Espressif reference design. ESP32-S3 LCD EV Board It uses a 480x480 display but does not have the audio portion implemented. The ESP board has a screen connector, the 480x480 board uses a GC9503CV display driver and a FT5x06 touch interface. The system diagram shows the LCD controller as a "RGB565". I think that's a description of the pixel color depth? R=5 bits, G=6 bits, B=5 bits. 16 bits. I feel like I am back at the Magicsoft / Unison World days! Or perhaps the AT&T Truevision ICB board that I paid a fortune for.
RP2040
RP2040 has 2 Grove interfaces, one for I2C and one for analog.
Grove 1 = GPIO20 (SDA), GPIO21 (SCL) It's on an I2C bus with the sensor chips, but we don't have any sensor chips in this model
Grove 2 = GPIO26 = ADC0, GPIO27 = ADC1
It supports up to a 32GB SD card.
It has the speaker too on GPIO19.
Can I reprogram the RP2040 to support UART mode on the Grove connectors? I want to connect a CAN BUS and a GPS. (Today anyway)
Programming
Espressif is used to program the ESP32.
They suggest Arduino for the RP2040 but I plan to try CircuitPython.
Interprocessor communications
The ESP32 and RP2040 talk over a serial port using "COBS" = <nowiki> "Consistent Overhead Byte Stuffing", which I am hoping just works. I don't want to read about it.
COBS is just a convenient way to move bytes without worrying about punctuation. More or less. Anyway. It's a low level element like PHY not a useful application level protocol like MQTT.
I found this project for Python, https://pypi.org/project/cobs/ Might work with Circuit Python?
Programming the RP2040
Refer to this page: Raspberry Pi RP2040
What can I do with the RP2040?
Well, right off the bat, not much. But I want to try, so I note the buzzer is on port GPIO19. What do I need to get that working? I think I program it as a PWM output and see what happens. Ha ha ha supposedly I can play MP3 files on there? Seriously? Such a world. https://learn.adafruit.com/mp3-playback-rp2040/pico-mp3
I tried the sample and it kind of works. Sound came out. It's not like a Nakamichi Dragon Cassette Deck. When I tried a piano sample it locked up and I had to wipe and restore it. Go look at the RP2040 mentioned above. I won't play MP3 files through it ever again.
Zephyr RTOS on the RP2040
THERE IS NO LED TO BLINK! So GPIO19 + PWM = buzzzzzzz,
I need to add the board to Zephyr, so that happens in source code, which I have checked out on Pearl.
Programming the ESP32-S3
The "normal" approach using Espressif uses FreeRTOS.
LCD -- The example that Seeed provides uses LVGL graphics library and (optionally) Squareline Studio to design the UI. Squareline supports C/C++ and Micropython. Squareline appears to be built on SDL, "Simple Directmedia Library". In github, https://github.com/libsdl-org
Micropython on the ESP32-S3
Refer to the generic description, https://micropython.org/download/ESP32_GENERIC_S3/
Use esptool.py to wipe flash and then load mpython.
cd ~/Documents/source/esptool/ conda activate esphome
On my computer I see two ports in Device Manager, one is marked as "USB-SERIAL CH340 - Com7" and I think that's the ESP32. The other is marked "USB Serial Device Com8", probably the RP2040 (currently with CircuitPython loaded.) I tried using things like "--port com7" and "--port com7:" but it failed. I dropped the option and let the script find the port on its own. For some reason after erasing the flash it showed up on port COM3 instead of COM7, ah the vagaries of serial port drivers!
python esptool.py --chip esp32s3 erase_flash
At this point, my D1 screen has gone dark, which is probably what I want. :-)
Loading the binary looked like this.
python esptool.py --chip esp32s3 write_flash -z 0 GENERIC_S3-20230426-v1.20.0.bin esptool.py v4.1-dev Found 2 serial ports Serial port COM8 Connecting...................................... COM8 failed to connect: Failed to connect to ESP32-S3: No serial data received. For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html Serial port COM3 Connecting... Chip is ESP32-S3 Features: WiFi, BLE Crystal is 40MHz MAC: dc:54:75:d8:08:d0 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00000000 to 0x00160fff... Compressed 1443040 bytes to 955816... Wrote 1443040 bytes (955816 compressed) at 0x00000000 in 84.3 seconds (effective 136.9 kbit/s)... Hash of data verified.
I connected using Putty to COM3, and I can see the REPL. Now finally it's Micropython time.
LVGL
See my LVGL page.
I did a simple UI design for a CanBus monitor in SquareLine Studio. Next I want to test it in an LVGL simulator.
I am thinking I can install the simulator on Bellman and work with VSCode in remote shell mode. Except at the moment I am a few hundred miles away from Bellman. Might still be okay.
Then I want to get the LVGL module added to MicroPython. Unless I switch to running Zephyr on the ESP32? Or programming it in C anyway. This is looking like a good option, support seems to be there.
Then I want to test the UI in the D1.