NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Modified Tempsensor Program!!!!

June 21, 2009
by dylanjkj1997
dylanjkj1997's Avatar

OK, I got my variation of the temperature sensor program done, thanks to the help of you guys and the Nerdkits staff! There is a video here.

Two questions:

  1. It seems that the more current or voltage drawn away, (say, from LEDs, the lcd backlight, and other power consuming stuff)the higher the temperature. This is a problem because when I have the backlight on or the batteries are getting low, (I know I shouldn't use a backlight on batteries, but I'm using rechargables and the are no 120v. outlets on my robot)the temperature goes up.

  2. How can I graph the temperature? I see graphs on some nerdkits videos and I've seen a pice of code that outputs temperature via the serial port but I don't know how to read it via my computer. BTW I'm running Vista (Thank god Windows Seven is coming out!!!)

June 21, 2009
by mcai8sh4
mcai8sh4's Avatar

Hi dylan, I saw the temperature increasing when the battery was low (or if there was a lot of load on it).

I put this down to (and someone will correct me if I'm wrong) the ADC compares the voltage from the sensor with the voltage from the +5 rail.

If the rail voltage alters (or is low) then the comparison is different, thus giving a false reading for the temperature.

To graph the temperature (I've just played with this), check out the meat thermometer program, included with the code is a python script that does the graphing for you. You can use the meat thermometer program with the standard temp sensor circuit and then run the pc-pygame.py program to graph the results.

There may be some tweaking needed to get everything to how you want it, but the basics are there (I call them the basics but I dont really understand them).

Hope this helps.

June 21, 2009
by mcai8sh4
mcai8sh4's Avatar

BTW - nice video. I like the idea of having a temperature scale based around room temperature, nice touch.

Keep making the vids!

June 21, 2009
by dylanjkj1997
dylanjkj1997's Avatar

Thanks Mcai8sh4, I'll try the graph on the meatsensor program. Also, about the temperature sensor, can I run a seperate battery on it? Or does it have to be the same one? Thanks for your help, I really appreciate it :)

July 13, 2009
by dylanjkj1997
dylanjkj1997's Avatar

How do I run the python script? And will the python show the graph or do I have to download a program to do that? Please help! Thanks.

July 13, 2009
by mcai8sh4
mcai8sh4's Avatar

Hi Dylan, the python script needs to be 'interpreted' by python. Go get it to run you must download and install python (I assume you are using windows) you can get it from HERE I think the process is quite simple, but I don't use Win so I'm not sure on the details.

For it to run I imagine that you need the libraries that it uses - these are the import lines at the top of the program, ie.

import threading
import time
import serial
import sys
import pygame

once these are installed on your machine, I think it should all work. Like I mentioned, I haven't used python on windows so I'm not sure on the details, but I hope this points you in the right direction.

July 13, 2009
by dylanjkj1997
dylanjkj1997's Avatar

There are millions of pythons! Which one should I use?

July 14, 2009
by mcai8sh4
mcai8sh4's Avatar

I have verion 2.5.2 installed, but the recommended current version seems to be 2.6

The windows version can be downloaded from here : Python2.6.2 (32bit version)

I haven't tried this on windows, so maybe somone else with more experiance could help better.

If I was installing it on windows, thats the one I'd go for.

July 14, 2009
by dylanjkj1997
dylanjkj1997's Avatar

I downloaded it, but what do I have to open and what do I have to do?

July 14, 2009
by mcai8sh4
mcai8sh4's Avatar

I'm just guessing here (I've not done this). Try double clicking the .msi file. That should install python onto your machine. After that test it's ok with something along the lines of

pyhton --version

if you don't get any errors then python in installed correctly.

Then comes the bit I can't help you with - downloading and installing the import files mentioned before. I'm not sure if everything will run ok on windows (I've never used python on win).

Hopefully someone who has a little more experience than me will be able to step in and assist you further if you still get stuck.

Best of luck, keep us all posted on how you get on (and if you get it working, maybe tell us all how you did it)

July 15, 2009
by dylanjkj1997
dylanjkj1997's Avatar

Maybe I should E-mail support. The mac version sounds a bit different. When I download it I get two main files. Python (command line) and IDLE (Python GUI). If nobody knows how to do it on windows, then I'll ask support.

August 05, 2009
by pbfy0
pbfy0's Avatar

I think you need the PySerial module to connect to the nerdkit with python. here are download links: win version other OSs . this should help if you get an error about importing serial.

Post a Reply

Please log in to post a reply.

Did you know that signed numbers need to be sign-extended when chaging variable sizes? Learn more...