gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Measuring temp and log to file?

#150721 - nerkle - Mon Feb 11, 2008 11:55 am

Hi

I read in this thread about using the touchscreen diode to measure temperature -- as a relative n00b and non coder -- does anyone know of homebrew that will record the temp to a file (on R4 / slot 1 - if that matters).

Thanks in advance.

Glen

#150739 - nipil - Mon Feb 11, 2008 8:07 pm

Sadly, i don't know any homebrew which does this. But here's a few hints anyway :
GBATEK has answers on where to read some temperature.
To save it to a file, simply load <fat.h>, call fatInitDefault(), link using -lfat, and use the standard stdio functions.
_________________
NDS Lite Gold/Silver, MK5/R4DS, MSI PC54G2, D-Link DI-624

#150741 - nipil - Mon Feb 11, 2008 8:29 pm

Besides, you may take a look here and here for infos on how to read the temperature.
_________________
NDS Lite Gold/Silver, MK5/R4DS, MSI PC54G2, D-Link DI-624

#150959 - nerkle - Sat Feb 16, 2008 1:39 am

Hi

Thanks for the pointers so far.

I have managed to create a small application that does some random math and outputs the results to a .csv file stored on the root directory of the flash card / R4. >> Not bad for never coding in C before and a testament to the help and support from this forum and the FAQ's out there.

All this has been made in on main.c file (I now realise is in Arm9).

I want to pull the temperature through (but this is only accessible from the Arm7 processor and is not available in Arm9).

The couple of places I can find reference to the internal temperature, code is added to an Arm7 source and "IPC" used to send the data to Arm9 (I think -- it is at this point that I reach for the beer)

I know I must be missing the point and should be able to find a demo file Arm7 and Arm9 sources, but it's late so HELP ;-)


N00b I know, but I try to be as self sufficient as I can.....

Glen
_________________
Why am I doing this?

#150960 - nerkle - Sat Feb 16, 2008 1:43 am

DOH!!

I guess I should build a new project based on the "combined" template from devitPro.

So how to I get the value from the Arm7 to Arm9?

Glen
_________________
Why am I doing this?

#150961 - Dwedit - Sat Feb 16, 2008 1:45 am

Has anyone extensively tested out the temperature feature to see how accurate it is?
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#150964 - nerkle - Sat Feb 16, 2008 2:00 am

Good point - but not a show stopper for me.

The "Big Picture" for me is to show how the NDS can be used as more than a games platfom, especially in schools.

The plan is to showcase recording:

1) Sound via the MIC
2) Temp via the internal diodes
3) Motion with the MotionPAK
4) Light, pH, temperature via external sensors attached to the spare inputs on the MotionPAK

My "problem" is that I am a high school physics teacher, not a coder, so I am finding this interesting but challenging.

I hate data loggers in the classroom as they literally "black box" what is going on and it hides too much from the students. In the past I have hooked sensors to a PC using 1-Wire technology and used the accelerometers / gyros in the Wii remote to measure gravity etc.

Then NDS is ideal as roughly 60% of the pupils will have one and if I can show technology being used for other things than game playing, then just maybe I can inspire some new scientists / coders...

So, if anyone is interesting in helping out with a project to achieve the above, I would love to hear from you all ;-) ;-)

Glen
_________________
Why am I doing this?

#150974 - dantheman - Sat Feb 16, 2008 6:59 am

Moonshell has a temperature reading area, doesn't it? In my experience, this value is somewhat accurate. However, if I hold select to make mp3 files speed up, using up 100% of the CPU, this reading increases a noticeable amount. I'm not a coder, so I don't know exactly what the temperature is a reading of, but my guess is that it's more of an internal processor temperature gauge. Perhaps the DS checks the temp to see if it's in a safe range during the power-on self-tests?

#150977 - nipil - Sat Feb 16, 2008 8:48 am

dantheman wrote:
if I hold select to make mp3 files speed up, using up 100% of the CPU, this reading increases a noticeable amount ... my guess is that it's more of an internal processor temperature gauge.

IMHO, it could simply be the heat created by the cpu that gets propagated to the surrounding area, ie the touchscreen ?
_________________
NDS Lite Gold/Silver, MK5/R4DS, MSI PC54G2, D-Link DI-624

#150991 - tepples - Sat Feb 16, 2008 2:43 pm

dantheman wrote:
I'm not a coder, so I don't know exactly what the temperature is a reading of, but my guess is that it's more of an internal processor temperature gauge. Perhaps the DS checks the temp to see if it's in a safe range during the power-on self-tests?

It's on the power management chip. As I understand it, other products using a similar power management chip use the temperature reading to make sure that the battery doesn't overheat.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#150997 - nerkle - Sat Feb 16, 2008 5:39 pm

Done it!

Managed to get the processors talking by using the IPC-> pointers. Currently after 5 mins "up my shirt" the temperature is 35.34'C (compared to my actual skin temperature of 34'C.

I am taking the diode voltages and converting to temperature using the posted formula. The voltage / temperature fluctuates constantly, so am going to put some sort of moving average / smoothing into the out put. OR only poll the sensors once every second or so.

Looking good so far.

Now to actually calibrate it....

Glen
_________________
Why am I doing this?

#153446 - MystBoy - Sun Mar 30, 2008 9:21 pm

to late^^
i've done the same thing today^^
i remembered this thread so if anyone need the surce... and my version has also a grafical output... if you need it tell me (via pm) and youll get the surce and the nds

mystboy

#153458 - HyperHacker - Mon Mar 31, 2008 1:38 am

I don't find the sensor very accurate. It's often as much as 10?C above or below the actual temperature. However being in my pocket probably has something to do with this, and GBATek mentions calibration, which I'm sure hasn't been done.
_________________
I'm a PSP hacker now, but I still <3 DS.