I wanted to share a configuration for the Adafruit ESP32-S3 Feather to get others started quickly. A few things that are included:
- Correct power activation for the IC2 bus and NeoPixel to function
- Includes an external component for the MAX17048 Li+ Cell Fuel Gauge
- NeoPixel light component
- Button component (turning on the Neopixel)
- Rainbow effect for that Adafruit feel
# Board: Adafruit Feather ESP32-S3 No PSRAM
# Definition: definitions/boards/adafruit_feather_esp32s3_nopsram/manifest.yaml
# Strapping pin warnings can be safely ignored for GPIO0 and GPIO3
esphome:
name: "adafruit_feather_esp32s3"
friendly_name: "Adafruit Feather ESP32-S3"
on_boot:
- priority: 700
then:
# By default power for the IC2 and NeoPixel are turned off.
- switch.turn_on: i2c_power # Must be turned on before the IC2 setup_priority
- switch.turn_on: neopixel_power # Must be turned on any time before using the NeoPixel
- delay: 500ms
- priority: 400
then:
# Let's turn on the NeoPixel rainbow effect for that Adafruit feel.
- switch.turn_on:
id: toggle_neopixel
esp32:
variant: ESP32S3
logger:
level: DEBUG
#baud_rate: 0 # This disables logs on the serial UART port.
api:
encryption:
key: "<your key here>"
ota:
- platform: esphome
encryption:
wifi:
power_save_mode: LIGHT
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
external_components:
# The builtin max17043 platform works with the max17048 chip, but does not
# include the battery discharge rate sensor.
- source: github://pr#13585 # https://github.com/esphome/esphome/pull/13585
components: [max17048]
refresh: 1h
i2c:
- sda: GPIO3
scl: GPIO4
scan: true
setup_priority: 600 # Initialize I2C after power is turned on.
switch:
- platform: gpio # IC2 power supply.
# An output could be used, but for low power modes a switch is helpful.
pin: GPIO7
id: i2c_power
internal: true
restore_mode: ALWAYS_ON # let ESPHome turn it ON during setup. This is not strictly
# necissary, but could be used in low power modes.
- platform: gpio # NeoPixel power supply.
# An output could be used, but for low power modes a switch is helpful.
pin: GPIO21
id: neopixel_power
internal: true
restore_mode: ALWAYS_ON # let ESPHome turn it ON during setup. This is not strictly
# necissary, but could be used in low power modes.
- platform: template
id: toggle_neopixel
optimistic: true
on_turn_on:
then:
- light.turn_on:
id: neopixel
brightness: 40%
effect: "Rainbow"
on_turn_off:
then:
- light.turn_off:
id: neopixel
sensor:
- platform: wifi_signal
name: "WiFi Signal"
id: wifi_signal_db
update_interval: ${update_interval}
- platform: max17048 # The builtin max17043 platform can be used instead, just
# remove the rate sensor if you downgrade.
address: 0x36
update_interval: 60s
battery_voltage:
name: "Battery Voltage"
entity_category: "diagnostic"
battery_level:
name: "Battery Level"
entity_category: "diagnostic"
rate:
name: "Battery Discharge Rate"
entity_category: "diagnostic"
binary_sensor:
- platform: status
id: node_status
name: "Node Status"
- platform: gpio
id: button
name: "Button"
pin:
number: GPIO0
mode:
input: true
pullup: true
inverted: true
on_click:
then:
- switch.toggle: toggle_neopixel
light:
- platform: esp32_rmt_led_strip
id: neopixel
name: "NeoPixel"
pin: GPIO33
num_leds: 1
chipset: SK6812
channel_colors: GRB
restore_mode: ALWAYS_OFF
effects:
- pulse:
transition_length: 1000ms
update_interval: 1000ms
max_brightness: 80%
min_brightness: 20%
- addressable_lambda:
name: "Rainbow" # https://community.home-assistant.io/t/share-your-esphome-light-effects/250294/8?u=u0398
lambda: |-
uint8_t led_change = 24; //(higher is more change) the difference in hue for each led down the strip
float speed = 4; //(lower is faster) the speed the first led colour changes at (therefore affecting all)
if (initial_run) {
it.all() = Color(0, 0, 0);
}
unsigned long time = millis() / speed;
int repetitions = time / 1529;
uint16_t hue = time - (1529 * repetitions);
for (int i = 0; i < it.size(); i++) {
if (hue < 255) {
uint8_t green = hue;
it[i] = Color(255, green, 0);
} else if (hue >= 255 && hue < 510) {
uint8_t red = hue - 255;
it[i] = Color((255 - red), 255, 0);
} else if (hue >= 510 && hue < 765) {
uint8_t blue = hue - 510;
it[i] = Color(0, 255, blue);
} else if (hue >= 765 && hue < 1020) {
uint8_t green = hue - 765;
it[i] = Color(0, (255 - green), 255);
} else if (hue >= 1020 && hue < 1275) {
uint8_t red = hue - 1020;
it[i] = Color(red, 0, 255);
} else if (hue >= 1275 && hue < 1530) {
uint8_t blue = hue - 1275;
it[i] = Color(255, 0, (255 - blue));
}
hue+=led_change;
if (hue >= 1530) {
hue-=1530;
}
}