Arduino Temperature Sensor – Winter is Coming

This blog post is old and the code is not up to date. Here’s a tutorial on how to connect the temperature sensor to your arduino. To send sensor data to the internet you need to use a service like COSM.

I’ve started tinkering with Arduino. My first real project was to connect a DS18B20 temperature sensor to Arduino. I have an ethernet shield on the arduino that uploads data to

The temperature sensor is protected by an old film case and is right outside my window. I wanted to have a web site where I can check the outside temperature so I found a small jQuery script that takes JSON data from my Pachube feed and outputs it on a small web site.

Here’s the pachube feed, and here’s the mobile web site. Get the code here.


  • Nighthawk says:

    Great article nice work

  • Zack says:

    Hi Sir, currently i doing project using fingerprint sensor connect to arduino and have ethernet shield on the arduino. Basically the output from fingerprint will be in id code(exp: 001). The problem is how to sent that data using ethernet shield to display on handphone. Help me plss

  • Luka Rupnik says:


    First, sory for my english.

    I’m working on one project and I don’t know how to continue. Could you help me, please? I’m working with arduino uno, GPRS sheeld SIM900 and temperature sensor DS18S20. I would like that my virtual central heating sistem send me text message (worning: temperature lower then 19 °C) when temperature in my virtual house is lower then 19 °C. And than I send back text message ( sistem on), and my virtual central heating sistem will turn on and heat my house back to normal temperature (23,5 °C).

    Thanks for all your help,

    • Adrian says:

      Hi Luka!

      You have a pretty big project. You need to split it up in smaller parts and look for those solutions first.

      Have you figured out:

      1. How to send/recieve a message with the GPRS shield?
      2. How to connect the DS18S20 temperature sensor and read a value?
      3. How to connect the Arduino to the heating system and increase/decrease the temperature?

  • Loïc says:

    Hi Adrian !

    I’m interested by your project. I would like to do the same in my house. Do I have to buy an arduino Uno to programm the ethernet board ? I have seen a wire DFTI do you know it ? I will use a long wire like you, to connect the sensor because i think if the sensor will be near from the board the temperature will be wrong.

    Thank you.


    • Adrian says:


      I use an Arduino Ethernet shield, and for that I need an Arduino. If I would do the project today I would use the Spark Core. You can program it as an arduino (uses the same code), and it has Wifi (no cables!). It also has it’s own API, so it will be easy to get the temperature data into your phone.


  • david D. says:

    hi !

    I’m trying to build your setup, but this link (visible in the code)
    doesn’t work anymore.

    could you help me out ?

    kind regards

  • Marco says:

    This is a very nice project

  • Eder says:

    You could spend the programming used on the server?

  • Hello Adrian,

    This is my firs Arduino and I also want to make exactly the same thing as you did but i have stumbled across a serios of problems because some of the code that I am using in my arduino is writen in romanian and I don’t know exactly what to change in my code.Could you please help me ? The thing is that my arduino has Temperature, Humidity, Pressure and light sensor and there is a lot of code I must go through.

    Kind Regards,
    Flaviu Vlaicu

    • Adrian says:

      Hello Flaviu!

      I might be able to help you, but I need to know what kind of sensors you have. Is it a combined temperature, humidity and pressure sensor or are they separate? You need to find the part/model numbers. My temperature sensor is a “DS18S20” digital temperature sensor.

  • js says:

    I thought the ethernet sheild used pin 10? Am I just reading this wrong?

    int DS18S20_Pin = 10; //DS18S20 Signal pin on digital 10

    Doesn’t this create a conflict?

  • Pedro says:

    Can you send me your code in this project? tankyou

    • adriantomic says:

      Here’s the code for the pachube and the sensor.

      Make sure you have the correct settings for your network. That’s where I had the most problems.
      You need to input your pachube API-key on line 106.
      The function that connects the temperature sensor is on line 152.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.