Solution to DS18B20 random 85°C measurements


i have found possible bug in onewire library or of ds18b20 sensor randomly give reading of 85°c.  using 6 sensors in parasitic power on single pin.  allowing 1 sensor temperature conversion @ time.

after studying datasheet , forums, noticed 85°c power value.  stated in datasheet (which did not notice long time) under parasite power, reset pulse of more ~1ms can cause power on reset.  had in onewire library, , noticed interrupts being enabled duration of reset.  changed ::reset function disable interrupts 480us delay , gone 85°c measurements.

i must add arduino working under quite load (it ethernet arduino based swimming pool temperature controller heatpump, solar panels, 4 digit display, etc.)

i not sure whether can cause ill aftereffects, maybe experts out there can comment.

code: [select]
uint8_t onewire::reset(void)
{
io_reg_type mask = bitmask;
volatile io_reg_type *reg io_reg_asm = basereg;
uint8_t r;
uint8_t retries = 125;

nointerrupts();
direct_mode_input(reg, mask);
interrupts();
// wait until wire high... in case
do {
if (--retries == 0) return 0;
delaymicroseconds(2);
} while ( !direct_read(reg, mask));

nointerrupts();
direct_write_low(reg, mask);
direct_mode_output(reg, mask); // drive output low
//interrupts();
delaymicroseconds(480);
//nointerrupts();
direct_mode_input(reg, mask); // allow float
delaymicroseconds(70);
r = !direct_read(reg, mask);
interrupts();
delaymicroseconds(410);
return r;
}

well interesting.

if leaving interrupts disabled solves problem you,   well ok.    suppose depends if else arduino doing,   requires interrupts. 


Arduino Forum > Using Arduino > Sensors > Solution to DS18B20 random 85°C measurements


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support