Zrak u ĐakovuĐakovo air

Napravite svoj senzor zraka

Senzor koji pokreće ovu stranicu otvorenog je koda. Mjeri PM1, PM2.5, PM4 i PM10 čestice, VOC i NOx indekse, temperaturu i vlažnost svake minute, a lampica mu bojom pokazuje razinu PM2.5.

Dijelovi oko 70 €, lemljenje nije nužno, oko dva sata rada. Konfiguracija i upute: github.com/antonio-pottr/djzrak-sensor

1. Dijelovi

DioČemu služiOkvirna cijena
ESP32-C6 SuperMiniMikrokontroler s Wi-Fi-jem i RGB lampicom5 €
Sensirion SPS30 s kabelom (5 žica)Čestice PM1, PM2.5, PM4, PM1040–50 €
Sensirion SGP41, modulVOC i NOx indeks10–15 €
Sensirion SHT40 ili SHT45, modulTemperatura i vlažnost5–10 €
USB-C kabel i punjač za mobitel (5 V)Napajanje—
Žice za spajanje (jumper) ili mala pločica za lemljenjeSpajanje—

Sensirion dijelove kupite kod ovlaštenog distributera (Mouser, DigiKey, TME, Farnell) ili poznatog proizvođača modula (Adafruit, SparkFun, Seeed). Ponude daleko ispod tih cijena često su rabljeni, obnovljeni ili kopirani senzori, a istrošen senzor krivo mjeri i to se ne vidi.

2. Spajanje

Sva tri senzora dijele jednu I2C sabirnicu. SPS30 treba 5 V, ostala dva 3,3 V.

ESP32-C6SPS30SGP41SHT4x
5V1 (VDD)
3V3VINVIN
GND5 (GND) i 4 (SEL)GNDGND
GPIO6 (SDA)2 (SDA)SDASDA
GPIO7 (SCL)3 (SCL)SCLSCL

3. Home Assistant

Senzor šalje podatke u Home Assistant, koji čuva povijest i prikazuje je na mobitelu. Odaberite jedno:

Raspberry Pi (preporuka)

Stalno upaljen, tih, troši oko 5 W.

  1. Nabavite Raspberry Pi 4 ili 5 s napajanjem i microSD karticu (32 GB ili više) ili, bolje, USB SSD.
  2. U Raspberry Pi Imageru odaberite Other specific-purpose OS → Home assistants and home automation → Home Assistant i zapišite ga na karticu ili SSD.
  3. Spojite Pi mrežnim kabelom na router i uključite ga.
  4. Nakon nekoliko minuta otvorite homeassistant.local:8123 i napravite račun.

PC

Radi jednako, ali računalo mora stalno biti upaljeno, inače se podaci dok je ugašeno gube.

  1. Instalirajte VirtualBox (Windows, macOS, Linux).
  2. Pratite službene upute za Windows, macOS ili Linux i pokrenite Home Assistant OS u njemu, s mrežnim adapterom u načinu Bridged.
  3. Otvorite homeassistant.local:8123 i napravite račun.

Home Assistant instaliran kroz Docker također radi, ali nema dodataka (add-ons): senzor tada programirajte iz preglednika na web.esphome.io.

4. Programiranje senzora (ESPHome)

  1. U Home Assistantu: Settings → Add-ons → Add-on store → ESPHome Device Builder → Install, zatim Start i Open web UI.
  2. Kliknite Secrets (gore desno) i dodajte četiri stavke iz secrets.example.yaml sa svojim vrijednostima.
  3. Kliknite New device → Continue → Skip, nazovite ga djzrak-sensor, odaberite ESP32-C6, pa kod novog uređaja kliknite Edit i zamijenite sadržaj s djzrak-sensor.yaml.
  4. Spojite ESP32-C6 USB kabelom na računalo s kojeg radite, kliknite Install → Plug into this computer i odaberite port. Koristite Chrome ili Edge: drugi preglednici ne mogu pristupiti USB-u.

Kasnije izmjene instaliraju se preko Wi-Fi-ja: Install → Wirelessly.

Iz naredbenog retka:

pip install esphome
cp secrets.example.yaml secrets.yaml   # pa ga popunite
esphome run djzrak-sensor.yaml

5. Dodavanje u Home Assistant

Unutar minute od uključivanja Home Assistant pokaže New device discovered: djzrak-sensor pod Settings → Devices & services. Kliknite Configure i zalijepite api_key iz svojih tajni. Mjerenja se tada pojave na nadzornoj ploči i spremaju se u povijest.

Dok nije spojen, lampica svijetli plavo. Ako se ne uspije spojiti na vaš Wi-Fi, otvori mrežu Air Quality Sensor Setup: spojite se na nju lozinkom ota_password i na stranici koja se otvori odaberite svoj Wi-Fi.

6. Na mobitelu

Instalirajte aplikaciju Home Assistant (Android, iOS). Kod kuće sama pronađe vaš Home Assistant. Za praćenje izvan kuće:

