Jump to content

Recommended Posts

Hey all,


I'm relatively new to all this and I have been trying to get a temperature sensor to work with the launchpad. As in my previous posts I was trying for the DS18b20. I have the port of the code project on the back burner because there is a hell of a lot I need to learn to be able to port that over.


So just to get something off the ground I have been trying to use the LM35 to read some temps.


Here is the code I'm running


float tempC;

float tempF;


void setup()





void loop()


tempC = analogRead(6); //read the value from the sensor hooked up to pin 6

tempC = (3.3 * tempC * 100.0)/1024.0; //convert the analog data to temperature (Assuming 10bit ADC and 3.3v ref voltage

I suspect this is where I'm screwing up)

tempF = ((9.0*tempC)/5.0)+32.0;








The issue is that It is showing very high values. Like the order of 178 c?

I also tried chaning the tempC calculation to


tempC = (tempC*100.0)/1024.0


It gets closer but still not quite.


(I'm monitoring through the serial monitor and I have not made any changes to the jumper position to my 1.4 board)



Any and all help is appreciated.





Link to post
Share on other sites

After a bit of digging I have found 2 issues.


The LM35 needs a minimum of 4V so I dont think the rail is waking it up.


Also the chip I have does not have a proper Hardware UART setup, so I think I am going to have to switch up to a the G2553. Any thoughts?







Alex J

Link to post
Share on other sites

I've already seen that and it is what I have been using, what I think the issue is, is that the G2452 does not have an onboard UART. I am hoping that someone can confirm or deny.


That's correct. The serial port is managed by the software UART TimerSerial library. See an example at https://github.com/energia/Energia/blob/master/examples/4.Communication/Serial_430/Serial_430.ino

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.

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...