Introduction:
I bought a few tmp102 sensors on matching breakout boards from SparkFun to take measurements around the greenhouse. Apart from the fact that this sensor is tiny, very energy efficient and responsive I mainly decided to go for these instead of thermistors because they are digital (no need for endless conversions) and since they are I2C they can all be connected to the same two wires. This model is limited to four devices per I2C bus which is enough for what I want to do. If you need more you will find plenty of tmpXYZ choices on TI’s website. I’ll start with connecting the maximum of four tmp102 sensors to one Arduino Uno board, mainly to explain how the addressing scheme works and then move on to a setup which allows for multiples of four sensors to be read with the same Arduino Uno with the help of 4051 multiplexers.
Some cold facts on the tmp102 before we start:
Low Power Digital Temperature Sensor with SMBus/Two-Wire Serial Interface in SOT563
resolution of 0.0625C
range of -40C to +125C
SMBus and two-wire interface compatibility
up to four devices on one I2C/TWI bus.
1.4V to 3.6VDC supply range
And some links with with more details:
http://arduino.cc/playground/Code/TMP102
www.sparkfun.com/products/9418
www.ti.com/product/tmp102
www.ti.com/lit/ds/symlink/tmp102.pdf
1. The theory:
The idea is simple. Imagine the I2C interface like a little network. You connect your sensors to the two wires (analog pin 4+5 on the Arduino Uno), configure each sensor to have it’s own hardware address and then just send out a request through the two wires to talk to which ever address you want.
2. Let’s connect the first one:
Connect the sensor as follows:
On the tmp102 breakout board: -> On the Arduino Uno board:
V+ -> 3.3V
GND -> GND
SDA -> analog pin 4
SCL -> analog pin 5
ADDO -> GND
With the help of this sketch we can now get the current temperature reading form our first sensor.
3. Let’s connect some more:
To get more than one of these sensors to work on our I2C network we need to configure each one of them with it’s own hardware address. This is achieved by connecting the breakout boards ADDO pin to different Arduino pins. The four possible options are:
On the tmp102 breakout board: -> On the Arduino board: -> Translates to network address:
ADDO -> GND -> 1001000 -> 0x48 -> 72
ADDO -> 3.3V -> 1001001 -> 0x48 -> 73
ADDO -> SDA -> 1001010 -> 0x48 -> 74
ADDO -> SCL -> 1001011 -> 0x48 -> 75
[3dpix id=4f5fad65378501744e000000 width=500 height=170 mode=parallel]
Once all four sensors are connected the following sketch will get the current temperature reading form all four sensors.
4. Anything else it can do?
I didn’t expect much more from a temperature sensor, in fact this is a lot for such a tiny package. Still, it’s got a few more tricks up it’s sleeve. The TI manual mentions a few more registers towards the end, in addition to the current temperature this sensor also stores it’s configuration and highest/lowest temperature readings in registers which are accessible via I2C. I doubt that many people are going to be interested in the configuration register and further options of this sensor, feel free to consult the manual for further details. I can see use for the min/max temperature registers for stand alone setups (I tend to store sensor readings in a database) and the following sketch will display the content of the current/max/min temperature registers for all four sensors.
5. One more to go:
I had ordered five of these tmp102 sensors since I was afraid I might kill one during “testing”. They have proven very hardy, even running them on 5V or connecting various pins wrongly doesn’t seem to have caused my testing sensor any obvious damage. Obviously I couldn’t resist to try and make the fifth one work as well 😉
6. 2×4051=32xtmp102…
To prove that it is possible to read multiple strains of 4xtemp102 I’ve setup a little experiment with two 4051 multiplexers and two tmp102s which are both set to a 72 address by connecting their ADD0 pins to ground. Multiplexer nr1 (which is going to control all the SDA pins) has it’s z pin connected to analog pin 4 and multiplexer nr2 (which is going to control all the SDC pins) has it’s z pin connected to analog pin 5. Both multiplexers have their s0-2 pins connected to the same digital pins 8/9/10 which allows to select the eight different strains of tmp102s we can now start to connect. I’m sticking to two for the moment but this setup is obviously easily extendable.
For anyone who isn’t familiar with the 4051 there is a good introduction on the playground (http://www.arduino.cc/playground/Learning/4051).
[3dpix id=4f5fb5453785019538000001 width=500 height=165 mode=parallel]
The following sketch will set the multiplexers, read both 72 tmp102s in turn and prints the result to the serial monitor.




