Skip to content
mahler83 blog v2

Pharmacology, IoT, LLMs

mahler83 blog v2

Pharmacology, IoT, LLMs

ESPHome yaml example for CM1106/CM1107 and AHT10/AHT20

ESPHome yaml example for CM1106/CM1107 and AHT10/AHT20

mahler83, 2021-09-172023-05-24

Edit: This was an issue from 2021, and it seems code for AHT10/AHT20 has been updated at some point. Please consider this as a piece of record of HA history. (2023-05-24)

I am running an ESP8266 in my living room to monitor carbon dioxide levels and temperature+humidity, using a CM1107 and AHT20.

Wemos D1 mini, CM1107, AHT20 mounted on a perfboard. I used pin headers so that you can easily swap out components. Also, CM1107 pin headers do not fit the 0.1 inch gaps, so you need to use pin headers and slightly bend it.
Wiring is done on the other side of the perfboard.

CM1107: https://s.click.aliexpress.com/e/_A3DxcY
AHT20: https://s.click.aliexpress.com/e/_Anb8GU

As of September 2021, CM1106/CM1107 is not supported yet. So you have to use the following custom component. Many thanks to LeoDJ!

https://github.com/LeoDJ/ESPHome_Nodes/tree/main/CM1106_CO2_Sensor

Also, the temperature+humidity sensor AHT10/AHT20 is very buggy when connected to ESPHome. Some discussion was made on the issue page: https://github.com/esphome/issues/issues/1635

I had to make some adjustments to make it work properly. Please refer to the following youtube video.

Finally, the working ESPHome yaml example.

esphome:
  name: livingroom-air
  platform: ESP8266
  board: d1_mini
  includes:
  - "cm1106.h"

external_components:
  - source:
      type: git
      url: https://github.com/mahlernim/esphome
      ref: dev
    components: [ aht10 ]

wifi:
  ssid: !secret ssid
  password: !secret password
  manual_ip:
    static_ip: !secret ip_livingroom
    gateway: !secret ip_gateway
    subnet: 255.255.255.0
  ap:
    ssid: "livingroom"
    password: !secret ap_password

captive_portal:

logger:
  baud_rate: 0

api:

ota:

i2c:
  sda: D7
  scl: D6
  frequency: 200kHz

uart:
  rx_pin: RX
  tx_pin: TX
  baud_rate: 9600
  id: cm1107_uart

sensor:
- platform: custom
  lambda: |-
    auto cm1106Sensor = new CM1106Sensor(id(cm1107_uart), 20000);
    App.register_component(cm1106Sensor);
    return {cm1106Sensor};
  sensors:
  - name: "CM1107 CO2"
    accuracy_decimals: 0
    unit_of_measurement: "ppm"
    device_class: "carbon_dioxide"
    filters:
    - median:
        window_size: 5
        send_every: 5
        send_first_at: 3
- platform: aht10
  temperature:
    name: "Livingroom AHT Temperature"
    accuracy_decimals: 1
    filters:
    - filter_out: 0.0
    - median:
        window_size: 3
        send_every: 3
        send_first_at: 1
  humidity:
    name: "Livingroom AHT Humidity"
    accuracy_decimals: 1
    filters:
    - filter_out: 0.0
    - median:
        window_size: 3
        send_every: 3
        send_first_at: 1
  update_interval: 15s

switch:
- platform: custom
  lambda: |-
    auto cm1106Calib = new CM1106CalibrateSwitch(id(cm1107_uart));
    App.register_component(cm1106Calib);
    return {cm1106Calib};
  switches:
  - name: "CM1107 400ppm Calibration"

Share this:

  • Twitter
  • Facebook
Home Assistant

Post navigation

Previous post
Next post

Related Posts

3D Printing

3D 프린터 소비전력, 요금추정

2021-09-152021-10-31

홈어시스턴트에 연결된 스마트 플러그를 이용해서 3D프린터의 소비전력을 실시간 모니터링중이다. 3D 프린터를 구입하고 싶은 사람들에게 참고가 될까 싶어 기록을 남긴다. 사용 3D 프린터 모델: Ender-3 V2제품링크: https://s.click.aliexpress.com/e/_9G2Eak 250W 정도로 높은 피크를 찍을 때가 핫베드와 노즐 온도를 올리면서 연속으로 열을 낼 때다. 그 이후로는 온도를 유지하면서 모터들을 돌리는 소비전력으로 보면 된다. 왼쪽은…

Share this:

  • Twitter
  • Facebook
Read More
DIY

