rubiojr / go-enviroplus

Go module to read Pimoroni's Enviro+ sensors
BSD 2-Clause "Simplified" License
8 stars 2 forks source link

Static Gas Readings #5

Open vernak2539 opened 1 year ago

vernak2539 commented 1 year ago

Hello! Hope this finds you well. I've just had a try using the enviro+ to get the gas measures using the MICS6814. I've copied the example out of the files into a test script.

Unfortunately, I'm seeing something weird, which is a a constant value for oxidising, reducing, and NH3.

Oxidising: 25193.96
Reducing:  25193.96
NH3:       25193.96

I've not had a chance to look into it properly, but wanted to post here just in case anyone would happen to know what's going on. The python version reading the sensor seems to deliver the correct results (again, I've yet to investigate).

My sample code is here. I've been running this on a Pi Zero W with Enviro+ (Air quality as well).

Any help would be much appreciated!! If I have time to look into this more, I'll be sure to update this issue

vernak2539 commented 1 year ago

I've looked a bit more into this and still no dice unfortunately.

As I purchased the envrio+ recently, I saw this on their site:

Notes Due to exciting global electronic parts shortages, some Enviro +s manufactured in 2021 have an ADS1115 ADC instead of the usual ADS1015. Our Python libraries have been updated to automatically detect and adjust for this chip change.

Maybe that could've been the issues?! So I copy/pasted the source and switched it to use ads1x15.NewADS1115 instead of ads1x15.NewADS1015. I tried it and it didn't work unfortunately.

I tried to add some logging as well. The for loop via StartReading is working, refreshing data every second. It's just getting the incorrect value.

I have to dig a bit deeper as this is getting out of my depth. It looks to be something to do with potentially reading pins and their values incorrectly... I'm not sure...

It even could be in the end something on my end as I do run the python script alongside it. I've tested multiple different times with the python prometheus exporter stopped.

Here's the code with my copy/pasted/modified mics sensor (test, custom sensor)

vernak2539 commented 11 months ago

@rubiojr would you happen to have any ideas on this by chance?

rubiojr commented 11 months ago

@vernak2539 I lost access to my enviro+ a while ago, I'm afraid I can't help you debug this currently.

Sorry to leave you hanging there, missed the other notifications.