Author Topic: PAID JOB -Arduino Library wanted for GUVB-C31SM I2C sensor  (Read 394 times)

0 Members and 1 Guest are viewing this topic.

Offline Enea

  • Contributor
  • Posts: 10
  • Country: it
PAID JOB -Arduino Library wanted for GUVB-C31SM I2C sensor
« on: August 20, 2019, 01:27:56 pm »
Hi all,
I need an Arduino library for this I2C GUVB-C31SM UV sensor and I am happy to pay for it. This is the link of the datasheet:

If anyone is interested, please contact me via this forum

Best regards,

Offline ledtester

  • Frequent Contributor
  • **
  • Posts: 535
  • Country: us
Re: PAID JOB -Arduino Library wanted for GUVB-C31SM I2C sensor
« Reply #1 on: August 20, 2019, 02:51:24 pm »
The Arduino I2C API is not to hard to use.

If you look on page 13 and 14 of your datasheet, you'll see that there are basically four I2C operations:

- single write operation
- burst write operation
- single read operation
- burst read operation

Here is how they translate into Arduino C code. Refer to the Register Map on page 10 for the offsets of the device's registers.

Any improvements to the code are welcome. The multiple read routine was grabbed from this forum discussion:

Code: [Select]
#include <Wire.h>

// I2C address of the GenUV device:

#define DEV_ADDR 0x30

// single write - write the MODE register

    Wire.write(0x01);   // selects the MODE register
    Wire.write(0x31);   // data to write to the MODE register

// burst write - write the MODE_CTL and the next register which is SOFT_RESET

    Wire.write(0x0A);   // selects the MODE_CTL register
    Wire.write(0xF0);   // data to write to the MODE_CTL register
    Wire.write(0x56);   // data to write to the SOFT_RESET register

// single read - read the MODE register

    int value = -1;  // -1 means no value has been read

    Wire.requestFrom(DEV_ADDR, 1);
    while (Wire.available()) {
        value = (uint8_t) Wire.receive();
    // value contains -1 if device didn't reply; contains the MODE register otherwise

// burst read - read the NVM MSB and LSB bytes

    // First write 0x0C to the NVM Read Control register


    // Then read the NVM_MSB and NVM_LSB bytes:

    // a general purpose burst read routine to read multiple bytes

    uint8_t data[16];
    uint16_t bytes_received;
    uint16_t remaining;

    remaining = 2;  // request 2 bytes

    bytes_received = 0;
    Wire.requestFrom(DEV_ADDR, remaining);
    while (Wire.available() && remaining--) {
      data[bytes_received] = Wire.receive();

    // check remaining == 0; received bytes are returned in data[]

« Last Edit: August 20, 2019, 02:53:38 pm by ledtester »

Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo