Author Topic: Transfer laptop cpu temperature data to microcontroller  (Read 3884 times)

0 Members and 1 Guest are viewing this topic.

jenjen

  • Guest
Transfer laptop cpu temperature data to microcontroller
« on: March 15, 2014, 06:04:03 am »
Hey everyone. I'm planning to create a temperature controlled fan a.k.a laptop cooler for my school project. Initially, my group made it using LM35 to regulate the fan speed according to temperature surrounding. So I'm trying to modify this project by using the cpu temperature and then transfer the data to the microcontroller to regulate the fan speed. The problem is, is there any method on transferring the temperature data to the microC? I know there's gonna be some programming involve in transferring the data but I just don't know how to get the cpu data. I'll be glad if anyone could help me.  :)
« Last Edit: March 15, 2014, 07:27:07 am by jenjen »
 

Offline linux-works

  • Super Contributor
  • ***
  • Posts: 2060
  • Country: us
    • netstuff
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #1 on: March 15, 2014, 07:49:59 am »
how about serial?  on the pc, use some app or function to get the temperature and send it over a usb/serial link.  on the controller side, receive that serial packet and do your fan speed (pwm?) stuff.

Offline I_may_be_drunk_right_now

  • Contributor
  • Posts: 32
  • Country: ca
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #2 on: March 15, 2014, 02:12:01 pm »
Hey everyone. I'm planning to create a temperature controlled fan a.k.a laptop cooler for my school project. Initially, my group made it using LM35 to regulate the fan speed according to temperature surrounding. So I'm trying to modify this project by using the cpu temperature and then transfer the data to the microcontroller to regulate the fan speed. The problem is, is there any method on transferring the temperature data to the microC? I know there's gonna be some programming involve in transferring the data but I just don't know how to get the cpu data. I'll be glad if anyone could help me.  :)

http://en.wikipedia.org/wiki/SM_bus
 

Offline hans

  • Super Contributor
  • ***
  • Posts: 1695
  • Country: nl
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #3 on: March 15, 2014, 02:54:15 pm »
This sounds more like a software than a firmware problem. You need to find some piece of software that knows how to read out your PC sensors and make it available to you for further handling.

On Windows this can be a great hassle because everything is shut close. Some programs like coretemp or Speedfan may be able to read the CPU temp, but I am not sure whether they have a API/SDK/protocol that could make it available to your own program for further processing.
You could hack the values out of it with some ReadProcessMemory calls, given that you stick to the same software version.

