Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 19, 2010, 12:40 PM   #1
johnnyham
macrumors regular
 
Join Date: Jun 2010
Temperature Sensor

Just curious, but is it possible to access the data from the temperature sensor in an iDevice? Clearly the OS itself can as it gives you an overheating warning, but I couldn't find any info on here or Google about whether or not it could actually be accessed from a user standpoint. I'm assuming that this isn't something Apple has released to the development community at large, but I just thought I'd ask. It'd be nice to develop an app that could actually detect the ambient temperature without relying on Internet data, which does nothing for you if you're indoors or out of service.
__________________
Mid 2009 white Macbook, 2.13Ghz C2D, 500GB HDD, 4GB RAM running OSX 10.7.1 and Win7 Ultimate; 8GB iPod Touch 2G with iOS 4; 16GB iPhone 4 w/iOS 5
johnnyham is offline   0 Reply With Quote
Old Aug 19, 2010, 01:32 PM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
1) The sensor does not detect ambient temperature: it detects CPU die temperature so it's useless for what you want

2) To the best of my knowledge that data is not available anyway
robbieduncan is offline   0 Reply With Quote
Old Aug 19, 2010, 08:15 PM   #3
johnnyham
Thread Starter
macrumors regular
 
Join Date: Jun 2010
Thanks, I wasn't sure if the temp sensor was a CPU sensor like the ones in Macbooks or if it was a sensor actually in the body of the iPhone. I'd seen it referenced as both in various places. Even then, you'd think that some fun math could possibly calculate an ambient temperature. Not my fort anyways I didn't think it was possible to begin with, but I suppose it's always something I can add to my "do this before getting my AARP card" list.
__________________
Mid 2009 white Macbook, 2.13Ghz C2D, 500GB HDD, 4GB RAM running OSX 10.7.1 and Win7 Ultimate; 8GB iPod Touch 2G with iOS 4; 16GB iPhone 4 w/iOS 5
johnnyham is offline   0 Reply With Quote
Old Aug 20, 2010, 03:55 AM   #4
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by johnnyham View Post
Even then, you'd think that some fun math could possibly calculate an ambient temperature.
I don't see how: the temperature reported is a function of how hard the device is working (and whether the battery is being charged). It does not seem likely you could extrapolate an ambient temperature from that.
robbieduncan is offline   0 Reply With Quote
Old Aug 20, 2010, 10:28 AM   #5
johnnyham
Thread Starter
macrumors regular
 
Join Date: Jun 2010
Quote:
Originally Posted by robbieduncan View Post
I don't see how: the temperature reported is a function of how hard the device is working (and whether the battery is being charged). It does not seem likely you could extrapolate an ambient temperature from that.
I was just thinking something more along the lines of getting the average temp of the CPU over a set amount of time, then figuring out some kind of average offset to output an ambient temperature. Wouldn't be terrifically accurate, but interesting nonetheless.

With some deeper Google scouring though, I haven't found anything about APIs for it, although I'm sure it's a private API that has yet to be discovered. Even if you can't get an ambient temperature, it would be nice for curiosity's sake to know what temperature the CPU is running at. One person over at StackOverflow mentions that there is a CTGetTemperature function in the CoreTelephony API, but I couldn't find any info on it.

I also found an app in the AppStore that gets a temperature reading from a DIY external sensor that plugs in to the headphone jack. Interesting, but not what I was looking for exactly. Maybe we'll see this API unveiled in the distant future...
__________________
Mid 2009 white Macbook, 2.13Ghz C2D, 500GB HDD, 4GB RAM running OSX 10.7.1 and Win7 Ultimate; 8GB iPod Touch 2G with iOS 4; 16GB iPhone 4 w/iOS 5
johnnyham is offline   0 Reply With Quote
Old Jan 27, 2012, 06:09 AM   #6
cnd
macrumors newbie
 
Join Date: Jan 2012
Quote:
Originally Posted by robbieduncan View Post
I don't see how: the temperature reported is a function of how hard the device is working (and whether the battery is being charged). It does not seem likely you could extrapolate an ambient temperature from that.
I disagree.

If my iPod always lives plugged in, beside my bed, every night - it's clearly going to correctly indicate a hotter morning if the temperature reads is higher today than it was yesterday...

Under OS/X, temps come from a thing called the "SMC" (system management controller). There's apparently a bunch of different ones. Like - dozens even; ( TB0T: +33.0C TB1T: +31.0C TB2T: +33.0C TC0D: +55.8C TC0P: +51.0C TCFP: +50.0C TH0P: +40.8C TN0D: +53.5C TN0P: +47.5C TN1D: +58.0C TN1d: +0.0C Th1H: +48.0C ThFH: +48.2C Ts0P: +30.2C Ts0S: +38.8C )

It's read like this:-

#define SMC_KEY_CPU_TEMP "TC0D"
SMCOpen();
temp = SMCGetTemperature(SMC_KEY_CPU_TEMP);

Since iOS grew out of OS/X, I would imagine the procedure on that is similar...
cnd is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
a1181 Temperature sensor drdyzio MacBook 0 May 6, 2014 06:23 PM
Late 2013 iMac cpu temperature sensor athinamj iMac 2 Apr 12, 2014 08:20 AM
LCD temperature sensor qwik3r iMac 2 Mar 22, 2014 03:33 PM
Macbook Pro CPU Temperature Sensor Error appleistheshiz MacBook Pro 16 Aug 28, 2013 02:16 PM
How to get around Broken LCD Temperature Sensor? Slow or stop FANS? meagain iMac 9 Aug 12, 2012 08:17 AM

Forum Jump

All times are GMT -5. The time now is 03:51 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC