This is my first esp32 c3 purchase and it is acting very strange. Before I hookup everything, I installed the esphome firmware with no connections attached. This is what’s happening when I touch the board. It’s a defective board???
partial esphome config.
esphome:
name: $name
platformio_options:
board_build.flash_mode: dio
esp32:
board: seeed_xiao_esp32c3
variant: esp32c3
framework:
type: arduino
platform_version: 5.4.0
Looks like the inputs are floating so this is a fairly normal behaviour when you touch them. Have you turned on pullups on the inputs?
The snippet you provided doesnt show this part of the config.
I think yes? Here is the rest of the code. Since I don’t have another C3 to test, I used an esp8266 with the same code and scenario and it does not act this way.
I really need to know if this is normal behaviour as the C3 will go inside a tight space and will be a pain to remove. Wires will be soldered on the esp device.
esphome:
name: $name
platformio_options:
board_build.flash_mode: dio
esp32:
board: seeed_xiao_esp32c3
variant: esp32c3
framework:
type: arduino
platform_version: 5.4.0
globals:
- id: squirts
type: float
restore_value: yes
# Timer for Hold Button Reset
- id: press_duration
type: int
restore_value: no
initial_value: '0'
binary_sensor:
- platform: gpio
name: $name Button
disabled_by_default: true
pin:
number: GPIO5
inverted: True
on_press:
then:
- lambda: |-
id(press_duration) = millis();
on_release:
then:
- lambda: |-
if (millis() - id(press_duration) < 3000) {
ESP_LOGD("Scent-a-Tron", "The Button Was Pressed!");
id(theSquirter).turn_on();
} else {
ESP_LOGD("Scent-a-Tron", "Can Percentage RESET");
id(squirts) = 0;
id(can_level).publish_state(100);
global_preferences->sync();
}
select:
- platform: template
id: intervalSelect
name: $name Interval
icon: mdi:timer-outline
optimistic: true
restore_value: true
options:
- "Off"
- $interval1 Minutes
- $interval2 Minutes
- $interval3 Minutes
- $interval4 Minutes
- $interval5 Minutes
on_value:
then:
- script.execute: squirtTimer
script:
- id: squirtTimer
mode: restart
then:
- while:
condition:
lambda: 'return id(intervalSelect).state != "Off";'
then:
- delay: !lambda 'return atoi(id(intervalSelect).state.c_str()) * 60000;' # For testing. Default 60000
# Fire off a Squirt
- switch.turn_on: theSquirter
switch:
- platform: gpio
name: $name
id: theSquirter
icon: mdi:spray
pin:
number: GPIO8
on_turn_on:
then:
- delay: $squirt_pulse
- switch.turn_off: theSquirter
- lambda: |-
id(squirts) += 1;
id(can_level).publish_state( (($maxSquirts-id(squirts))/$maxSquirts) * 100 );
ESP_LOGD("Scent-a-Tron", "I Squirted!");
global_preferences->sync();
sensor:
- platform: template
id: can_level
name: $name Can
device_class: volume
unit_of_measurement: "Can"
update_interval: $interval1 min
lambda: |-
return (($maxSquirts-id(squirts))/$maxSquirts) * 100;
neel-m
(Neel Malik)
March 27, 2025, 5:21am
4
duceduc:
I think yes?
YAML says no
example from the docs:
binary_sensor:
- platform: gpio
pin:
number: D2
mode:
input: true
pullup: true
name: ...