Arduino-based Talking & Remote Thermometer

After recently getting my hands on an Arduino Duemilanove, I came across this Sketch on Arduino Playground that allowed an Arduino to function as a temperature measuring device with the addition of a few cheap and easily obtainable components.

Deciding to take things a step further, I wrote a Python script to create a DIY temperature measuring device that could be used both locally, via the command line, as well as remotely, using a googlemail account to check the temperature of a room. You can grab a copy of this script, called “Ardthermo”,  from the Software page.

This article should give all the info you need to know to build this little project for yourself and make use of the Ardthermo script.  Enjoy.

What you’ll need


  • 1x Arduino with at least 1 free Analog input port.
  • 1x Solderless Breadboard (to try the circuit out on.)
  • 1x 10k resistor
  • 1x 10k NTC (Negative Temperature Coefficient) Thermistor.


  • Linux (Ubuntu Recommended. All instructions in this article assume that Ubuntu is installed on your PC.)
  • The Festival Text To Speech software program. (Optional, but needed if you want the temperature reading ‘Spoke’ to you as well well as printed on the screen.)
  • A Googlemail account (You can sign up for free here)
  • Python version 2.5.2 or above with termios support compiled in and the libgmailpySerial and getpass Python modules installed.
  • The Arduino IDE software package (Get it  from here.)
  • My Python script, Ardthermo, for the PC (get it from the Software page.)
  • My slightly modified version of the Temperature Measurement Sketch for the Arduino which is bundled in with the Ardthermo script. (I take NO credit for this Sketch at all, as all I’ve done to it is modify it a little bit to suit my needs.)


Ok, lets get the Arduino-side of the project up and running by putting the Temperature Measuring circuit together. In the rest of this guide, I make the assumption that you’re using a Solderless Breadboard but soldering the circuit together onto a bit of Vero or Matrix Board should be a trivial task for a beginner.

You’ll need to use the Power (+5v), Gnd (Ground)  and one of the Analog-in connectors (Pin 0) on the Arduino. On mine, the Analog-In connectors are located near the bottom right-hand corner of the board and the Power connectors are just to the left of them. The image below should explain this better:

Arduino Board Connectors
Click for Full-Sized version

You will need to set up the 10K  NTC thermistor and 10K resistor on your breadboard (if you have one.) You might be able to see how everything is hooked up from the video near the top of the article (sorry about the rubbish quality), but the schematic diagram below shows how everything should fit together better than the vid.

Schematic Diagram
Schematic Diagram for Temperature Measuring circuit

On the diagram above, VR1 represents the 10K NTC thermistor and R2 represents the 10K resistor. Be sure to check all connections between the Arduino and the Measuring circuit, as well as the USB or Serial connection between the PC and Arduino before continuing.

Installing Software components

So, now we have everything connected up it’s time to configure all the software components you’ll need. This section will concentrate on installing the Python modules, uploading the Thermometer Sketch to the Arduino and using the Ardthermo script. Installation of the Arduino IDE is outside the scope of this article but information on getting it setup under Ubuntu can be found at the Arduino Playground site.

Installing the Python modules

In Ubuntu, the getpass module should already be installed on you system and termios support compiled in (at least, it is on mine. I’m using Ubuntu 8.10.)

You can install the libgmail and serial Python modules in one go by opening up a Terminal window and issuing the following command:

sudo apt-get install python-serial python-libgmail

Installing Festival

In Ubuntu, just load up a Terminal and issue the following command to install the Festival Text To Speech package:

sudo apt-get install festival

Uploading the Sketch to the Arduino

First of all, connect the Arduino to your PC if you haven’t already done so, then execute the Arduino IDE.

When the Arduino IDE has loaded, check that the Board and Serial Port settings are correct for the setup you have. To check the Board setting, select Tools from the top menu then select the Board menu option and check that the name that’s currently selected matches the board you have. For example, my Arduino board is a Duemilanove, so I have the “Arduino Diecimila or Duemilanove” option selected here for my setup.

To check the serial port settings, select Tools from the top menu then select the Serial Port option. If your Arduino uses a USB port and you have no other USB-serial devices plugged in then /dev/ttyUSB0 should be OK here. Otherwise, use /dev/ttyUSB1 instead.

When you’ve configured your Board and serial options and everything checks out OK, it’s time to upload the Sketch to the Arduino. In the Arduino IDE, either use the Ctrl-O keyboard shortcut or select File from the top menu, then Sketchbook and then Open which should bring up the Open Processing Sketch window like the one in the screenshot below:

Open Processing Sketch Window
Open Processing Sketch Window. Click on image to open a full-sized version in a new browser window.

When this window is displayed, navigate to the directory where you unpacked the ardthermo source archive. From there, navigate to the sketch sub-directory, then to the thermometer.  sub-directory. In the Files pane you should see thermometer.pde displayed. Click on this file to load the sketch into the IDE.

