Setting up an ESP32C2

Hullo hullo

I bought a few ESPC2 8684 boards to automate some fans - I got them because they were the cheapest, and didn’t think to check compatibility before I did

I’m running HA on a Raspberry Pi 4 using HA OS, with the ESPHome addon installed. In the UI for selecting a board, I can’t find my exact version. Picking just a generic ESP32 doesn’t work, I get the error ERROR Running command failed: This chip is ESP32-C2 not ESP32. Wrong --chip argument? while installing the yaml.

At this stage I’d usually write it off and buy some more boards I know would work, but one thing that give me hope is that ESP32C2 appears in the variant autosuggest, I just can’t work out what the board type should be.

image

Are they compatible, or should I get some new boards?

Thanks :slight_smile:

1 Like

if unsure choose a generic board from Espressif such as esp32dev

Just like the docs say

Also fixed your subject line

Thanks for your quick response!

Sorry if my post wasn’t clear enough - it’s when using board: esp32dev, I get the error ERROR Running command failed: This chip is ESP32-C2 not ESP32. Wrong --chip argument?. I’ve tried setting the variant as well using

esp32:
  board: esp32dev
  variant: ESP32C2

but I get the error Option 'variant' does not match selected board.

Sorry you were clear, I didn’t read it well.

Try esp-idf framework. The C2 is a single core board.

However I am not sure how well the C2 is supported. Board request: ESP8684-DevKitM-1 · Issue #1151 · platformio/platform-espressif32 · GitHub

Ah, thanks very much, I’ll go down that rabbit hole and see if I can get it working

Did you get it working also have c2 board

1 Like

Old thread but I got a few ESP32-C2 and went down that rabbit hole too, this board should be compatible since September 2023: ESPHome 2023.9.0 - 27th September 2023 — ESPHome
“Support for ESP32-C2 & ESP32-C6 esphome#4377 by @vidplace7

I also saw this blog with an example: Run ESPHome on ESP32-C2 / ESP8684 | www.ewan.cc

I’m still trying to compile something to test the board with no success, any help would be appreciated. Thanks!

Hi!! Same problem. Have you achieved something?

Not actually, I gave up and ended up using an ESP32 C3-12F. The pinout is quite similar, but the pins EN, IO0, and IO1 are mixed, so it requires some attention.

For me it’s working well in ESPHome 2025.11.0 in that way:

substitutions:
  device_name: prueba
  friendly_name: Prueba

esp32:
  board: espc2-01
  variant: esp32c2
  flash_size: 2MB
  framework:
    type: esp-idf
    version: 5.3.1
    sdkconfig_options:
      CONFIG_XTAL_FREQ_26: y

esphome:
  <<: !include common/esphome.yaml
  platformio_options:
    platform:
      - https://github.com/ewpa/platform-espressif32.git#esp32c2

wifi:
  <<: !include common/wifi.yaml

#captive_portal:

mdns:
  disabled: true

api:
  <<: !include common/api.yaml
  
ota:
  <<: !include common/ota.yaml

logger:

light:
  - platform: status_led
    name: "LED"
    pin:
      number: 2
      inverted: true

@sermayoral , I’m also trying to compile for the esp32c2, but run in multiple errors using ewpa’s repo like you do (certainly I’m having my own api/ota/wifi settings which are just fine on other ESP variants).
Would you mind to also share your common/esphome.yaml (without secrets of course)?

Of course:

esphome.yaml

name: ${device_name}
comment: ${friendly_name}

wifi.yaml


ssid: !secret wifi_ssid
password: !secret wifi_password

use_address: ${device_ip}

ap:
  ssid: ${friendly_name} Hotspot
  password: !secret passwd_esphome

# Minimum WiFi authentication mode device will accept when connecting to access points
min_auth_mode: WPA2

api.yaml

encryption:
  key: !secret encrypt_esphome

ota.yaml

platform: esphome
password: !secret passwd_esphome

Be sure you clean build files before compiling it.

1 Like

I just tested it with the base ESPHome firmware, and it worked perfectly! We no longer need the ewan fork. I’m sharing the code. Try it out!

substitutions:
  device_ip: 192.168.33.242
  device_name: test
  friendly_name: Test

esp32:
  board: esp32-c2-devkitm-1
  flash_size: 2MB
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_XTAL_FREQ_26: y

esphome:
  name: ${device_name}
  comment: ${friendly_name}

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  
  use_address: ${device_ip}
  
  ap:
    ssid: ${friendly_name} Hotspot
    password: !secret passwd_esphome

  min_auth_mode: WPA2
  
  mdns:
    disabled: true

