Very new to this datalogger programming. learning as I go, one brick wall I've come across is that there is absolutely no mention of I2C (or even SPI-12) functions in the CRBasic Editor (version 3.7 is installed). The product manual lists support for I2C protocol. And there is a question on this website that pops up with an answer as of last year using commands such as I2COpen, I2CRead, I2CWrite etc. in their program, but why can I find no documentation on this.
Also no generic option available in the Short Cut sensors menu as well.
If anybody has successfully read from a humidity/temperature sensor in I2C or interfaced with I2C in general on these dataloggers could I get some tips on where to get started? Thank you.
Run the CR1000X OS2 update on your computer, and the instructions will show up in CRBasic Editor.
Thanks, installing the latest OS for CR1000x pulled up the I2C commands in the CRBasic Help. Will keep this thread posted soon as to how the connection is going and/or any problems encountered.
I am having a problem with the I2C Communication on a SHT31-D RH/Temp sensor with the CR1000X Datalogger
It is currently reading a -1 value in my return variable when I call in the I2CRead option in my program.
Public TemporaryRead as Long
PortPairConfig(C5,2) 'set C5 for SCL and C6 for SDA and at 3.3V'
I2COpen (C5, 500000) '500 mHZ start at port C5
I2CWrite (C5, &H44, &H2130, 3, &H2)
Scan (1, Sec, 0, 0)
PanelTemp (PTemp, 60)
I2CWrite (C5, &H44, &HE000, 2, &H2)
I2CRead (C5, &H44, TemporaryRead, 4, &H5)
this is the link to the sensor datasheet
Pages 9 and 11 are where I am getting my command instructions to pass to the sensor as well as the address. I am using address 0x44 and attempting periodic acquisition mode at 1 mps
Any advice as to where my program is going wrong would be appreciated, thanks. Maybe I'm inputting the instructions wrong? or missing a step? or maybe specifying the wrong number of bytes in the Read and Write methods
Program and sensor was working, had to reduce the bitrate down to 50000 Hz (my program originally had it at 500000). There is an upper limit to this sensor apparently.
I am trying to connect MLX sensor with 0x5A address but the program fail to compile and gives an error related to undeclared variable and illegal parameter of 0x5A. Anyone has any idea how to address this in I2CWrite and Read?
Use &h05A syntax for entering in the hexadecimal slave address 0x05A.
i.e.: I2CWrite(C3,&H5A,&h06,1,&H2 )'<-- Send register address to reading from.
Hi, following the example above (changed to 50 000 hz) i also read -1
SHT31 sensor is wired to external 3.3v
SCL --> C1
SDA --> C2
4k7 pull-up resistors to SCL and and SDA
What can i do wrong?
Public PTemp, Batt_Volt Public TemporaryRead As Long BeginProg PortPairConfig(C1,2) 'set C1 for SCL and C2 for SDA and at 3.3V' I2COpen (C1, 50000) '50 kHZ start at port C1 I2CWrite (C1, &H44, &H2130, 3, &H2) Scan (3, Sec, 0, 0) PanelTemp (PTemp, 60) Battery (Batt_Volt) I2CWrite (C1, &H44, &HE000, 2, &H2) I2CRead (C1, &H44, TemporaryRead, 4, &H5) NextScan EndProg
Does anyone have a working sample CR1000X program with wiring for the SHT31-D they care to share?