When the sketch has loaded, use the Ctrl-U keyboard shortcut or go to File, then select Upload to Board. If all went well you should see an LED on the Arduino blinking on and off once a second. This indicated that the sketch has been uploaded and has executed successfully.

About The Ardthermo Script

The Ardthermo script is a command line application and can operate in one of three basic modes:

  1. Standard mode: Prints out a temperature reading (In degrees Celsius) and speak the temperature reading using Festival if its installed on the host system.
  2. Email Listening Mode: Polls a configured email account for a valid command and send a temperature reading to the address the command originated from. A valid request email contains the text CMD:rtemp in the subject line. Any unread message with a valid subject line is treated as a new request and any text in the message body is ignored.
  3. Email Alerts Mode: Monitor the temperature once every minute and send an email to a configured address if the temperature exceeds a threshold specified by the user.

When you first unpack the script, you will need to configure it. To do this, load the file (this is the main program, all the other files you will see are modules and cannot be run directly!) into your preferred text editor and scroll down until you come across the configuration options.

There are 5 configuration options you will need to set, which are described below:

  • AlertsAddress: Used by the Email Alerts mode function: Specifies the recipient of alert messages.
  • FestivalPath: The path to the Festival program on your system.
  • GmailUser and GmailPass: The username and password of the gmail account that will be used by the Email Listening mode function for incoming requests and responses, as well as by the Email Alerts Mode function in order to send alert messages.
  • MailCheckDelay: Used by the Email Listening mode function: Specifies how often the configured gmail account should be checked for new incoming requests.

After setting the configuration options, you should also check that the script has executable permissions. If it does not then issue the following command to enable them:

chmod +x

Using Ardthermo

In order to run the script, you must supply the serial port the Arduino is connected to as the first argument, then the mode you wish to run it in as the second argument. For example, if you wanted to run ardthermo in Standard Mode and your Arduino was connected to the serial port device /dev/ttyUSB0,  you would issue the following command: /dev/ttyUSB0 -t

To use Email Listening Mode, you would supply -e as the second command line argument. For Email Alerts Mode, you would supply -ea as a second argument and the trigger-point (or threshold) for the alert email message as a third argument. So, for example, if you wanted to be emailed when the temperature of a room reached or exceeded 20 Degrees Celsius, you would issue the following command: /dev/ttyUSB0 -ea 20.0

More details on the command line arguments needed to use the different modes of the script can be obtained by either running with no additional arguments or by supplying  the -h (help) argument on its own, which will print the help message to the terminal. You can also check the comments of the Ardthermo script and its companion modules for more guidance.


This script does have a few limitations. For one, its not mult-threaded so you can only use one mode function at a time. Another big limitation is that it only reports the temperature readings in Celsius, with no option for readings to be given in Fahrenheit as well.

If there’s demand for it, I plan to write a multi-threaded version of Ardthermo with an option for Fahrenheit readings as well;  If I can get my head around writing mult-threaded apps, that is!  Oh, the “joys” of being a Python newbie 🙁

Until next time, have fun and happy coding/hacking/whatever floats your boat!

14 thoughts on “Arduino-based Talking & Remote Thermometer”

  1. Fahrenheit temp = ((Celsius temp – 32) * 5) / 9, but I think you already know that… Just for those who can’t wait and want to change the script.

  2. That’s brilliant mate! never would have thought about taking that approach. mind if I add you to the blogroll?



  3. dude that is awesome is it avaliable in a ready to buy kit form for use in fridges when temp monitoring is hyper where food or meds need to be kept at a certain temp range and we have to provide written data to say the ave temp was x or y on a daily or monthly or yearly basis .would be interested in building it my self if not available as a kit .thanks for the article ….genius ………………….jay

  4. Hi Jay,

    No at the moment, but there is a promising looking piece of kit for the Arduino under development at which looks pretty comprehensive (loads of sensors, including thermistors.)



  5. That’s brilliant mate! never would have thought about taking that approach. mind if I add you to the blogroll?



    Yea no problem i will add you in mi 2 blogs too.

  6. Very nice script!

    How would I get it to loop? I added this..

    if(sys.argv[3] == ‘-l’):
    loop = True;

    while loop == True:
    NewTemp = obtaindata.ObtainTempData(ser) #Obtain a reading from the Arduino. Store in variable NewTemp
    print ‘The current light is %s .\n’ %(NewTemp)

    However it “crashes” on the 3rd repitition of the loop, with:

    Invalid input recieved from terminal or serial port… Exiting…

    Any ideas?

  7. Woops- I am so silly 🙂

    When BubbleBoy (my robot) first starts up, it callibrates the LDR by waiting 500ms in between each reading. It does that 5 times. 5*500ms != 3000ms

    I changed the sleep time to 5s, and it no longer crashes now!

    Yay for robots that are smarter than their humans! Hahahahaha

Comments are closed.