When sparkfun made the "Thing" boards, they left the following footprints empty:
- ATECC108A – A “full turnkey Elliptic Curve Digital Signature Algorithm (ECDSA) engine”, which can be used for unique serial numbers, hashing, key storage, or random numbers. A great start to securing your IoT project!
- TMP102 Temperature Sensor – A simple, 12-bit, digital temperature sensor.
- TSL2561 Light Sensor – A nifty luminosity/light sensor.
- Plus a few footprints for decoupling capacitors.
I've been hooking up DHT11/22 to arduino uno to 433Mhz to another arduino to openhab, all over my house. What if I just used the TMP101 on a Thing, to send direct to openhab over arduino.
So here we go. a strip of 5 TMP102s acquired from RSComponents for sub $5. Soldered on to Things.
Check out how tiny these things are (NZ postage stamp added for comparison purposes)
I used the Wire library and this example code to get a reading from the sensor.
//////////////////////////////////////////////////////////////////
//©2011 bildr
//Released under the MIT License - Please reuse change and share
//Simple code for the TMP102, simply prints temperature via serial
//////////////////////////////////////////////////////////////////
#include <Wire.h>
int tmp102Address = 0x48;
void setup(){
Serial.begin(9600);
Wire.begin();
}
void loop(){
float temp = getTemperature();
Serial.print("Temperature: ");
Serial.println(temp);
delay(200); //just here to slow down the output. You can remove this
}
float getTemperature(){
Wire.requestFrom(tmp102Address,2);
byte MSB = Wire.read();
byte LSB = Wire.read();
//it's a 12bit int, using two's compliment for negative
int TemperatureSum = ((MSB << 8) | LSB) >> 4;
float celsius = TemperatureSum*0.0625;
return celsius;
}
The ambient temperature in the room was 24C (YAY SUMMER!). The reading on the board was 26C.
This is less than ideal, because i want the room temp, not the board temp.
So, conclusion: That was fun, educational, but not greatly useful - and i'll get better data from a DHT22 that's separated physically from the board slightly.