Hi,
I wonder why my DS18B20 sensor stops running after several day of operation.
My sensor is attached to a Rocketcontroller R4G8
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!!!
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.
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...