Build a Weather Station with Elixir and Nerves (PragProg)

I’m also having a small issue with SGP40 sensor.

I’ve got the other two sensors detected.

Circuit.I2C.detect_devices()
Devices on I2C bus "i2c-1":
 * 72  (0x48)
 * 119  (0x77)

2 devices detected on 1 I2C buses

but the SGP40 shows only a few times.
How come? Am I missing something?

That’s odd. Could you check that the cables are all solidly connected? I’d also disconnect the other sensors, connect only the SGP40, and see if it detects reliably. Try swapping the cables just in case you have a sketchy cable.

1 Like

apologies for the late reply!

Yes, the first things that I’ve tried were to change the wires, unplug/plug back them in, etc. All LED lights were on, but with no avail. Still the same; it would only show the SGP40 a few times.

It is interesting tho, even tho it isn’t detecting my SGP40 (it doesn’t appear in the detect_devices fn), I am able to start_link and get the VOC value. I did read in the datasheet tho that there can/is a downtime for the sensor. Perhaps this is the issue?

Hey @mensore , I am also trying to get SGP40 to work (could not get hold of SGP30). However I am facing the same issue detecting the device. I was wondering if you managed to get past this?

Oh I remember I experienced that issue.

When I was working on SGP40 a few years ago, I immediately got stuck because of the I2C device detection with Circuits.I2C.detect_devices/1 not working.

Long story short, it seems like that is a feature of the SGP40 boards . Their circuit does not allow us for the I2C device detection.

I contacted Adafruit and their support representative tried with their Python code and it did not work either. In the meantime, I purchased SGP40 from Sparkfun, but the result was the same. The representative said the I2C specification does not refer to device detection so this type issue can happen to some boards.

Here is what you may experience when detecting I2C devices.
0x59 will eventually get detected before not being detected for a while.
sgp40-detect-devices

With regard to using the SGP40 sensor with sgp40 package I wrote, while I was able to get measured values, I am not 100% sure those are good because I have zero experience in environment monitoring.

What I did was to

  • read the manual and existing libraries

  • translate the logic to Elixir

  • verify that at least “some” values are coming in

  • verify that the measurement fluctuates when I put my own breath on to the board

So I am hoping to see what various users find out, then improve the package together when needed.

1 Like

@whenzei did not get managed to really add any updates from my end.
I do use @mnishiguchi -san’s package. It seems that altho detecting from the bus is ambiguous at best, the package it self does return some values as mnishiguchi-san mentioned.
I, too, have tried different locations in my own home (next to the ac, fridge opened, bathroom, etc) and it does give me different readings.

I’ll have to get back on the project again to give you guys more updates. Thanks to everyone!