Running this code with the default configuration and the basic hardware
hookup, you will see both the object and sensor temperatures displayed on
the serial monitor every two seconds.
Exploring the Gorier Details…
So you want to learn more about the details of what’s going on in the
background? Read on!
There are two tabs in this example that implement the I2C functionality,
I2C_16.h and I2C_functions.ino . These allow the reading and writing of
data to the sensor. Take some time to learn about I2C via our tutorial
mentioned in the beginning. Also learn some about Arduino’s Wire library,
as it is what’s used to make this communication possible. Of course it is
possible to write your own I2C communication from scratch, but the Wire
library makes it much easier.
When it comes to acquiring the object temperature, we must make some
calculations because the sensor only gives us the thermopile voltage and a
raw temperature reading of the actual sensor itself. The equations
necessary for calculating object temperature can be found in section 5.1 of
the user guide. The TMP006_functions.ino tab includes the various
implementations necessary to get temperature readings. The calculations
based on the user guide can be found there. Within TMP006.h , you’ll find
various constants for the calculations, configuration settings, and the
sensor’s register addresses.
Feel free to explore this code as much as you want, and don’t be afraid to
modify it to better suit your needs.
Going Further
Now it’s time for you to go out and explore the real world applications where
you can use this sensor to measure the temperatures of the various things
you find. You have also gained enough knowledge that will allow you to use
other types of sensors that utilize I2C communication more easily. See
what you can build, and feel free to show it to us or give us feedback
regarding this tutorial. Enjoy!
Resources
•Example Code
• TMP006 Datasheet
• TMP006 User Guide
• Breakout Board Schematic
• Breakout Board Eagle Files
Page 5 of 6