psvanstrom / esphome-p1reader

ESPHome custom component for reading P1 data from electricity meters.
MIT License
251 stars 106 forks source link

Add XIAO ESP32C3 to hardware section of readme.md #73

Open 314159-r opened 1 year ago

314159-r commented 1 year ago

I have been running the Seeed Studio XIAO ESP32C3 device with p1reader for a few days now. I've had no glitches what so ever since my first successful compile and upload. Cold boot, WIFi connection and communication have all been perfect so far. I assume this setup also could be used with many other ESP32 C3 boards as well.

The hardware setup is really minimal. The only needed external component is a 4.7 kohm pull-up resistor for the RX line. I chose to connect it to the standard TX pin (= GPIO20 or D7).

d1reader xiao esp32c3

I have deliberately omitted an extra capacitor on the input power lines. The Seeed Studio XIAO ESP32C3 already have 4.5 µF on-board on its 5V power input, and I believe that is sufficient. Adding capacitance will inevitably increase the risk of cold boot problems. Especially when used with a power source with less current capacity than the intended USB port. As we must expect with P1 ports.

Other boards with less on-board capacitance might benefit from some external capacitance, but I would be careful adding more than 10µF, and watch out for cold boot problems.

Here is the yaml config that makes it work:

esp32:
  board: esp32-c3-devkitm-1
  variant: esp32c3
  framework:
    type: arduino

! IMPORTANT: - Do not use: board: seeed_xiao_esp32c3 or compilation will fail...

uart:
  id: uart_bus
  baud_rate: 115200
  rx_pin:
    number: 20   #  = GPIO20, D7, RX
    inverted: true

And some picks of my implementation:

DSC_0448 DSC_0450 DSC_0453