Week5 Sensor
DS18B20 Digital Thermometer
What I get for this week’s assignment was a temperature sensor.
-
What does the sensor do?
It senses the temperature of its environment.
-
How does the sensor work?
It gets the temperature data and send it through serial transmission. So microcontrollers can reads its data.
-
What are possible applications of the sensor?
Any idea that relates to temperature.
-
Your project idea using the sensor?
A website that shows the current temperature of my room.
-
Your experience trying out the sensor (if you did)
I’ve done some tests and it works perfectly well. It seems very precise at the reading value. Here are the circuit and codes.
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 5
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Celcius = 0;
void setup(void)
{
Serial.begin(9600);
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures();
Celcius = sensors.getTempCByIndex(0);
Serial.print(" C ");
Serial.println(Celcius);
delay(1000);
}