On Linux its as easy as typing "sensors" in the terminal and you get the temperature & analog readouts for all I/O controllers that are configured/loaded by the kernel. For example, this the "sensors" readout on my desktop machine:
Code: [Select]
acpitz-virtual-0l
Adapter: Virtual device
temp1:        +27.8°C  (crit = +106.0°C)
temp2:        +29.8°C  (crit = +106.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +30.0°C  (high = +85.0°C, crit = +105.0°C)
Core 0:         +32.0°C  (high = +85.0°C, crit = +105.0°C)
Core 1:         +25.0°C  (high = +85.0°C, crit = +105.0°C)
Core 2:         +31.0°C  (high = +85.0°C, crit = +105.0°C)
Core 3:         +31.0°C  (high = +85.0°C, crit = +105.0°C)

nct6779-isa-0290
Adapter: ISA adapter
in0:                    +0.93 V  (min =  +0.00 V, max =  +1.74 V)
in1:                    +1.02 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in2:                    +3.34 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in3:                    +3.34 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in4:                    +1.03 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in5:                    +2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in6:                    +2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in7:                    +3.44 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in8:                    +3.30 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in9:                    +1.07 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in10:                   +2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in11:                   +2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in12:                   +0.26 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in13:                   +0.18 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
in14:                   +2.04 V  (min =  +0.00 V, max =  +0.00 V)  ALARM
fan1:                     0 RPM  (min =    0 RPM)
fan2:                   436 RPM  (min =    0 RPM)
fan3:                  1053 RPM  (min =    0 RPM)
fan4:                  1094 RPM  (min =    0 RPM)
fan5:                   518 RPM  (min =    0 RPM)
SYSTIN:                 +27.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = thermistor
CPUTIN:                 +28.5°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
AUXTIN0:                -63.0°C    sensor = thermistor
AUXTIN1:                -63.0°C    sensor = thermistor
AUXTIN2:                -63.0°C    sensor = thermistor
AUXTIN3:                -63.0°C    sensor = thermistor
PCH_CHIP_CPU_MAX_TEMP:   +0.0°C 
PCH_CHIP_TEMP:           +0.0°C 
PCH_CPU_TEMP:            +0.0°C 
PCH_MCH_TEMP:            +0.0°C 
intrusion0:            ALARM
intrusion1:            ALARM

pkg-temp-0-virtual-0
Adapter: Virtual device
temp1:        +32.0°C 

I have Asus P8Z77-V PRO motherboard, and Asus provides a fan control utility for Windows. It can control all fans connected on the motherboard by (a poor, always reading too low) CPU temperature readout.

On Linux there is alternative "fancontrol" utility, which lets you set up fan speeds to whatever temperature sensor you want.
Some sensors may be incorrect though, especially on the nct6779 I/O controller (which I had to manually load, wasn't auto detected/recognized).

You probably don't need all those I/O controllers, usually CPU temp is auto recognized and thus always available for readout. You can probably grab it each X seconds out of the sensors command, and send it to your micro which will adjust the fan speed accordingly.

I have doubts if SMbus is really useful in this, because you would have to hack into the motherboards somewhere and passively probe the bus hoping for the readings to pass by. I am not certain whether the internal CPU sensor also runs over SMbus.
« Last Edit: March 15, 2014, 02:56:10 pm by hans »
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #4 on: March 15, 2014, 03:17:52 pm »
Serial would be trivially easy, bluetooth might not be too bad either and would be more usable in the real world.  On Linux getting the CPU temp should be trivial as well with the "sensors" program described by hans.  Over serial it could literally be as easy as
Quote
stty -F /dev/ttyUSB0 57600 cs8 -cstopb -parenb
temp=$(/usr/bin/sensors | /usr/bin/grep "Physical id 0" | /usr/bin/awk -F+ '{print $2}' | /usr/bin/awk -F. '{print $1}')
echo $temp > /dev/ttyUSB0
running in a daemon or a regular cron job (modifying your serial port and awk/grep parsing of sensors as necessary).  Then the uC just needs to listen to the serial port to grab the temp whenever it comes across.

On Windows you might have to fight the OS to get the CPU temp (and fight it again if you want to use bluetooth).  Hopefully you're not using Windows.
 

jenjen

  • Guest
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #5 on: March 17, 2014, 11:42:24 am »
Oh no. Looks like this stuff sounds more complicated than I thought.... :( but I'm still trying to make it work.  I really appreciate all the replies though. Thanks everyone. :D
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6582
  • Country: nl
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #6 on: March 17, 2014, 12:18:17 pm »
If you are not able to get the core temperature directly from the OS you can let the uC measure it himself.
You can mechanically and thermally attach two temperature sensors to the coolplate of the CPU. Then you have to calculate the delta/difference between the average of your sensors and the actual CPU temperature from a program in a few cases for calibration. The only real challenge is then the feedback loop since the temperature of the coolingplate always lags on the temperature of the cpu  ;)
 

jenjen

  • Guest
Re: Transfer laptop cpu temperature data to microcontroller
« Reply #7 on: March 17, 2014, 02:25:21 pm »
If you are not able to get the core temperature directly from the OS you can let the uC measure it himself.
You can mechanically and thermally attach two temperature sensors to the coolplate of the CPU. Then you have to calculate the delta/difference between the average of your sensors and the actual CPU temperature from a program in a few cases for calibration. The only real challenge is then the feedback loop since the temperature of the coolingplate always lags on the temperature of the cpu  ;)

Yea I'm planning to work on that plan too if I can't get the core temp. I was just trying to do something different but it was just way more complicated than I imagined.  Thanks! :D
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf