SGP30 not returning data

Posted on
Fri Dec 06, 2019 4:41 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

SGP30 not returning data

Hi Karl,

I have bought a couple of new sensors as I look to expand my pibeacon setup, as you make it so easy.
The BME680 is working fine, but the SGP30 is not. It is telling me bad Sensor data.

I struggled a bit looking at both pimoroni and adafruit libraries but I can see it responding to CO2 changes in python as I breathe on it, so it is working. Are there specific libraries I should ensure are setup that you use? Anything else I could try to debug?

Thanks

Posted on
Fri Dec 06, 2019 9:19 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: SGP30 not returning data

I have switched to the "mhz-i2c" co2 sensor.

for the sgp30 everything should be present.. (sgp30.py)

on the RPI:
please check if the i2c channel is active:
Code: Select all
i2cdetect -y 1

then
Code: Select all
cd pibeacon
sudo python sgp30.py

if your get
Code: Select all
06-09:18:37 piBeaconUtils   restartMyself        L:101  Lv:50 cBY:sgp30                --- restarting ---   badsensor
06-09:18:38 sgp30           readParams           L:183  Lv:30 sgp30 reading new parameter file
06-09:18:38 sgp30           startSensor          L:255  Lv:30 ==== Start sgp30 ===== @ i2c= 88
06-09:18:38 sgp30           startSensor          L:271  Lv:30 in Line 262 has error=[Errno 121] Remote I/O error

then the sensor is not recognized on the api

I will reactivate mine and check

Karl

Posted on
Fri Dec 06, 2019 10:52 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: SGP30 not returning data

after reactivating I get:
Code: Select all
sudo python sgp30.py ; tail -f /var/log/pibeacon.log
06-10:44:25 sgp30           startSensor          L:255  Lv:30 ==== Start sgp30 ===== @ i2c= 88
06-10:44:25 sgp30           startSensor          L:263  Lv:30 SGP30 serial #['0x0', '0x64', '0xe603']
06-10:44:25 sgp30           startSensor          L:264  Lv:30 featureset   ['0x20']
06-10:44:26 master          startProgam          L:607  Lv:20 >>>> starting sgp30.py  -- restarting sgp30.py ..not running .. no alive file;--  with cmd: sudo /usr/bin/python /home/pi/pibeacon/sgp30.py  &
06-10:44:26 piBeaconUtils   getIPNumber          L:516  Lv:20 cBY:sgp30                found IP number:192.168.1.20
06-10:44:26 sgp30           readParams           L:183  Lv:30 sgp30 reading new parameter file
06-10:44:26 sgp30           startSensor          L:255  Lv:30 ==== Start sgp30 ===== @ i2c= 88
06-10:44:26 sgp30           startSensor          L:263  Lv:30 SGP30 serial #['0x0', '0x64', '0xe603']
06-10:44:26 sgp30           startSensor          L:264  Lv:30 featureset   ['0x20']

and
Code: Select all
tail -F temp/messageSend | grep sgp
tail: temp/messageSend: file truncated
...
tail: temp/messageSend: file truncated
10:45:38 sgp30:  send -- {"pi":"0","sensors":{"sgp30":{"526192700":{"CO2":"408","VOC":"5"}}},"program":"sgp30","ipAddress":"192.168.1.20","ts":{"tz":"CDT","time":1575650737.92}}
tail: temp/messageSend: file truncated
...
tail: temp/messageSend: file truncated
10:46:34 master:  send -- {"last_masterStart":"2019-12-06 10:43:51","temp":"60.0","rpi_type":"Pi 4 Model B Rev 1.1, ser#10000000f1d7dedb","ts":{"tz":"CDT","time":1575650794.5},"program":"master","last_boot":"2019-12-06 02:01:03","sensors_active":"sgp30, rdlidar, bme680, 3 INPUTpulse, OPT3001","pi":"0","ipAddress":"192.168.1.20","op_sys":"10 (buster), 4.19.75-v7l+, #1270 SMP Tue Sep 24 18:51:41 BST 2019","i2c_active":"16=x10,71=x47,124=x7c"}
tail: temp/messageSend: file truncated
...
tail: temp/messageSend: file truncated
10:47:06 sgp30:  send -- {"pi":"0","sensors":{"sgp30":{"526192700":{"CO2":"419","VOC":"4"}}},"program":"sgp30","ipAddress":"192.168.1.20","ts":{"tz":"CDT","time":1575650826.13}}
tai


thats how it should look like and the plugin updates as well..

I guess the software works..

so please do the i2cdetect
then switch debug on for that rpi in config

on rpi do
tail -f /var/log/pibeacon.log | grep sgp


Karl

Posted on
Fri Dec 06, 2019 12:54 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: SGP30 not returning data

Cheers. I was getting it on i2cdetect but not now. I think I need to check my soldering. Might be a loose connection.

Posted on
Sat Dec 07, 2019 12:48 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: SGP30 not returning data

the sGP30 is a special sensor. the i2cdetect info is not reliable.
because of that i2c multiplexing will not work.

I have a new version that seems to work. will post later today.
need to play with baseline etc..


Karl

Posted on
Sat Dec 07, 2019 2:55 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: SGP30 not returning data

Thanks. No rush.

Posted on
Mon Dec 09, 2019 12:04 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: SGP30 not returning data

I believe I and finished - rewrite of program, including (auto) calibration process and lots of error controls

... but it looks as if the SGP30 does not play well with some other i2c sensors

will add back some sensors to check which one.

Karl

Posted on
Mon Dec 09, 2019 12:53 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: SGP30 not returning data

Thank you Karl. You didn't need to go to trouble of rewriting it.
I don't think I'll be using it on a pi with other sensors but point noted.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron