>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

OLED Static Issue

I’m having issues using my airgradient with ESPHome. I’m not sure if it is a code issue or a bad solder joint. Any ideas?

What firmware are you running on it?

Try flashing again and make sure you are on the latest version of ESPHome

I am not sure which version of firmware ESPHome is using but I updated it and reuploaded my code and it still does the same thing. I do see this error in the log though:

[09:25:34][W][component:232]: Component display took a long time for an operation (118 ms).
[09:25:34][W][component:233]: Components should block for at most 30 ms.

Here is the code I am using:

esphome:

  name: airgradient

  friendly_name: AirGradient

esp8266:

  board: d1_mini

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: ""

ota:

  password: ""

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Airgradient Fallback Hotspot"

    password: ""

captive_portal:

i2c:

  sda: D2

  scl: D1

uart:

  - rx_pin: D5

    tx_pin: D6

    baud_rate: 9600

    id: uart_1

  - rx_pin: D4

    tx_pin: D3

    baud_rate: 9600

    id: uart_2

sensor:

  - platform: sht3xd

    temperature:

      id: temp

      name: "Temperature"

    humidity:

      id: humidity

      name: "Humidity"

    address: 0x44

    update_interval: 5s

  - platform: pmsx003

    type: PMSX003

    uart_id: uart_1

    pm_1_0:

      name: "Particulate Matter <1.0µm Concentration"

      id: pm10

      filters:

      - sliding_window_moving_average:

          window_size: 5

          send_every: 5

    pm_2_5:

      name: "Particulate Matter <2.5µm Concentration"

      id: pm25

      filters:

      - sliding_window_moving_average:

          window_size: 5

          send_every: 5

    pm_10_0:

      name: "Particulate Matter <10.0µm Concentration"

      id: pm100

      filters:

      - sliding_window_moving_average:

          window_size: 5

          send_every: 5

  - platform: senseair

    uart_id: uart_2

    co2:

      id: co2

      name: "SenseAir CO2 Value"

    update_interval: 60s

  - platform: sgp4x

    voc:

      name: "VOC Index"

    nox:

      name: "NOx Index"

    compensation:

      humidity_source: humidity

      temperature_source: temp

font:

  - file: "fonts/helvetica.ttf"

    id: helvetica

    size: 10

    glyphs: |

      !"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzµ³/

display:

  - platform: ssd1306_i2c

    id: oled

    model: "SSD1306 64x48"

    address: 0x3C

    lambda: |-

      it.printf(0, 0, id(helvetica), "%.1f°F", (id(temp).state * 1.8) + 32);

      it.printf(0, 12, id(helvetica), "%.1f%% RH", id(humidity).state);

      it.printf(0, 24, id(helvetica), "%.0fppm", id(co2).state);

      it.printf(0, 36, id(helvetica), "%.0f µg/m³", id(pm25).state);

Also try physically unplugging it for a few second and then plugging it back in.

Sometimes a soft reset isn’t enough

In case @MallocArray doesn’t help, then flash the stock firmware to 100% eliminate a firmware issue.

@MallocArray / @Achim_AirGradient Where is the stock firmware? I tried the AirGradient One and it said the ESP 8266 version is not supported.

It somewhat depends on which version of the board you have inside of your enclosure.
If it is the latest v4.2 board with the ESP8266 chip, you’ll use this page:
The AirGradient DIY Air Quality Sensor (Pro Version PCB Version 4.2)

if the v3.7, then:
The AirGradient DIY Air Quality Sensor (Pro Presoldered-Version, PCB Version 3.7)

Or if earlier:
The AirGradient DIY Air Quality Sensor (Pro Presoldered-Version, PCB Version < 3.7)

@MallocArray Thanks! My PCB looked like the v3.7 version and that firmware worked correctly. Any idea what might be wrong with the ESPHome code?

I figured out what I believe the issue was. The oled model should have been “SH1106 128x64”.

1 Like

That would do it.
I have some full configs for the various models in ESPHome you can look at or use:
MallocArray/airgradient_esphome: ESPHome definition for an AirGradient DIY device to send data to HomeAssistant and AirGradient servers (github.com)