Ne otvarajte port 8123 na routeru: time vaš Home Assistant postaje dostupan cijelom internetu.

7. Lampica

BojaPM2.5 (µg/m³)Razina
Zelena0–9Dobro
Žuta9–35Umjereno
Narančasta35–55Nezdravo za osjetljive skupine
Crvena55–125Nezdravo
Ljubičasta125–225Vrlo nezdravo
Tamnocrvenaiznad 225Opasno
Plava—Nije spojen na Home Assistant

8. Gdje ga postaviti

9. Ideje, pitanja i izmjene

Build your own air sensor

The sensor behind this site is open source. It measures PM1, PM2.5, PM4 and PM10 particles, VOC and NOx indexes, temperature and humidity every minute, and its LED shows the PM2.5 level by colour.

Parts about €70, no soldering needed, about two hours of work. Configuration and guide: github.com/antonio-pottr/djzrak-sensor

1. Parts

PartWhat it doesApprox. price
ESP32-C6 SuperMiniMicrocontroller with Wi-Fi and an RGB LED€5
Sensirion SPS30, with its 5-wire cablePM1, PM2.5, PM4, PM10 particles€40–50
Sensirion SGP41 breakout boardVOC and NOx index€10–15
Sensirion SHT40 or SHT45 breakout boardTemperature and humidity€5–10
USB-C cable and phone charger (5 V)Power—
Jumper wires or a small perfboardWiring—

Buy the Sensirion parts from an authorised distributor (Mouser, DigiKey, TME, Farnell) or a reputable breakout maker (Adafruit, SparkFun, Seeed). Listings far below those prices are often used, refurbished or clones, and a worn sensor reads wrong without showing it.

2. Wiring

All three sensors share one I2C bus. The SPS30 needs 5 V; the other two run on 3.3 V.

ESP32-C6SPS30SGP41SHT4x
5V1 (VDD)
3V3VINVIN
GND5 (GND) and 4 (SEL)GNDGND
GPIO6 (SDA)2 (SDA)SDASDA
GPIO7 (SCL)3 (SCL)SCLSCL

3. Home Assistant

The sensor reports to Home Assistant, which keeps the history and shows it on your phone. Pick one:

Raspberry Pi (recommended)

Always on, quiet, and uses about 5 W.

  1. Get a Raspberry Pi 4 or 5 with its power supply, and a microSD card (32 GB or more) or, better, a USB SSD.
  2. In Raspberry Pi Imager choose Other specific-purpose OS → Home assistants and home automation → Home Assistant, and write it to the card or SSD.
  3. Plug the Pi into your router with a network cable and power it on.
  4. After a few minutes open homeassistant.local:8123 and create your account.

PC

Works the same, but the PC has to stay on, or the sensor's data is lost while it is off.

  1. Install VirtualBox (Windows, macOS, Linux).
  2. Follow the official Windows, macOS or Linux guide to run Home Assistant OS in it, with the network adapter in Bridged mode.
  3. Open homeassistant.local:8123 and create your account.

A Docker install of Home Assistant also works, but has no add-ons: flash the sensor from the browser at web.esphome.io instead.

4. Flashing the sensor (ESPHome)

  1. In Home Assistant: Settings → Add-ons → Add-on store → ESPHome Device Builder → Install, then Start and Open web UI.
  2. Click Secrets (top right) and add the four entries from secrets.example.yaml with your own values.
  3. Click New device → Continue → Skip, name it djzrak-sensor, pick ESP32-C6, then Edit the new device and replace its contents with djzrak-sensor.yaml.
  4. Plug the ESP32-C6 into the computer you are using with a USB cable, click Install → Plug into this computer and pick its port. Use Chrome or Edge: other browsers cannot reach USB.

Later changes install over Wi-Fi: Install → Wirelessly.

From the command line:

pip install esphome
cp secrets.example.yaml secrets.yaml   # then fill it in
esphome run djzrak-sensor.yaml

5. Adding it to Home Assistant

Within a minute of powering up, Home Assistant shows New device discovered: djzrak-sensor under Settings → Devices & services. Click Configure and paste the api_key from your secrets. Its readings now appear on the dashboard and are kept as history.

Until it is connected, its LED stays blue. If it cannot join your Wi-Fi at all, it opens a network called Air Quality Sensor Setup: connect to it with the ota_password, and pick your Wi-Fi in the page that opens.

6. On your phone

Install the Home Assistant app (Android, iOS). At home it finds your Home Assistant by itself. To see the sensor away from home:

Never forward port 8123 on your router: that puts your Home Assistant on the open internet.

7. The LED

ColourPM2.5 (µg/m³)Level
Green0–9Good
Yellow9–35Moderate
Orange35–55Unhealthy for sensitive groups
Red55–125Unhealthy
Purple125–225Very unhealthy
Maroonover 225Hazardous
Blue—Not connected to Home Assistant

8. Where to put it

9. Ideas, questions and changes