스마트홈1. Wemos D1 mini DIY LED 구글어시스턴트로 음성제어하기 – Raspberry Pi 4B, Home Assistant, ESPHome

2020-11-102023-07-19

Wemos D1 mini와 같은 ESP8266 보드로 DIY 기기를 만드는데 관심을 가지고 있었고, 자연스레 이 기기들을 연동시켜 사용할 수 있도록 스마트홈을 구축하고 싶어졌다. 작업한 내용을 내가 참고할 겸, 비슷한 작업을 하실 분들에게 도움이 되지않을까 싶어 정리해둔다. Part 1. Home Assistant 설치 스마트홈 서버로 사용할 라즈베리 파이(4B 4GB)를 구입했다. 좀 시끄럽더라도 쿨링이…

Share this:

  • Twitter
  • Facebook
Read More
Home Assistant

스마트홈3. 라즈베리파이4 SSD로 부팅하기

2020-12-052023-01-02

홈어시스턴트를 라즈베리파이에 설치해 SD카드로 사용하다가 어느 순간 갑자기 SD카드가 망가져서 복구하느라 애먹었다는 이야기가 워낙에 많이 있어서 SSD로 변경하기로 했다. 운좋게도 11월 말에 Raspberry Pi에서 USB 부팅을 공식지원하는 업데이트가 올라오면서 간단하게 작업을 할 수 있었다. – 2020년 12월 5일 참고: https://jamesachambers.com/new-raspberry-pi-4-bootloader-usb-network-boot-guide/ 5만원 정도를 투자해 업그레이드를 해주기로 했다. 케이스(=어댑터) 구입시 UASP 지원…

Share this:

  • Twitter
  • Facebook
Read More

Comments (2)

  1. Oscar says:
    2023-05-23 at 01:55

    Thanks for the blog
    I am looking only at the part for the ATH20.
    I think you did your troubleshooting when the ESPHome implementation for ATH20 was not available yet??

    When I add your git repository as an external component, I get the error message when compiling:
    ‘delay_microseconds_accurate’ was not declared in this scope.

    Now I am a newbie, but I am guessing this is some low-level ESP home code that has changed since you used it.
    So I am just letting you know, maybe you can add a line in your blog that this code is obsolete or something.

    I am going to try and see what happens with the current implementation of AHT10 in ESPHome itself.

    Regards, Oscar

    Reply
    1. mahler83 says:
      2023-05-24 at 16:14

      Thanks for the update. This was an issue a year and a half ago, so things must have changed a lot. Cheers!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  1. mahler83 on 공부 잘하는 과학적 방법 – Weinstein 2018.12023-07-30

    접속자가 갑자기 늘어서 홈페이지가 오동작을 했습니다. 시간이 지나면 나아질 것 같습니다.

  2. SkyHigh on 공부 잘하는 과학적 방법 – Weinstein 2018.12023-07-30

    PC에선 잘 보이는데 모바일(아이폰)에선 한번 보이고 이후부턴 계속 나오질 않네요. 뭔가 문제가 있어보입니다. 한번 확인해봐주세요

  3. mahler83 on DadGPT 한자능력검정시험 교재 4급II (자체제작)2023-07-19

    참고로 이번 주가 어문회 시험 신청 기간입니다. 좋은 결과 있으시길!

  4. Jin on DadGPT 한자능력검정시험 교재 4급II (자체제작)2023-07-19

    감사합니다~ 어이 말고 재가 해야 겠어요~

  5. mahler83 on GPT에게 한의사 국시를 풀게 했더니 57% 정답률 – 2023.32023-06-14

    안녕하세요, 댓글이 스팸필터에 걸려있어 뒤늦게 확인했습니다. 트위터에서 멘션이나 DM주셔도 되는데 번거로운 방식을 선택하신 이유가 궁금하네요. 일단 메일 드리겠습니다.

  • 3D Printing
  • Academic writing
  • Adsense
  • AI
  • AWS
  • Creativity
  • DIY
  • favorites
  • Gaming
  • Generative AI
  • hands-on
  • Home Assistant
  • Ideas
  • IT
  • Lab Stuff
  • Large language model
  • Law
  • Machine Learning
  • Medical Education
  • Medicine
  • My Thoughts
  • Neuroscience
  • Parenting
  • Pedagogy
  • Pharmacology
  • PHP
  • PokemonGo
  • Precision medicine
  • Reasoning
  • Science
  • Social studies
  • Statistics and Math
  • Tips & Techs
  • Twitter API
  • Ubuntu
  • Uncategorized
  • Web development
  • Web News
©2023 mahler83 blog v2 | WordPress Theme by SuperbThemes