api:
  encryption:
    key: !secret encrypt_esphome
  
ota:
  platform: esphome
  password: !secret passwd_esphome

logger:
2 Likes

@sermayoral , thanks a lot!
I couldn’t find anything in your remaining configuration files what could’ve cured the trouble on my end.
However, finally I was able to get a working firmware with the ewan fork as well as with the standard firmware (see below). IMPORTANT: One should disable mDNS in any case (even though it would compile just fine with mDNS enabled), but mDNS is sooo terribly resource intensive that the ESP32C2 becomes quite unreliable and laggy.
Depending on the respective network setup it then may be important to apply the wifi.use_address option (in my case necessary anyways due to a multi-subnet setup and certainly I’m not reflecting all multicast traffic from one subnet to another :wink: )

The following configuration worked like charm for me with ESPHome 2025.11.0:
(controller is the ESP32-C2 with 2MB flash and 26 MHz XTAL)

# ESP32-C2 Considerations:
#  - disable mDNS - too resource heavy for 1C CPU
#  - disable WiFi power save mode
#  - use custom partition for larger app-images

esphome:
  name: somfyio
  friendly_name: SomfyIO

esp32:
  board: esp32-c2-devkitm-1
  variant: esp32c2
  flash_size: 2MB
  partitions: "/config/esphome/part_2MB_ota.csv"
  framework: 
    type: esp-idf
    sdkconfig_options:
      CONFIG_XTAL_FREQ_26: y

mdns:
  disabled: true

logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key_espc2

ota:
  - platform: esphome
    password: !secret ota_pw_espc2

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: somfyio.lan
  power_save_mode: none  # added for higher stability

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "SomfyIO-AP"
    password: !secret ap_pw_espc2

captive_portal:

# ESPHome program code to follow below
# .
# .

By tinkering around with the partitions table I could crank up the app size to 983,040 bytes (960 kB) whilst keeping the OTA functioning on a 2MB flash (certainly some space is needed for the bootloader and other non-volatile stuff).

part_2MB_ota.csv:

# Name,   Type, SubType, Offset,   Size, Flags
nvs,      data, nvs,     ,        0x3000,
otadata,  data, ota,     ,        0x2000,
phy_init, data, phy,     ,        0x1000,
app0,     app,  ota_0,   ,        0xF0000,
app1,     app,  ota_1,   ,        0xF0000,

@madmat17 I’m glad you managed it. Several things here:

The standard firmware works as is, as long as you upload the firmware via OTA. Uploading firmware by serial is broken, but I was working with the ESPHome guys yesterday and it will be fixed in version 2025.11.1 with this PR. Thanks @jonathan.swoboda!!

Therefore, if you need to upload the firmware via serial before version 2025.11.1, you must add the following code:

#temporary until ESPHome version 2025.11.1
external_components:
  - source: github://pr#12050
    components: [esp32]
    refresh: 1h

mDNS is destructive. I don’t use it on any of my nodes. I have a local DNS configured at router level (MikroTik) with the .lan suffix, and that’s what I use. So yes, I also recommend not using mDNS, not only with the esp32-c2, but on any node.

The partition table is very interesting. I’ll take a look at it because it’s something I’m interested in. However, in your case, if you disable Captive Portal, you might be able to flash the firmware without modifying the partition table. The Captive Portal binaries take up quite a bit of space.You can leave the OTA functionality enabled.

You don’t need to specify the ‘variant’ attribute, because it’s the default variant for the ESP32-C2 board.

1 Like

@sermayoral, thank you very much. I’m genuinely excited to use some ESP32 C2 that I have lying around.

BTW I am from Madrid too, did realize you had two surnames till I saw your device name “prueba” haha glad to meet locals on HA world :smiley:

Wow I live in Madrid too. We could say we’re neighbors :slight_smile:

Not exactly. I’ve compiled a factory.bin with the YAML mentioned in my previous post and could flash it via UART.

There’re users out there who need to rely on mDNS. Hence, I wouldn’t discourage folks using mDNS in general, but certainly when it comes to the ESP32-C2.
I’m also running my own DNS & DHCP setup (I can strongly recommend OpenWRT). Those who don’t want to tinker around too much with routers and/or their own DNS setup, should use fixed IP addresses instead.

You got a point here - but I wanted to have the captive portal enabled.
Furthermore I wanted to squeeze out as much space as possible. Right now I’m only using ~82% of the app partition. :wink:
It was more a “What’s possible?” approach and might help others who indeed have more severe space constraints.

Ah - thanks! That was an artifact from the YAML the latest version was based on.