The pull-ups for i2c are pretty easy! You need two resistors with a value of between 1k and 10k each, with 4.7k ohm being ideal and you need to connect one from pin D0 to 3V3 and the other from pin D1 to 3V3.
If you look at the fritzing diagram in this post above:
The would go from D0 to the positive 3v3 rail at the very bottom and from D1 to the same 3v3 rail at the bottom.
@bko thanks! With a little help from a co-worker I got it working. Iām going to play around with Fritzing a little and see if can provide an updated diagram for other novices like myself.
hmmmā¦seems that I spoke to soon. Was working fine and I was wandering around the house and outside watching the temperature fluctuate, now Iām back to 255.94ā¦no clue why it would stop working.
I decided to try it on my other core. Rewired the breadboard and flashed the core and it seems to be working again?? Iām sure that itās user error, but Iām not sure how to troubleshoot.
The pictures really help! So you TMP102 board from Sparkfun has plated thru-holes for the connectionsādid you solder those jumper wires into those holes or are they just press fit?
I think your problem could be those connections to the TMP102 breakout board! Those really need to be soldered to be reliable connections.
[edit] You could solder headers like a lot of prototype boards have. If you have the Maker Kit, it has them-you just cut them to the length need with diagonal cutters on the plastic between pins.
Yes those are the headers I was talking about from Sparkfun.
You can solder any wire in there for prototyping, even the breadboard wires. The headers are nice since it makes it breadboard friendly and you can use them later for a permanent installation too.
I really think you will see the reliability improve dramatically!
Of course. This seems to work with my sensor (itās the old sparkfun board). Iāve changed the code below to also publish the temperature using the new Spark.publish() API
//////////////////////////////////////////////////////////////////
//(c)2011 bildr
//Released under the MIT License - Please reuse change and share
//Simple code for the TMP102, simply prints temperature via serial
// edited by m01
//////////////////////////////////////////////////////////////////
#include <application.h>
int tmp102Address = 0x48; // 0x90; //0x48;
double celsius=0;
byte MSB=0;
byte LSB=0;
char tmp[10];
const int interval = 60; // seconds
float getTemperature();
#define USE_SERIAL 0
void setup(){
Spark.variable("temperature", &celsius, DOUBLE);
// Spark.variable("LSB", &LSB, INT);
// Spark.variable("MSB", &MSB, INT);
#if USE_SERIAL == 1
Serial.begin(9600);
#endif
Wire.begin();
memset(tmp, 0, sizeof(tmp)/sizeof(*tmp));
}
void loop(){
celsius = getTemperature();
sprintf(tmp, "%.2f", celsius);
Spark.publish("c0-temperature", tmp, interval);
#if USE_SERIAL == 1
Serial.print("Celsius: ");
Serial.println(celsius);
#endif
delay(interval * 1000);
}
float getTemperature(){
Wire.requestFrom(tmp102Address,2);
MSB = Wire.read();
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;
}
@bko thanks for all the guidance on thisā¦really appreciate the help!
So I did some soldering tonight (attached a picture of a newbie soldering) and youāre right it seems to be working. Iāve setup the script to send every 30 seconds for testing purposes. So far so good - no 255.
One last question - do you have any suggestions on an affordable soldering setup? I picked one up at the local electronics place and it smokes badly and the handle heats up way too much!
I am so glad the TMP102 is working better for you! You did a nice job soldering too!
So I have Weller soldering gear but it is not what I would call affordable. There are soldering irons that have no temperature control (sounds like you have one of those) and irons where the temperature control is built-in to the tip of the iron and you change tips to change temps, and there are the irons I like where there is a just knob you turn to set the temp. The nicer ones start at around $100 and go up.
You can get an off-brand soldering iron like this one at Sparkfun for around $50:
Sparkfun also sells Hakkoās which are nice for around $100, but they are so popular they are often out of stock.
Sorry if itās not the main topic, but iām looking for a breakout (or a not-smd chip) for temp sensors with I2C, without internal pullups. Iāve already i2C devices (mcp23008, lcd display) with 4.7K pullups.
Theses chips a really tiny, and hand soldering is a nightmare.