Hi,
I have a problem with DS18b20 sensor. I go through the coed "Arduino Project Hub"
and it comply well, but in serial monitor it display the capacitance value! instead of temperature.
what is wrong?
thanks for your help
Hi,
I have a problem with DS18b20 sensor. I go through the coed "Arduino Project Hub"
and it comply well, but in serial monitor it display the capacitance value! instead of temperature.
what is wrong?
thanks for your help
The capacitance value of what?
Post your code, and your schematic, if you want help.
Link in post#0 tries to go here: Arduino Project Hub
And it wants to connect to some hackster.io site (bad/ email spammer).
Leo..
When you say that the serial monitor displays a capacitance value, is that because the unit is 'F', which you have taken to stand for Farad?
Some backwards countries still measure temperature on the Farenheit scale, and not the derived SI unit of °C.
m_yousef:
Hi,
I have a problem with DS18b20 sensor. I go through the coed "Arduino Project Hub"
and it comply well, but in serial monitor it display the capacitance value! instead of temperature.what is wrong?
thanks for your help
What did the person that posted that project say when you asked them about the code outputing the readings in Farads ?
And why is your post 'Urgent' ?
m_yousef:
what is wrong?
Shouting URGENT is synonymous with 'demanding' us to jump to attention.
We are a volunteer community here.
Your link is bad.
.
The posted link works for me
https://create.arduino.cc/projecthub/TheGadgetBoy/ds18b20-digital-temperature-sensor-and-arduino-9cc806
The code shown is
// First we include the libraries
#include <OneWire.h>
#include <DallasTemperature.h>
/********************************************************************/
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/********************************************************************/
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin();
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
/********************************************************************/
Serial.print(" Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperature readings
Serial.println("DONE");
/********************************************************************/
Serial.print("Temperature is: ");
Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"?
// You can have more than one DS18B20 on the same bus.
// 0 refers to the first IC on the wire
delay(1000);
}
The display should be in degrees C. What makes you think it is displaying a capacitance value?
Serial.print("Temperature is: ");
Serial.print(sensors.getTempCByIndex(0));
I don't like to see "Urgent" in titles. It suggests that you think you should get help before other people who were already in the queue. That's not nice.
...R
cattledog:
The posted link works for me
Link in post#0 works now.
This sketch shows temp in Capacitance and Farad ![]()
Connect the sensor output to D6, with a 4k7 pull up resistor.
Leo..
#include <DallasTemperature.h>
#include <OneWire.h>
OneWire oneWire(6); // pin D6
DallasTemperature sensors(&oneWire);
float tempC; // Celcius
float tempF; // Fahrenheit
void setup() {
Serial.begin(115200);
Serial.println("DS18B20 thermometer");
sensors.begin();
}
void loop() {
sensors.requestTemperatures();
tempC = sensors.getTempCByIndex(0);
tempF = tempC * 1.8 + 32.0; // Celcius to Fahrenheit
Serial.print("The temperature is ");
Serial.print(tempC, 4);
Serial.print(" Celcius ");
Serial.print(tempF, 1); // one decimal place
Serial.println(" Fahrenheit");
}