Giter Site home page Giter Site logo

si7021's People

Contributors

adpeace avatar banyaszg avatar egmose avatar goggel avatar lowpowerlab avatar per1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

si7021's Issues

getSerialBytes only returns 12 bytes when it should return 14

The datasheet for the Si7021 shows that when the serial number is requested via software, it gives the data back in two chunks, the first is 8 bytes long and the second is 6 bytes long. Some of the bytes are used for CRC (cyclic redundancy check).
The total actual bytes of serial number data amounts to 8 particular bytes out of that 14.

The problem is that the getSerialBytes(byte * buf) function only gives back 12 bytes instead of the 14 it should. Unfortunately, the 12 bytes miss one piece of the actual serial number itself. When I hooked up, in succession, the seven Si7021's that I have at the house, two of them reported the same serial number!

For my own use I edited the Si7021 library and added a function that returns just the 8 bytes that are the actual serial number we need. After I added the modified library to my project everything works and the serial numbers are unique.

Here is my function (note that it ignores the CRC bytes):

The datasheet for the Si7021 shows that when the serial number is requested via software, it gives the data back in two chunks, the first is 8 bytes long and the second is 6 bytes long. Some of the bytes are used for CRC (cyclic redundancy check).
The total actual bytes of serial number data amounts to 8 particular bytes out of that 14.

The problem is that the getSerialBytes(byte * buf) function only gives back 12 bytes instead of the 14 it should. Unfortunately, the 12 bytes miss one piece of the actual serial number itself. When I hooked up, in succession, the seven Si7021's that I have at the house, two of them reported the same serial number!

For my own use I edited the Si7021 library and added a function that returns just the 8 bytes that are the actual serial number we need. After I added the modified library to my project everything works and the serial numbers are unique.

Here is my function (note that it ignores the CRC bytes):

int SI7021::get8SerialBytes(byte * buf) {
byte serial[8];
_writeReg(SERIAL1_READ, sizeof SERIAL1_READ);
_readReg(serial, 8);
buf[0] = serial[0]; //These are the bytes
buf[1] = serial[2]; //from the datasheet
buf[2] = serial[4]; //that are the
buf[3] = serial[6]; //actual serial
_writeReg(SERIAL2_READ, sizeof SERIAL2_READ);
_readReg(serial, 6);
buf[4] = serial[0]; //Again these are the
buf[5] = serial[1]; //SN bytes
buf[6] = serial[3]; //
buf[7] = serial[4]; //
return 1;
}

Negative temperatures cause overflow?

I'm seeing crazy readings when temperature drops below 32 F, looks like overflow. I assumed the library can handle temperatures below 0 C? However, I do see a lot of unsigned int declarations.

Is this known/expected behavior?

Add license

Could you clarify the license this library is released under? The source files merely state to contact a Marcus Sorensen for details.

sensorExists?

Hi
first of all - thanks for this slim and compact library.

I saw there is a sensorExists option. I din't found much in the source code, is this option implemented?

At the moment I running into issues if the sensor is not available (...anymore) - or do somebody know other ways to stop a blocking state like this?

thanks in advance

Please add license

There's no license specified, and SI7021.cpp says "This program is licensed, please check with the copyright holder for terms". It would be awesome if you could declare the license in the repository. Currently using this is basically forbidden.

Sizeof of buffer or pointer?

void SI7021::_command(byte * cmd, byte * buf ) {
_writeReg(cmd, sizeof cmd);
_readReg(buf, sizeof buf);
}

I does not understand the sizeof of buf , it seems that you ask size of a pointer and not buffer length,
is this correct ?
i think that the correct function should be _command(byte * cmd,int cmdlen, byte * buf ,int buflen);

Add library.json

Add library.json for platformio then call the platformio lib register command to register it.

Does not work as is for ESP8266

Hi,

I spent some time on your library this weekend. I was using it for some time with my moteinos (and without any problem).

But I saw that it does not seem to work as is on any of my ESP8266 (Wemos, Nodemcu v1.0, bare ESP12) all working at 80MHz. I found out that there was two problems :

The higher delay is strange as the datasheet (page 5) mention a worst case conversion time of 12ms. I've used 85ms everywhere and it worked fine but I guess it can be lowered.

I'll probably do a PR about that, once I'm sure that my sensor is working fine for a full week.

Another modification I made was to add CRC check of RH and Temp (Page 17 of the datasheet). Are you also interested by that (as a PR) ?

Thanks a lot for your work (and also for the moteinos)

_getCelsiusPostHumidity blocks/hangs

I started using the code with MySensors and relaized that the code stops at _getCelsiusPostHumidity:

`void sendTempHumidityMeasurements(bool force) {
DEBUG_PRINTLN("sendTempHumidityMeasurements...");
bool tx = force;

si7021_thc data;// = humiditySensor.getTempAndRH();
data.humidityPercent = humiditySensor.getHumidityPercent();
data.celsiusHundredths = humiditySensor.getCelsiusHundredths();
`

The above already has my workaround as humiditySensor.getTempAndRH(); blocked the whole code forever.

I am using this sensor.

Complete code at github.

Do you know a fix?

~Josef

Wire.Begin on esp8266 misses the arguments

Hi Felix Rusu,

Realy nice library.
I was trying to use an SI7021 sensor with an esp8266, and it first didn't work. It did not initialize the sensor... I noticed that the reason is that you forgot to pass the SDA,SCL arguments to the Wire.begin function.
An easy work around is to define again the Wire.Begin(SDA,SCL) function in the sketch.

Cheears

DonDan

No need to wait after Wire.requestFrom().

In the file "SI7021.cpp" in the function "readReg()" a call to Wire.requestFrom() is made and after that while-loop to wait for something. That while loop can be removed, there is nothing to wait for.

When the Wire.requestFrom() returns, the I2C transaction has completely finished and the received data is waiting in a buffer in the Wire library.
When Wire.available() is called directly after Wire.requestFrom(), it returns the number of bytes in that buffer and is the same as the number of requested bytes if the I2C transaction was successful. When there was a I2C bus error, the Wire.avaible() probably returns zero.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.