Skip to content

Add M5Stack Tab5 #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Add M5Stack Tab5 #1148

wants to merge 8 commits into from

Conversation

jesserockz
Copy link
Member

@jesserockz jesserockz commented Jul 4, 2025

Brief description of the changes

Draft as it requires ESPHome dev / 2025.7.0

Todo

  • Display
  • Touchscreen
  • BMI270 - IMU
  • RX8130 - RTC
  • INA226 - Battery monitoring
  • Camera

Type of changes

  • New device
  • Update existing device
  • Removing a device
  • General cleanup
  • Other

Checklist:

  • There are no passwords or secrets references in any examples.
    The only exceptions are !secret wifi_ssid and !secret wifi_password.
  • The wifi or ethernet block has no static / manual ip address specified.
  • The first configuration provided should be hardware definitions only.
    A more involved example can be provided in a separate configuration block.

Copy link

netlify bot commented Jul 4, 2025

Deploy Preview for esphome-devices ready!

Name Link
🔨 Latest commit f68e9b8
🔍 Latest deploy log https://app.netlify.com/projects/esphome-devices/deploys/6881597747074a00082f2b27
😎 Deploy Preview https://deploy-preview-1148--esphome-devices.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 83 (🔴 down 16 from production)
Accessibility: 86 (no change from production)
Best Practices: 100 (no change from production)
SEO: 89 (🟢 up 1 from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@frederikkunze
Copy link

I am missing the display and touchscreen part which gives most of us a headache currently

@youkorr
Copy link

youkorr commented Jul 7, 2025

as expected I put what I could find for the Tab5, output works is to know for the display, the touchscreen I think that I am not far if you see possible the bad GPIO you can make the correction

output:
  - platform: ledc
    pin: GPIO22  
    id: backlight_pwm
    frequency: 1000Hz         

light:
  - platform: monochromatic
    output: backlight_pwm
    name: "Display Backlight"
    id: backlight
    restore_mode: RESTORE_DEFAULT_ON
    default_transition_length: 250ms

touchscreen:
  - platform: gt911
    id: touch_screen
    i2c_id: bsp_bus
    interrupt_pin: GPIO23  
    reset_pin: 
      pi4ioe5v6408: pi4ioe1
      number: 5  
    display: main_display
    transform:
      swap_xy: false
      mirror_x: false
      mirror_y: false

@youkorr
Copy link

youkorr commented Jul 7, 2025

in the M5stack documentation for the ili9881 display it establishes this way

The LCD reset is on pi4ioe1 pin 4
The touch reset is on pi4ioe1 pin 5
The touch interrupt is on GPIO23

GPIO22 → LEDA (PWM backlight)
GPIO23 → TP_INT (touch interrupt)
GPIO31 → SDA (I2C data)
GPIO32 → SCL (I2C clock)
DSI_CLKN/P → DSI_CK_N/P (MIPI DSI differential clock)
DSI_DATAN0/P0 → DSI_D0_N/P (data lane 0)
DSI_DATAN1/P1 → DSI_D1_N/P (data lane 1)

    
# Configuring the ILI9881C display via MIPI DSI
display:
  - platform: ili9xxx
    model: ili9881
    id: main_display
    # MIPI DSI interface (dedicated pins of the ESP32-P4)
    # DSI_CLKN/DSI_CLKP -> DSI_CK_N/DSI_CK_P
    # DSI_DATAN0/DSI_DATAP0 -> DSI_D0_N/DSI_D0_P  
    # DSI_DATAN1/DSI_DATAP1 -> DSI_D1_N/DSI_D1_P
    reset_pin: 
      pi4ioe5v6408: pi4ioe1
      number: 4
      inverted: false
    invert_colors: true
    auto_clear_enabled: false
    dimensions:
      height: 1280
      width: 720
      offset_height: 0
      offset_width: 0
    data_lanes: 2  # 2 lanes de données (D0 et D1)
    pixel_format: RGB565
    backlight_pin: !extend
      output: backlight_pwm
    init_sequence:
      - [0xFF, 0x98, 0x81, 0x03]  # Page 3
      - [0x01, 0x00]              # Soft reset
      - [0x02, 0x00]              # Display inversion
      - [0x03, 0x73]              # Display control
      - [0x04, 0x73]              # Source control
      - [0x05, 0x00]              # Gate control
      - [0x06, 0x06]              # 
      - [0x07, 0x02]              # 
      - [0x08, 0x00]              # 
      - [0x09, 0x01]              # 
      - [0x0A, 0x00]              # 
      - [0x0B, 0x00]              # 
      - [0x0C, 0x01]              # 
      - [0x0D, 0x00]              # 
      - [0x0E, 0x00]              # 
      - [0x0F, 0x00]              # 
      - [0x10, 0x00]              # 
      - [0x11, 0x00]              # 
      - [0x12, 0x00]              # 
      - [0x13, 0x00]              # 
      - [0x14, 0x00]              # 
      - [0x15, 0x00]              # 
      - [0x16, 0x00]              # 
      - [0x17, 0x00]              # 
      - [0x18, 0x00]              # 
      - [0x19, 0x00]              # 
      - [0x1A, 0x00]              # 
      - [0x1B, 0x00]              # 
      - [0x1C, 0x00]              # 
      - [0x1D, 0x00]              # 
      - [0x1E, 0x40]              # 
      - [0x1F, 0x80]              # 
      - [0x20, 0x05]              # 
      - [0x21, 0x02]              # 
      - [0x22, 0x00]              # 
      - [0x23, 0x00]              # 
      - [0x24, 0x00]              # 
      - [0x25, 0x00]              # 
      - [0x26, 0x00]              # 
      - [0x27, 0x00]              # 
      - [0x28, 0x55]              # 
      - [0x29, 0x03]              # 
      - [0x2A, 0x00]              # 
      - [0x2B, 0x00]              # 
      - [0x2C, 0x00]              # 
      - [0x2D, 0x00]              # 
      - [0x2E, 0x00]              # 
      - [0x2F, 0x00]              # 
      - [0x30, 0x00]              # 
      - [0x31, 0x00]              # 
      - [0x32, 0x00]              # 
      - [0x33, 0x00]              # 
      - [0x34, 0x03]              # 
      - [0x35, 0x00]              # 
      - [0x36, 0x05]              # 
      - [0x37, 0x00]              # 
      - [0x38, 0x3C]              # 
      - [0x39, 0x00]              # 
      - [0x3A, 0x40]              # 
      - [0x3B, 0x40]              # 
      - [0x3C, 0x00]              # 
      - [0x3D, 0x00]              # 
      - [0x3E, 0x00]              # 
      - [0x3F, 0x00]              # 
      - [0x40, 0x00]              # 
      - [0x41, 0x00]              # 
      - [0x42, 0x00]              # 
      - [0x43, 0x00]              # 
      - [0x44, 0x00]              # 
      - [0x50, 0x01]              # 
      - [0x51, 0x23]              # 
      - [0x52, 0x45]              # 
      - [0x53, 0x67]              # 
      - [0x54, 0x89]              # 
      - [0x55, 0xAB]              # 
      - [0x56, 0x01]              # 
      - [0x57, 0x23]              # 
      - [0x58, 0x45]              # 
      - [0x59, 0x67]              # 
      - [0x5A, 0x89]              # 
      - [0x5B, 0xAB]              # 
      - [0x5C, 0xCD]              # 
      - [0x5D, 0xEF]              # 
      - [0x5E, 0x01]              # 
      - [0x5F, 0x14]              # 
      - [0x60, 0x15]              # 
      - [0x61, 0x0C]              # 
      - [0x62, 0x0D]              # 
      - [0x63, 0x0E]              # 
      - [0x64, 0x0F]              # 
      - [0x65, 0x10]              # 
      - [0x66, 0x11]              # 
      - [0x67, 0x08]              # 
      - [0x68, 0x02]              # 
      - [0x69, 0x0A]              # 
      - [0x6A, 0x02]              # 
      - [0x6B, 0x02]              # 
      - [0x6C, 0x02]              # 
      - [0x6D, 0x02]              # 
      - [0x6E, 0x02]              # 
      - [0x6F, 0x02]              # 
      - [0x70, 0x02]              # 
      - [0x71, 0x02]              # 
      - [0x72, 0x06]              # 
      - [0x73, 0x02]              # 
      - [0x74, 0x02]              # 
      - [0x75, 0x14]              # 
      - [0x76, 0x15]              # 
      - [0x77, 0x0F]              # 
      - [0x78, 0x0E]              # 
      - [0x79, 0x0D]              # 
      - [0x7A, 0x0C]              # 
      - [0x7B, 0x11]              # 
      - [0x7C, 0x10]              # 
      - [0x7D, 0x06]              # 
      - [0x7E, 0x02]              # 
      - [0x7F, 0x0A]              # 
      - [0x80, 0x02]              # 
      - [0x81, 0x02]              # 
      - [0x82, 0x02]              # 
      - [0x83, 0x02]              # 
      - [0x84, 0x02]              # 
      - [0x85, 0x02]              # 
      - [0x86, 0x02]              # 
      - [0x87, 0x02]              # 
      - [0x88, 0x08]              # 
      - [0x89, 0x02]              # 
      - [0x8A, 0x02]              # 
      - [0xFF, 0x98, 0x81, 0x04]  # Page 4
      - [0x6C, 0x15]              # 
      - [0x6E, 0x2A]              # 
      - [0x6F, 0x33]              # 
      - [0x8D, 0x1F]              # 
      - [0x87, 0xBA]              # 
      - [0x26, 0x76]              # 
      - [0xB2, 0xD1]              # 
      - [0xB5, 0x27]              # 
      - [0xFF, 0x98, 0x81, 0x01]  # Page 1
      - [0x22, 0x0A]              # 
      - [0x31, 0x00]              # 
      - [0x53, 0x78]              # 
      - [0x55, 0x7B]              # 
      - [0x50, 0x87]              # 
      - [0x51, 0x82]              # 
      - [0x60, 0x15]              # 
      - [0x61, 0x01]              # 
      - [0x62, 0x0C]              # 
      - [0x63, 0x00]              # 
      - [0xA0, 0x00]              # Positive Gamma Control
      - [0xA1, 0x13]              # 
      - [0xA2, 0x23]              # 
      - [0xA3, 0x14]              # 
      - [0xA4, 0x16]              # 
      - [0xA5, 0x29]              # 
      - [0xA6, 0x1E]              # 
      - [0xA7, 0x1D]              # 
      - [0xA8, 0x86]              # 
      - [0xA9, 0x1E]              # 
      - [0xAA, 0x29]              # 
      - [0xAB, 0x74]              # 
      - [0xAC, 0x19]              # 
      - [0xAD, 0x17]              # 
      - [0xAE, 0x4B]              # 
      - [0xAF, 0x20]              # 
      - [0xC0, 0x00]              # Negative Gamma Control
      - [0xC1, 0x13]              # 
      - [0xC2, 0x23]              # 
      - [0xC3, 0x14]              # 
      - [0xC4, 0x16]              # 
      - [0xC5, 0x29]              # 
      - [0xC6, 0x1E]              # 
      - [0xC7, 0x1D]              # 
      - [0xC8, 0x86]              # 
      - [0xC9, 0x1E]              # 
      - [0xCA, 0x29]              # 
      - [0xCB, 0x74]              # 
      - [0xCC, 0x19]              # 
      - [0xCD, 0x17]              # 
      - [0xCE, 0x4B]              # 
      - [0xCF, 0x20]              # 
      - [0xFF, 0x98, 0x81, 0x00]  # Page 0
      - [0x11, 0x00]              # Sleep Out
      - 120                       # Delay 120ms
      - [0x29, 0x00]              # Display On
      - 20                        # Delay 20ms

@youkorr
Copy link

youkorr commented Jul 29, 2025

Hi, I haven't been able to get the Tab5 camera to work. I've spent too much time on it. I think I'm missing a lot of parameters that I don't know and that's a big problem for me... in the logs I had the impression of having made progress but it doesn't work. If you want my work on the external_components, I would be happy to provide it to you, but in raw format (all external). You could modify it for esphome, that might help.

[04:08:31][C][tab5_camera:037]: Setting up Tab5 Camera with ESP32-P4 MIPI-CSI...
[04:08:31][I][tab5_camera:039]: Step 1: Creating synchronization objects
[04:08:31][I][tab5_camera:048]: Frame semaphore created successfully
[04:08:31][I][tab5_camera:056]: Frame queue created successfully
[04:08:31][D][tab5_camera:060]: Configuring external clock on GPIO36 at 24000000 Hz
[04:08:31][I][tab5_camera:064]: Step 2: Initializing camera
[04:08:31][I][tab5_camera:342]: Starting camera initialization for 'Tab5 SC2356 Camera'
[04:08:31][I][tab5_camera:345]: Step 2.1: Initializing MIPI LDO
[04:08:31][I][tab5_camera:131]: Initializing MIPI LDO regulator
[04:08:31][I][tab5_camera:145]: MIPI LDO regulator acquired successfully
[04:08:31][I][tab5_camera:350]: MIPI LDO initialized successfully
[04:08:31][I][tab5_camera:362]: Step 2.2: No reset pin configured, skipping reset
[04:08:31][I][tab5_camera:366]: Step 2.3: Initializing camera sensor
[04:08:31][I][tab5_camera:158]: Attempting to initialize SC2356 camera sensor at I2C address 0x43
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x00 = 0xA2
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x01 = 0x00
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x02 = 0x47
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x0A = 0x00
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x0B = 0x00
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x0C = 0x00
[04:08:31][I][tab5_camera:170]: Sensor responded: reg 0x0D = 0x00
[04:08:31][I][tab5_camera:180]: ✅ I2C communication OK at address 0x43
[04:08:31][I][tab5_camera:198]: 🔍 Sensor ID detected: 0xA000 (reg 0x00=0xA0, reg 0x01=0x00)
[04:08:31][W][tab5_camera:280]: ⚠️ Unknown sensor ID: 0xA000 - using minimal config
[04:08:31][D][tab5_camera:294]: Setting System control: reg 0x09 = 0x00
[04:08:31][D][tab5_camera:294]: Setting Output format: reg 0x15 = 0x00
[04:08:31][D][tab5_camera:294]: Setting TSLB register: reg 0x3A = 0x04
[04:08:31][I][tab5_camera:307]: ✅ Sensor communication test passed (reg 0x00 = 0xA0)
[04:08:31][I][tab5_camera:314]: ✅ SC2356 sensor initialized successfully
[04:08:31][I][tab5_camera:371]: Camera sensor initialized successfully
[04:08:31][I][tab5_camera:374]: Step 2.4: Allocating frame buffer
[04:08:31][I][tab5_camera:382]: Aligned frame buffer size: 614400 bytes
[04:08:31][I][tab5_camera:397]: Frame buffer allocated successfully at 0x4801ff00
[04:08:31][I][tab5_camera:400]: Step 2.5: Configuring CSI controller
[04:08:31][I][tab5_camera:417]: CSI controller created successfully
[04:08:31][I][tab5_camera:420]: Step 2.6: Registering camera callbacks
[04:08:31][I][tab5_camera:431]: Camera callbacks registered successfully
[04:08:31][I][tab5_camera:434]: Step 2.7: Enabling camera controller
[04:08:31][I][tab5_camera:440]: Camera controller enabled successfully
[04:08:31][I][tab5_camera:443]: Step 2.8: Configuring ISP processor
[04:08:31][D][esp-idf:000]: W (2017) ISP: precision loss, real output frequency: 40000000Hz
[04:08:31][I][tab5_camera:459]: ISP processor created successfully
[04:08:31][I][tab5_camera:466]: ISP processor enabled successfully
[04:08:31][I][tab5_camera:469]: Step 2.9: Initializing frame buffer
[04:08:31][I][tab5_camera:472]: Frame buffer initialized
[04:08:31][I][tab5_camera:475]: Step 2.10: Starting camera controller
[04:08:31][I][tab5_camera:483]: Camera 'Tab5 SC2356 Camera' initialized successfully - all steps completed
[04:08:31][C][tab5_camera:072]: Tab5 Camera 'Tab5 SC2356 Camera' setup completed successfully

@youkorr
Copy link

youkorr commented Jul 29, 2025


switch:

  - platform: gpio
    id: cam_rst
    name: "Camera Reset"
    pin:
      pi4ioe5v6408: pi4ioe1
      number: 6
    restore_mode: ALWAYS_ON
    on_turn_on:
      - delay: 100ms
      - logger.log: "Camera reset activated" 

[04:18:45][D][switch:012]: 'Camera Streaming' Turning ON.
[04:18:45][D][tab5_camera:630]: Starting streaming for camera 'Tab5 SC2356 Camera'
[04:18:45][I][tab5_camera:636]: Sending initial transaction to start streaming
[04:18:45][I][tab5_camera:664]: Camera 'Tab5 SC2356 Camera' streaming started
[04:18:45][I][main:1230]: ✅ Camera streaming started successfully!
[04:18:45][D][switch:055]: 'Camera Streaming': Sending state ON
[04:18:45][D][tab5_camera:709][tab5_streaming]: Streaming loop started for camera 'Tab5 SC2356 Camera' (callback-based)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants