Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
support for DS18S20 + HTU21D added
#1
Support for the 1-wire temperature sensor DS18S20 and for the I2C humidity/temperature sensor HTU21D is added.

I think the next release will come soon...

If you want to use the DS18S20, be aware that it needs at least 3.0V.
#2
I had no time to test anything, but to be curious: Is the support limited to the DS18S20 or are other DS18x20 types supported, too?
#3
What are the differences? Smile I tested with the 18S20 only...
#4
AFAIR some minor diffs in calculating temperature & precision, not sure. I'm short on time actually, I hope to test DS18B20 next week, as I don't have any other types. But I'm quite sure it will run out of the box, or at least with very small changes.
#5
I've tested with DS18B20. As far as i know the DS18B20 has a 12-Bit resolution and the DS18S20 normal a 9 Bit resolution. I have only DS18B20 sensors. The measured value is to high. In a room with 21.8 °C i get the temperature of 579.42 °C with a DS18B20. The sensor is ok. I've checked it on my 1-wire network. When the temperature increase, the measured value decrease.
Is it possible to implemet the DS18B20 and select it in the e2p setting?
#6
Of couse, I'll fix it. Can you tell me:
- how or if the different sensor type can be detected (so e2p configuration might not be necessary)?
- how the calculation is for the B version (a concrete line of code)? A changed onewire_get_temperature function in onewire.c would be perfect (I'll implement the differentiation via e2p by myself then.) - If not, I'll look into the datasheet and test by myself.
#7
AFAIR the first byte of the ROM code tells which type it is.
#8
In the 64-Bit Lasered ROM Code there is the 8-BIT FAMILY CODE which is for DS18S20 (10h) and for DS18B20 (28h). In the 64-Bit Lasered ROM Code there is also the 48-BIT SERIAL NUMBER for each 1-wire device. It would be nice to get this also. In Byte 4 of the SCRATCHPAD for DS18B20 there is the Configuration Register with the Thermometer Resolution Configuration.

I've tried this, but it doen't works. My C knowledge is not so good Huh:

Code:
    // DS18B20
    div = 1;
    // calculate temperature according datasheet
    if (tmp[1] == 0)
        res = tmp[0];
    else
/*        res = -256 + tmp[0];
    
    res = (int16_t)((int32_t)res * 100 / 2 - 25 + ((int32_t)tmp[7] - tmp[6]) * 100 / tmp[7]);
*/    
    // DS18B20
        {
        switch(tmp[4]) {
            case 0: div = 8; break;
            case 1: div = 4; break;
            case 2: div = 2; break;
            case 3: div = 1; break;
        }
        
    res = (int16_t)((int32_t)res / div);


Attached Files
.pdf   DS18S20.pdf (Size: 475.33 KB / Downloads: 1)
.pdf   DS18B20.pdf (Size: 528.7 KB / Downloads: 1)
#9
No problem, thanks for the info. I'll try to implement it in the next 1-2 weeks.
#10
Thanks for the info and for implementing the 1-wire things.
One more Info:
With 2 fresh AAA alkaline batteries the voltage goes down with a DS18B20 sensor on PD4. 5V and GND was taken from JP2. Only with a power supply with 4,5 Volt the system is running stable.
With version 1.2 of the shc_envsensor the 4,7K resitor (R9 in the new version) is external needed between 5V and DATA.


Forum Jump:


Users browsing this thread: 1 Guest(s)