Troubles with Sensirion SCD41 and IOWarrior

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
jmmelkon
Posts: 9
Joined: Tue Nov 30, 2021 5:33 pm

Troubles with Sensirion SCD41 and IOWarrior

Post by jmmelkon »

Hi,

Despite Christopher's help (thanks to him, btw), I am still having trouble interrogating the SCD41 sensor with IOWarrior24 (yeah I know it's deprecated, sorry). So I am listing my questions here in the hope that a good soul will answer them :-)

The chip returns an ID=2 Report with an error flag set (0x80), and 0 data bytes.

1) I think that means that the slaved does not even acknowledge the 1st data byte (otherwise I would have data count >0).

Am I correct?

2) I have soldered the chip according to Sensirion docs with 10kOhms pull-up transistors for the SDA and SCL pins. The chip is powered with +5V
=> should I disable the pull-up transistors of the IOWarrior when calling the IIC Special Function?

3) Christopher told me that to start a measurement, I have to send a report as follows:

Code: Select all

report-ID = 0x02
report Byte 1 = 0xC4         flags: start, stop, 4byte of data
report Byte 2 = 0x62         i2c address (write)
report Byte 3 = 0x21         register "start periodic measurement" (msb)
report Byte 4 = 0xb1         register "start periodic measurement" (lsb)
BUT: according to the IOWarrior docs, there are only 3 bytes of data sent (address+2bytes of command), so the flags byte should be C3, not C4. I mean, the flags byte does not count as a data byte, right?

https://sensirion.com/media/documents/C ... asheet.pdf


4) According to Sensirion, when writing a command (master->slave, i.e. IOWarrior->SCD41) that is to be followed by a read (slave->master), the command sequence should start with a START bit, while the STOP bit should only be sent (Master->Slave) when all data has been received from the slave.

Does that mean that the stop flag should be set to 0 in the flag byte of the Report? (again, that's the opposite of Christopher's example)

5) Could someone tell me, looking at the docs, whether this sensor is strictly I2C compliant, or does it use a Sensirion variant (such as Sensibus), or a "clock stretching handshake"?
User avatar
Christoph Jung
Posts: 646
Joined: Sun Oct 08, 2006 3:43 pm
Location: Germany / Berlin
Contact:

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by Christoph Jung »

Have you try the "Simple-I2C" software to check for the I2C address? https://codemercs.com/downloads/iowarri ... 2C_win.zip
So with this tool you can chech if the 0x62 is the right address. The IO-Warrior use 8-Bit I2C addresses with the R/W bit. Maybe you have to shift the 0x62 by one.

If you get the flag 0x80, this means you have not the right I2C address / the device is not present.
If you use your own 10k resistors you have to disable the internal one from the IO-Warrior24.
The the flag byte must be 0xC3 this is correct. My code was copied from another Sensirion project. Sorry for that typo.
The Sensirion devices will follow the I2C standard and only some very special (and older) devices use some kind of I2C. But the SCD41 is I2C standard.
If you write a report to the I2C slave the IO-Warrior read back the answere be itself and you have to get the buffer of it.

Code: Select all

if (IowKitWrite(handle, IOW_PIPE_SPECIAL_MODE, (char*)&report, IOWKIT24_SPECIAL_REPORT_SIZE) == IOWKIT24_SPECIAL_REPORT_SIZE){
	// Read I2C answere with error flags
	if (IowKitRead(handle, IOW_PIPE_I2C_MODE, (char*)&report, IOWKIT28_SPECIAL_REPORT_SIZE) == IOWKIT28_SPECIAL_REPORT_SIZE){
		//Read ACK success, check flags
	} else{
		//Error during read
	}
} else {
	//Error during write
}
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
jmmelkon
Posts: 9
Joined: Tue Nov 30, 2021 5:33 pm

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by jmmelkon »

Thank you so much!

I don’t see the device with the SimpleI2C windows binary.
And autodetect devices finds nothing (whereas with the SHT75 it returns something, something incorrect, but not zero).

I will try messing with the address, but I suspect that the PCB board is faulty. Even though it had been designed at my office by following the instructions of the datasheet, and manufactured professionally.

I will buy the SEK-SCD41 kit sold by Sensirion to see how it goes.

Btw I have just purchased the IOWarrior dongle to reward you of your support that I have overused :-P
Too bad Sensirion doesn’t use your hardware anymore in their kits.


What’s the answer to question 4 btw? Thanks.
Guido Körber
Site Admin
Posts: 2800
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by Guido Körber »

jmmelkon wrote: Tue Feb 22, 2022 7:43 pm What’s the answer to question 4 btw? Thanks.
The IO-Warriors take care for that. If you do a write commend without generating a stop then do a read commend it will automatically generate a restart condition.
User avatar
Christoph Jung
Posts: 646
Joined: Sun Oct 08, 2006 3:43 pm
Location: Germany / Berlin
Contact:

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by Christoph Jung »

If the Simple I2C tool will not list the SCD41 than something is wrong with your connection or power supply.
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
jmmelkon
Posts: 9
Joined: Tue Nov 30, 2021 5:33 pm

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by jmmelkon »

OK, so I managed to run the SCD41 sensor.
It happens that wiring was incorrect for one of them, and that the sensor was faulty for the other one (probably the IR source is dead)

I have modified Ullix's I2CpyTools to handle this sensor.

It works, excepted that I cannot interrogate the sensor at time intervals below 5 sec, which is consistent with the datasheet stating that data is refreshed every 5 sec, but Ullix says should be no problem, and he's right in a sense that it shouldn't lead to an error.

Also, IOWarrior48 is not yet implemented

I don't know yet if I can publish the code. Ullix has developped a new version of his GUI program Geigerlog, but I still think that I2CpyTools might be interesting as a lighter, callable python module.
User avatar
Christoph Jung
Posts: 646
Joined: Sun Oct 08, 2006 3:43 pm
Location: Germany / Berlin
Contact:

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by Christoph Jung »

Sounds great the it works now.
If you have some Github links or Ullix will share his work with out we will put all on our website.
We planing to add a page with alle known sources to out devices (Github, sofware and projects).
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
jmmelkon
Posts: 9
Joined: Tue Nov 30, 2021 5:33 pm

Re: Troubles with Sensirion SCD41 and IOWarrior

Post by jmmelkon »

Hi,

I have created a GitHub repo, with permission from Ullix, who doesn't want to maintain this code anymore.

https://github.com/jmmelko/I2C_USB_Dongles/tree/beta

Currently, I have only tested with the hardware I own, but if I haven't messed up with Ullix's code it should work as I2CPytools did before.
Post Reply