Transfer laptop cpu temperature data to microcontroller - Page 1
Forum section: electronics / general

author: Unknown
author_rank: Unknown
timestamp: March 15, 2014, 06:04:03 am
content: 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.

author: linux-works
author_rank: Super Contributor
timestamp: March 15, 2014, 07:49:59 am
content: 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.

author: I_may_be_drunk_right_now
author_rank: Contributor
timestamp: March 15, 2014, 02:12:01 pm
content: Quote from: jenjen on March 15, 2014, 06:04:03 amhttp://en.wikipedia.org/wiki/SM_bus

author: hans
author_rank: Super Contributor
timestamp: March 15, 2014, 02:54:15 pm
content: 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:acpitz-virtual-0lAdapter: Virtual devicetemp1: +27.8°C (crit = +106.0°C)temp2: +29.8°C (crit = +106.0°C)coretemp-isa-0000Adapter: ISA adapterPhysical 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-0290Adapter: ISA adapterin0: +0.93 V (min = +0.00 V, max = +1.74 V)in1: +1.02 V (min = +0.00 V, max = +0.00 V) ALARMin2: +3.34 V (min = +0.00 V, max = +0.00 V) ALARMin3: +3.34 V (min = +0.00 V, max = +0.00 V) ALARMin4: +1.03 V (min = +0.00 V, max = +0.00 V) ALARMin5: +2.04 V (min = +0.00 V, max = +0.00 V) ALARMin6: +2.04 V (min = +0.00 V, max = +0.00 V) ALARMin7: +3.44 V (min = +0.00 V, max = +0.00 V) ALARMin8: +3.30 V (min = +0.00 V, max = +0.00 V) ALARMin9: +1.07 V (min = +0.00 V, max = +0.00 V) ALARMin10: +2.04 V (min = +0.00 V, max = +0.00 V) ALARMin11: +2.04 V (min = +0.00 V, max = +0.00 V) ALARMin12: +0.26 V (min = +0.00 V, max = +0.00 V) ALARMin13: +0.18 V (min = +0.00 V, max = +0.00 V) ALARMin14: +2.04 V (min = +0.00 V, max = +0.00 V) ALARMfan1: 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 = thermistorCPUTIN: +28.5°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistorAUXTIN0: -63.0°C sensor = thermistorAUXTIN1: -63.0°C sensor = thermistorAUXTIN2: -63.0°C sensor = thermistorAUXTIN3: -63.0°C sensor = thermistorPCH_CHIP_CPU_MAX_TEMP: +0.0°CPCH_CHIP_TEMP: +0.0°CPCH_CPU_TEMP: +0.0°CPCH_MCH_TEMP: +0.0°Cintrusion0: ALARMintrusion1: ALARMpkg-temp-0-virtual-0Adapter: Virtual devicetemp1: +32.0°CI 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.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: March 15, 2014, 03:17:52 pm
content: 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 asQuoterunning 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.

author: Unknown
author_rank: Unknown
timestamp: March 17, 2014, 11:42:24 am
content: 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.

author: Kjelt
author_rank: Super Contributor
timestamp: March 17, 2014, 12:18:17 pm
content: 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

author: Unknown
author_rank: Unknown
timestamp: March 17, 2014, 02:25:21 pm
content: Quote from: Kjelt on March 17, 2014, 12:18:17 pmYea 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!