Multichannel Gas Sensor w/ Python


#1

Hi everyone.
I saw your attempt to read data from a Seeed Grove multigas sensor with a Raspberry PI. (https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_i2c_multichannel_gas_sensor/multichannel_gas_sensor.py …). I also read that you left it because the data was not reliable.

Is it correct?

In the Groove page, Beaglebone (mine) and Raspberry PI have a red cross on them, due to SW lack of library (I suppose).

Now I’m trying to write a python library to read/write to the sensor with my Beaglebone (Black Wireless) with I2C functions.
I’m not lucky at the moment since I try to write on it (e.g. set the led on) but it doesn’t turn it on or I can’t read the firmware version on it.

The sensor works because I tried it with UDOO/Arduino board and its sketch.

I can share the code if you want. It very simple actually and I can’t figure out why it’s not working.
Here: https://pastebin.com/XyCZcxX0

i2cdetect detects it:

debian@beaglebone:~$ sudo i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] Y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77

Anyone knows how to fix it?

Thank you,
Davide


#2

So your running a grovepi on a beagleboard?


#3

Nope, I connected the sensor on my breadboard with 4 dupont wires (VCC, GND, SDA, SCL) and the I2C wires to the other I2C sensors (or alone too)


#4

Hi guys, nobody can help me? :frowning: @karan you worked with it in the past


#5

Hi @gorghino,

Unfortunately, the libraries we have for the Multichannel Gas Sensor aren’t working great.
We do have plans for providing a stable library in the future but we don’t have yet time estimates on it.


On the other side of things, I’m kind of confused as to whether you’re using a BeagleBone or a Raspberry Pi.

Let me quote:

Can you clarify us this aspect?
That’d would help us.


Moving on to the next, can you tell us the reason you are using the -r option for the i2cdetect command?
I quote from linux.die.net:

“-r” command option

Use SMBus “read byte” commands for probing (by default, the command used is the one believed to be the safest for each address). Not recommended. This is known to lock SMBus on various write-only chips (most notably clock chips at address 0x69).


Getting UU when i2cdetecting means that the I2C address(es) is/are already being used by some other bit of software.


Thank you!


#6

Hi RobertLucian!
Sorry I got confused in the first thread. I own a BeagleBone Black Wireless at the moment, not a RasPI even if the I2C library I found from other sensors works well with BBBW too. (For example I can read RTC DS3231 or a BMP180).

About -r option, I was following some guides on the Web in ordero to check sensor signal. (like this one).
Note that the gas sensor is correctly added on 0x04 and it’s not kernel-reserved.
Fortunately my 0x04 address is free even I read it’s a risky address to talk with sensors.

Let me know If I can help in any way.


#7

@gorghino, thanks for contacting us. I would recommend you contact Seeed about this, they may have more information about how to connect the sensor to the BeagleBone!


#8