Code Monkey home page Code Monkey logo

sniffer's Introduction

Sniffer

License: CC BY-SA 4.0

Air quality sensor integration board that couples together the following modules:

  • ESP32 TTGO T-Display module
  • PMSA003 module
  • BME680 CJMCU module

I use this to track the AQI in my home. This sensor measures within 1% of 3x different PurpleAir sensors scattered around my neighborhood. The PMSA003 particulate air sensor module in this build should be an improved version the PMS5003 found in the PurpleAir sensors.

Combined with Home Assistant, InfluxDB, and Grafana I can track the long term air quality inside and outside my home.

Details

Order PCBs

Want to build one?

Visit the shared project on PCBWay for direct ordering.

Early PCB Assembly

Sniffer LCD Display

Google Photos Image Gallery

TODO

Hardware

  • Design Kicad schematic + PCB

  • Release Gerbers

  • Order PCBs from PCBWay (use my referral code "3549" to save $5)

  • Photograph real PCB + PCBA

  • Add pin labels to silk screen

  • Route out hole for TTGO T-Display battery connector so it fits flatter

  • Find someone to make a 3D printable enclosure

Software

  • Upload ESPHome YAML file

sniffer's People

Contributors

bepstein111 avatar kylemanna avatar peterg79 avatar victorhooi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sniffer's Issues

Pin connections between ESP32 and PMSA003

Hi,

I don't have the PCB yet, but I wanted to connect what I have to test things out first.

I have the esp32 wired to the PMSA003 with a G7-G135 connector in between (to make it easier to connect the wires)... I'm hoping it should work, but I can only go off of what the picture shows and it's very blurry (and I don't know how to read the schematics yet).

The G7-G135 adapter connected to the PMSA003 shows the wiring to be:
nc
nc
rst
tx
rx
set
gnd
vcc

With the power connector facing the left side (when looking at the esp32 and the display), I can see the vcc goes to the 1st pin on the bottom left of the ESP32 (5V), gnd goes to the 2nd pin from the bottom left (G) and I think set goes to the 3rd pin from the bottom left (pin 27). But it seems there are 2 pins from the PMSA003 are connected to each other perhaps (or do they go somewhere on the ESP32)?

Thank you.
hG1x8ta

Failed config on sniffer.common.yaml during setup

INFO ESPHome 2024.2.1
INFO Reading configuration /config/esphome/ttgo.yaml...
WARNING GPIO0 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
Failed config

display.st7789v: [source /config/esphome/sniffer_common.yaml:107]
platform: st7789v
model: TTGO_TDISPLAY_135X240
backlight_pin:
number: 4
allow_other_uses: True
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
inverted: False
ignore_strapping_warning: False
drive_strength: 20.0
cs_pin:
number: 5
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
inverted: False
ignore_strapping_warning: False
drive_strength: 20.0
dc_pin:
number: 16
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
inverted: False
ignore_strapping_warning: False
drive_strength: 20.0
reset_pin:
number: 23
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
inverted: False
ignore_strapping_warning: False
drive_strength: 20.0
update_interval: 1s
rotation: 270

Couldn't find ID 'temp2'. Please check you have defined an ID with that name in your configuration. These IDs look similar: "temp".
lambda: !lambda |-
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 19, it.get_width(), it.get_height(), id(my_blue)); // header bar

it.strftime(4,  3, id(sz_13), id(my_yellow), TextAlign::TOP_LEFT, "%Y-%m-%d %H:%M:%S", id(esptime).now());

if (id(system_status).state) {
  it.print(236, 3, id(sz_13), id(my_green), TextAlign::TOP_RIGHT, "Sniffer0 Online");
} else {
  it.print(236, 3, id(sz_13), id(my_red), TextAlign::TOP_RIGHT, "Sniffer0 Offline");
}

int r = 18;

it.print(4,    r, id(sz_24), id(my_gray),   TextAlign::TOP_LEFT,  "PM2.5:");

auto color = id(my_red);
if (id(pm_2_5_aqi).state < 50) color = id(my_green);
else if (id(pm_2_5_aqi).state < 100) color = id(my_yellow);
it.printf(236, r, id(sz_24), color, TextAlign::TOP_RIGHT, "%0.0f AQI", id(pm_2_5_aqi).state);

r += 21;
it.print(4,    r, id(sz_20), id(my_gray),   TextAlign::TOP_LEFT,  "PM:");
it.printf(236, r, id(sz_20), id(my_yellow), TextAlign::TOP_RIGHT, "%0.0f/%0.0f/%0.0f µg/m³", id(pm_1_0).state, id(pm_2_5).state, id(pm_10).state);

r += 25;
it.print(120,    r, id(sz_24), id(my_gray),   TextAlign::TOP_CENTER,  "Environment");

r += 23;
float temp_f = id(temp).state * (9.0/5.0) + 32.0;
float temp2_f = id(temp2).state * (9.0/5.0) + 32.0;
/*it.printf(4,   r, id(sz_20), id(my_yellow), TextAlign::TOP_LEFT, "%0.1f°F", id(temp).state); */
it.printf(4,   r, id(sz_20), id(my_yellow), TextAlign::TOP_LEFT, "%0.1f°F", temp_f);
it.printf(125, r, id(sz_24), id(my_yellow), TextAlign::TOP_CENTER, "%0.1f°F", temp2_f);
it.printf(236, r, id(sz_20), id(my_yellow), TextAlign::TOP_RIGHT,  "%0.1f%%", id(humidity).state);

r += 21;
it.printf(4,   r, id(sz_20), id(my_yellow), TextAlign::TOP_LEFT,  "%0.1f hPa", id(pressure).state);
it.printf(236, r, id(sz_20), id(my_yellow), TextAlign::TOP_RIGHT, "%0.1f kΩ",  id(gas_resistance).state/1000.0);

auto_clear_enabled: True
eightbitcolor: False
height: 240
width: 135
offset_height: 52
offset_width: 40

Header for PMSA003

I'm trying to locate an appropriate PMSA003 module to build this project.

In your blog post, you mention that the headers should be included with the modules, which you then solder to the PCB

I'm looking at some examples of the module (e.g. here and here), and it's not always clear if the header is included.

Do you know of any reputable vendors that have the module with header? Or if not, where can you get the header from?

TTGO and PCB spacing

To anyone that has assembled one of these:
From the pictures, it looks like the TTGO either didn't have the battery connector or you removed it to allow the boards to sit close enough to use just the spacers on the male header pins?

Is there spacers available that I can use to raise the TTGO or does the battery connector removed easily?

Thanks in advance for this awesome project!

Sleep PMSA003 via SET pin

I want to preserve the life of my PMS sensor by letting it sleep and getting a measurement every 5 min or so.

Blog post mentions: "some high side P channel MOSFET that would allow me to turn off the various sensors if I wanted to make this battery powered and needed more power management."

My understanding is the TTGo T-display does NOT have any GPIO's with built in 10k pullup like the D1 mini has.

Do I need to add a high side P channel MOSFET or a 10k pull up resistor somewhere in order to accomplish this?

High temp value

comparing the value of other sensors sitting next to the Sniffer they seem to over read by 2-3C I suspect that this might be caused by the internal VOC sensor being on all the time as opposed to taking a sample every 60 seconds though i may be wrong.

In regards to the VOC and Air quality i have also found this that indicates how to extract the Bosch drivers to derive the VOC air quality

https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-on-ESPHome-using-Bosch-s-BSEC-library/td-p/13210

I am no programmer but perhaps this could be updated into the code?

Sniffer used to work fine but after one of the recent updates it stalls out after time.

I've noticed lately that the sniffer stops working after running for a while.

It'll still respond over the network and I can in theory update it, etc. But when I connect into it, the logs show the PM2.5 is reporting with 0 constantly:

[10:11:13][W][component:214]: Component display took a long time for an operation (0.09 s).
[10:11:13][W][component:215]: Components should block for at most 20-30ms.
[10:11:13][D][pmsx003:236]: Got PM1.0 Concentration: 0 µg/m^3, PM2.5 Concentration 0 µg/m^3, PM10.0 Concentration: 0 µg/m^3
[10:11:14][W][component:214]: Component display took a long time for an operation (0.09 s).
[10:11:14][W][component:215]: Components should block for at most 20-30ms.
[10:11:14][D][pmsx003:236]: Got PM1.0 Concentration: 0 µg/m^3, PM2.5 Concentration 0 µg/m^3, PM10.0 Concentration: 0 µg/m^3
[10:11:15][D][pmsx003:236]: Got PM1.0 Concentration: 0 µg/m^3, PM2.5 Concentration 0 µg/m^3, PM10.0 Concentration: 0 µg/m^3

In Home Assistant I can see the temperature among other stats (pressure, wifi signal, etc.) are still updating... it's just the PM/AQI stuff that goes to 0 and then stays there:
image

If I physically reboot the device, AQI starts showing again. But after a day or so, it'll eventually go back to 0 and stay there. Any idea what could be going on?

Thank you.

RecursionError: maximum recursion depth exceeded while calling a Python object

When I run esphome run sniffer0.yaml I get this error: RecursionError: maximum recursion depth exceeded while calling a Python object. I have done all the steps as you have instructed in the README but it still doesn't work I have tried this on windows and Linux but to no avail. I also tried using the web UI, the manual installation, and ESPhome in homeassistant but none worked.

New issues due to ESPhome updates

sniffer_common has errors now with the new version of ESPhome due to the new way ESPhome wants you to program shared pins (pins defined in more than one place).

TTGO chip update

It looks like the TTGO boards with a CP2104 chips are no longer available. They are only now available with a CH9102F chip. After successfully putting one together 1+ years ago, I decided to do another 4 and bought the components. After soldering them together and powering up I just get an "SDcard mount fail" error.

Will the pinouts need to change with the updated chip?

Awesome little project by the way.

edit: @kylemanna are you able to help?

3D Printed Enclosure

I created a 3D print enclosure for this project. I actually made two of these sniffers. I'm thinking about uploading the files to Thingiverse. Let me know if you are interested in the STL files.
IMG_20231119_123355
IMG_20231119_123404

Pin 4 Used in Multiple Places

Unsure if this is a bug that ESPHome introduced, but when I went to update my sniffer with a new version, it complained that "Pin 4 is used in multiple places," both in as a gpio switch and as the backlight pin for the st7789v. Are you aware of this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.