Temperature Sensor
Materials for this activity:
Let's start by measuring your temperature.
Temperature is one of the simplest and main resources for healthcare professionals to know if something is wrong with you. This activity will help you learn basic Arduino wiring, how to read data from a sensor, and how to get information to display on your computer monitor.
Downloading Libraries
Go ahead and open up your Arduino IDE program.
Before we can use the code for the temperature sensor, you have to first download two libraries. Libraries are a collection of code that make it easier to connect to sensors.
To download libraries: open your Arduino IDE software, open the "tools" tab, and select "manage libraries" (wait about 5 seconds). This will open up the library finder tool.
Here is a picture showing those steps.
Before we can use the code for the temperature sensor, you have to first download two libraries. Libraries are a collection of code that make it easier to connect to sensors.
To download libraries: open your Arduino IDE software, open the "tools" tab, and select "manage libraries" (wait about 5 seconds). This will open up the library finder tool.
Here is a picture showing those steps.
The two libraries we need are "OneWire" and "DallasTemperature". To find the first one, type "OneWire" in the search bar on the top right and push enter on your keyboard. Scroll down until you find "OneWire". Move your computer mouse over that row and then select the "Install" button that appears in the bottom right (wait about 5 seconds for it to install).

Do the same thing to install "DallasTemperature."
You are now ready to wire up and write the code for the temperature sensor!
Coding and wiring your temperature sensor.
Below is a picture example of how you can wire it.
Type this into Arduino IDE in order to get your temperature sensor to work.
Remember the following tips: 1) Capitalization matters 2) If colored parts in my code are not colored in yours, you made a mistake somehow Below is the same code, but with comments to the side to help you see what each line is doing in the code. We will talk about what this code does in class. |
Upload your code to the Arduino board
Plug the blue USB cord into your Arduino and computer. Select the right arrow button (next to the check mark in the top left corner) to send your code to the board.
Go back to the day 1 lesson about the basics if you get stuck here
Go back to the day 1 lesson about the basics if you get stuck here
Serial Monitor: Seeing your temperature
The Serial Monitor is where you can see text or data that the Arduino is outputting. After you upload your code to the board successfully, select the magnifying glass on the top right of the IDE.
After you click that button, a separate window will open up after a few seconds.
It will also restart your Arduino. After a few seconds, you will start seeing your temperature sensor data appear. A new line will appear every two seconds because our code's delay value was 2000.
The data will read normal temperatures assuming you wired your sensor correctly.
The picture below is of Dor
It will also restart your Arduino. After a few seconds, you will start seeing your temperature sensor data appear. A new line will appear every two seconds because our code's delay value was 2000.
The data will read normal temperatures assuming you wired your sensor correctly.
The picture below is of Dor
This activity was inspired by: https://www.youtube.com/watch?v=qxEclOy6jpI
And also by: https://create.arduino.cc/projecthub/akarsh98/ds18b20-temperature-sensor-tutorial-with-arduino-and-esp8266-db31aa
And also by: https://create.arduino.cc/projecthub/akarsh98/ds18b20-temperature-sensor-tutorial-with-arduino-and-esp8266-db31aa