Jump to content
43oh

LM75A temperature sensor on Energia


Recommended Posts

Hi everybody,

 

I have ordered some lm75a sensors from eBay and after careful SMD soldering on a SOIC to DIP converter, I am trying to get these sensors to work with the Launchpad and Energia. Somehow this is more difficult than expected (especially after connecting a RTC chip and a light sensor with ease).

 

Has anyone tried to get these sensors to work with the Launchpad? What kind of pullups are needed? Does anyone have example code?

 

And finally I tried this on the new release of Energia, has anything changed with the I2C code?

 

Kind regards,

 

Eelco Rouw 

Link to post
Share on other sites

Thank you!

 

I tried it with 2K2 and will try it with 10K, see if it's working. Do you have any code by any chance that is verified to work? 

 

Is the Wire library bug free at this moment (I know that there were some issues with the older Energia release).

 

Kind regards, 

 

Eelco

Link to post
Share on other sites

Yes I did, but somehow I couldn't get the sensor to work. I've tried three different pieces of code. I thought there would be much more on this sensor and Arduino, but information seems to be pretty scarce. I am going to look into the resistor issue, it might help to swap the resistors of 2k2 to 10K. See if that helps!

 

Thanks!

 

Kind regards,

 

Eelco

Link to post
Share on other sites

Okay,

 

Swapped the resistors and chose a sketch.

// Using the LM75A for watching temp in serial monitor// This code uses the Wire library which comes along with Arduino language// by GHoSt// started at 2008/01/12// finished at 2008/01/13#include <Wire.h>void setup(){Wire.begin(); // join i2c bus as master (no address)Serial.begin(9600); // start serial for output in serial monitor (or somewhere else...)}void loop(){int c[2]; // array for two temp bytesint x=1; // counter for array (msb is send first)int check; // var for looking if temp is + or - (Bit 11)long temp; // var contains tempdata for easy reading by human beings Wire.requestFrom(72, 2); // request 2 bytes from slave device #72while (Wire.available()) { // get the two bytesc[x] = Wire.read();x--;}c[0]=c[0]&224; // "forget" all bits except the 3 left bitsc[0]=c[0]>>5; // shift these 5 bits for the right valuecheck=c[1]&256; // logical and for checking bit 8 if its 1 or 0if (check==0) {temp=(c[1]*8 + c[0]) * 0.125; // c[1] * 8, 'cause first bit isn't 1, but 8, second 16 and so on, a value of 1 is 0.125
Link to post
Share on other sites

Maaaaaaan, I feel stupid!

 

I really really didn't want to blame my soldering skills. I've received an Aoyue reworking station yesterday and thought that the SOIC to DIP conversion was impeccable ;-)

 

However, when I used the Raspberry Pi to scan the I2C bus, no response from the temp sensors at all...but one...

 

Fired up my reworking station and applied some additional soldering paste and voila! It now works!

 

Feel downright stupid now, but I am happy that it works ;-)

 

KInd regards, Eelco

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...