DS18B20 stopped working after several days running

Hi,

I wonder why my DS18B20 sensor stops running after several day of operation.
My sensor is attached to a Rocketcontroller R4G8

Mine is attached to my hot water tank:
We would like to help but!!!

  1. Show Your Work First: Before asking for assistance, make an attempt to design or write the code yourself. Share your work along with details about what isn’t working. Only you know what you want!
  2. Provide Clear Documentation: Since we can’t see your project, share an annotated schematic (best) or a clear drawing of your setup. Pictures are welcome, but avoid using Fritzing diagrams as they are wiring diagrams, not schematics, and are not ideal for troubleshooting.
  3. Include Technical Details: If there is specific hardware involved, include links to technical information. There are often many versions of similar components, so precise details are essential. What version of buttons buzzer and a stepper motor are we looking at.
  4. Reference Resources: For additional help, check out useful links and tutorials: Useful Links on Arduino Forum. Post links to your buttons buzzer and a stepper motor technical information.
  5. Obtain a copy: of the Arduino Cookbook and complete several of the projects. Many of them will help you achieve parts of your goals.
  6. Course Electronics For Beginners (eBook)
  7. Electronics For Beginners (eBook)
  8. Arduino Step-by-step Projects Course | Build 25 Projects

Here is my code

#include "Temperature.h"
#include "conf.h"
#include <OneWire.h>
#include <DallasTemperature.h>

OneWire ds(PIN_ONEWIRE);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&ds);
DeviceAddress insideThermometer;

bool isValidTemperature = false;

Temperature::Temperature()
{
    sensors.begin();
    ds.reset_search();
    ds.search(insideThermometer);
}


byte Temperature::getTemperature(float *temperature)
{
    isValidTemperature = false;

    if (sensors.validFamily(insideThermometer))
    {
        if (sensors.getDeviceCount() < 1)
        {
            if (sensors.getAddress(insideThermometer, 0))
            {
                if (sensors.isConnected(insideThermometer))
                {
                    sensors.requestTemperatures();
                    float tempC = sensors.getTempC(insideThermometer);
                    if (tempC == DEVICE_DISCONNECTED_C) 
                    {
                        //Serial.println("Error: Could not read temperature data");
                        return DS18B20_RCODES::READ_KO;
                    }
                    else
                    {
                        *temperature = tempC;
                        isValidTemperature = true;

                        return DS18B20_RCODES::READ_OK;
                    }
                }
                else
                {
                    return DS18B20_RCODES::NO_SENSOR_FOUND;
                }
            }
            else
            {
                return DS18B20_RCODES::INVALID_ADDRESS;
            }
        }
        else
        {
            return DS18B20_RCODES::NO_SENSOR_FOUND;
        }
    }
    else
    {
        return DS18B20_RCODES::INVALID_SENSOR;
    }
}

bool Temperature::isValid()
{
    return isValidTemperature;
}  ```

Post these header files.

Please explain why you think the sensor stops running, rather than a result of a problem with the code.

1 Like

Since you are using the Dallas library, you might be a lot better off using one of the examples included therein. There doesn't seem to be much point in having twice as much code as everybody else.
Does the job always take about the same amount of time to fail?

Hi,

Can you post some images of your project?
So we can see your component layout.

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

What is a Rocketcontroller R4G8?

Thanks.. Tom... :smiley: :+1: :coffee: :australia: