Skip to content

Instantly share code, notes, and snippets.

@proffalken
Created December 9, 2023 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proffalken/4083a47c3aa3608985e375d8ada62465 to your computer and use it in GitHub Desktop.
Save proffalken/4083a47c3aa3608985e375d8ada62465 to your computer and use it in GitHub Desktop.
m5stick esphome config
esphome:
name: m5stick
friendly_name: m5stick
esp32:
board: m5stick-c
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "<ENC KEY>"
ota:
password: "<PASSWORD>"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "m5stick Fallback Hotspot"
password: "m5stick"
captive_portal:
# Built-in Serial Peripheral Interface (SPI)
spi:
clk_pin: GPIO13
mosi_pin: GPIO15
# Built-in I2C Bus. Bus_external is for devices connected via the HAT pins. Not sure which interface is used for devices connected via the Grove port
i2c:
- id: i2c_internal
sda: 21
scl: 22
scan: true
- id: i2c_external
sda: 0
scl: 26
scan: true
# Built-in Red Status LED Light. See https://esphome.io/components/light/status_led.html
light:
- platform: status_led
name: "LED Light"
restore_mode: ALWAYS_OFF
pin:
number: GPIO10
inverted: true
# Built-in buttons. See https://esphome.io/components/button/
binary_sensor:
- platform: gpio
pin:
number: GPIO37
inverted: true
id: button_a
name: Button A
- platform: gpio
pin:
number: GPIO39
inverted: true
id: button_b
name: Button B
# Built-in infrared transmitter. See https://esphome.io/components/remote_transmitter.html and https://m5stack.hackster.io/alessandro-polselli/turn-m5stickc-into-universal-ir-remote-home-automation-d3ec0d
#remote_transmitter:
# pin: GPIO9
# carrier_duty_percent: 50%
# Built-in 6-axis intertial measurement unit (IMU) that also includes a temperature sensor
sensor:
- platform: mpu6886
i2c_id: i2c_internal
address: 0x68
accel_x:
name: "MPU6886 Accel X"
accel_y:
name: "MPU6886 Accel Y"
accel_z:
name: "MPU6886 Accel z"
gyro_x:
name: "MPU6886 Gyro X"
gyro_y:
name: "MPU6886 Gyro Y"
gyro_z:
name: "MPU6886 Gyro z"
temperature:
name: "MPU6886 Temperature"
# AXP192 power management - must be present to initialize TFT power on
- platform: axp192
address: 0x34
i2c_id: i2c_internal
update_interval: 30s
battery_level:
name: "M5Stick Battery Level"
id: "m5stick_batterylevel"
# Fonts
font:
- file: 'arial.ttf'
id: font1
size: 8
- file: 'arial.ttf'
id: font2
size: 36
- file: 'arial.ttf'
id: font3
size: 14
# builtin 80x160 TFT
display:
- platform: st7735
cs_pin: GPIO5
dc_pin: GPIO23
reset_pin: GPIO18
device_height: 80
device_width: 160
row_start: 0
col_start: 0
model: "INITR_MINI160X80"
rotation: 0
update_interval: 1s
lambda: |-
auto red = Color(255, 0, 0);
auto green = Color(0, 255, 0);
auto blue = Color(0, 0, 255);
auto white = Color(255, 255, 255);
it.rectangle(20, 50, 30, 30, white);
it.rectangle(25, 55, 30, 30, red);
it.rectangle(30, 60, 30, 30, green);
it.rectangle(35, 65, 30, 30, blue);
time:
- platform: homeassistant
id: homeassistant_time
- platform: sntp
id: sntp_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment