fr4m3s
Posts: 2
Joined: Mon Sep 05, 2016 3:55 pm

Need help with Pi3 temperature management

Tue Dec 27, 2016 5:21 pm

First of all, I am not aware of how to monitor the Pi3's temperature in real-time. so far I've been using the following command:

Code: Select all

/opt/vc/bin/vcgencmd measure_temp
For some reason, my Pi3 idles around 58 degrees celcius (low 60s when doing some browsing and minor tasks). I thought this to be odd because for one, I am not overclocking, nor is my home very hot. I keep it between 70-75 F in my house and the Pi is in an open space with heatsinks attached.

I've noticed when I am watching YouTube videos (via Iceweasel, if that matters) in 1080p (even when not in full screen) the Pi3 temp jumps to over 82 degrees celcius. I am using a 49" Samsung 4K TV as my display; could this be pushing the Pi3 to idle so high and begin to overheat when streaming YouTube videos?

I watched a video of someone testing their Pi3 running Quake 3. They did not use heatsinks in the beginning of the test. Running Quake 3 for extended periods of time only pushed the temp to 79 degrees C. I am not sure how to measure legacy graphics in a fps game vs. 1080 video on YouTube but those results peaked my interest. He got it down to 75 degrees C with a "cheap 1 dollar heatsink". I am using the heatsinks that came with the Pi3 Canakit (from Amazon) which did have some thermal paste included.

So my question is, does something seem off with my temperatures? I am tempted to remove the heatsinks and re-apply arctic silver but I'm afraid of damaging the unit somehow when attempting to remove the (possibly well-stuck) heatsinks from the chips.

Are there any popular cooling solutions for the Pi3 currently in circulation? Thanks for any help/advice/comments that can be provided :mrgreen:

User avatar
DougieLawson
Posts: 34167
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Need help with Pi3 temperature management

Tue Dec 27, 2016 8:43 pm

You can ignore the RPi temp until it reaches 85°C (185°F) at which point it will throttle back until the temp reduces.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

ag123
Posts: 11
Joined: Sun Dec 18, 2016 7:54 am

Re: Need help with Pi3 temperature management

Wed Jan 04, 2017 12:46 pm

there are many threads and articles about the 'fire breathing pi 3' :lol:
http://makezine.com/2016/03/02/raspberr ... atch-fire/

accordingly 80 degrees from
/opt/vc/bin/vcgencmd measure_temp
may literally be 100 deg C measured on the surface

here is what i'm doing,
viewtopic.php?f=63&t=144391&p=1085201#p1085201
in the same thread other user contributed their solution
viewtopic.php?f=63&t=144391
^^^ i think this other user did a better solution than mine by using a much better heat sink and a large fan

simply having a heatsink delays the temperature rise but if the heat is not removed temperature may keep rising until the cpu throttles back

to remove all that heat, in addition to a good heat sink, a fan is needed
if it is enclosed in a box, you may even need to design in a high volume air flow to be sure that the heated air is ejected out of the box

imho, i'd rather have the current good performing but hot running pi 3 than have a slow cpu & there's the fun to try to cool it down with all that cpu cooling hacks, it's probably very much the fun similar to overclocking :lol:

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Need help with Pi3 temperature management

Wed Jan 04, 2017 1:26 pm

Hi, you can read my solution for similar situation.
I buy heat sinks and fan for 5V from ebay.
Then I create a Python script that measure CPU temp and if it raises to xy degrees then it starts fan.
When fall to xz °C then stop cooling.
You will need to put some electronic in there to prevent GPIO from burning. It is done with transistor and resistor. Transistor is switch that receive GPIO signal and then switch 5V from Raspberry Pi to FAN..
This is post about how to do that but in °C not in F:
viewtopic.php?f=63&t=152700&p=1000845&h ... n#p1000845
and script is running on reboot or starting Raspberry Pi:

Code: Select all

    #!/usr/bin/python

    import sys
    import time
    import datetime
    import subprocess
    import RPi.GPIO as GPIO

    FAN_PIN      = 23 #GPIO23 = PIN16
    TEMP_HIGH    = 70
    TEMP_LOW     = 48
    SLEEP_SEC    = 1 # sleep for loop
    LIMIT_SEC    = 220 #seconds

    COUNTER      = 0
    IS_FAN_ON    = 0
    CNT          = 0
    current_date = datetime.datetime.now()
    TMP_TEMP     = 0

    def GPIOsetup():
            print str(current_date)
            print "INITIALIZING..."
            GPIO.setwarnings(False)
            GPIO.setmode(GPIO.BCM)
            GPIO.setup(FAN_PIN, GPIO.OUT)
            print "SETTING FAN..."
            fanOFF()
            print "---------------"
           
    def fanON():
            GPIO.output(FAN_PIN, 1) #fan on
            print "FAN ON..."
           
    def fanOFF():
            GPIO.output(FAN_PIN, 0) #fan off
            print " "
            print "FAN OFF."

    GPIOsetup()

    while True:
            try:
                    CNT += 1

                    if CNT == 1000000:
                            CNT = 0
                   
                    temperature_int = float(subprocess.check_output(["/opt/vc/bin/vcgencmd","measure_temp"]).replace("temp=","").replace("'C",""))

                    if temperature_int > TMP_TEMP:
                            TMP_TEMP = temperature_int
                            current_date = datetime.datetime.now()
                            print "Max.temp. = "+str(temperature_int)+" - "+str(current_date)
                   
                    if temperature_int >= TEMP_HIGH:
                            if IS_FAN_ON == 0:
                                    #Start cooling fan
                                    if COUNTER == 0:
                                            COUNTER = 1
                                           
                                    print str(COUNTER)
                                    current_date = datetime.datetime.now()
                                    print str(current_date)
                                    print str(temperature_int)
                                    fanON()
                                    IS_FAN_ON = 1
                                    CNT = 1
                                    COUNTER += 1
                                    print "---------------"
                    else:
                            if temperature_int <= TEMP_LOW:
                                    if IS_FAN_ON == 1:
                                            current_date = datetime.datetime.now()
                                            print "---------------"
                                            print str(current_date)
                                            fanOFF()
                                            IS_FAN_ON = 0
                                            CNT = 1
                                            print "Temperature: " + str(temperature_int)+" - "+str(current_date)
                                            print "---------------"
                                           
                    #If FAN is ON for a while then set FAN OFF
                    if  CNT%LIMIT_SEC == 0:
                        if IS_FAN_ON == 1:
                            current_date = datetime.datetime.now()
                            print str(current_date)
                            fanOFF()
                            IS_FAN_ON = 0
                            CNT = 1
                            print "FAN sets OFF after continuous running!"
                            print "Temperature: " + str(temperature_int)+" - "+str(current_date)
                            print "----------------------------------------"
                           
                    time.sleep(SLEEP_SEC)

            except KeyboardInterrupt:
                    print " Quit"
                    GPIO.output(FAN_PIN,0)
                    GPIO.cleanup()       
            except Exception as e:
                    print "ERROR: ", sys.exc_info()
                    GPIO.output(FAN_PIN,0)
                    fanOFF()
                    GPIO.output(FAN_PIN,0)
                    GPIO.cleanup()
            except:
                    print " Quit from except!"
                    GPIO.output(FAN_PIN,0)
                    GPIO.cleanup()

    print " Quit from end!"
    GPIO.output(FAN_PIN,0)
    GPIO.cleanup()
Here is the sheme:
rpi_motor_only_1.jpg
rpi_motor_only_1.jpg (52.9 KiB) Viewed 2405 times
You have to Buy flyback diode 1N4001 and put it like in shema to prevent returning current to overburn GPIO...

ElEscalador
Posts: 621
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: Need help with Pi3 temperature management

Wed Jan 04, 2017 1:43 pm

I have two that do overheat and throttle - possibly worse than throttling is they start to drop their wifi connection when hot (mostly happens because I'm using one to VNC into the other running heavy programs). I didn't want to sacrifice GPIO pins because they are needed for other things, so I bought a digispark microcontroller for $2 and am using that to pwm/control fan speed with a temperature sensor stuck to the heat sink. On/off bothers me - I'm not sure the rapid cooling is bad for the PI, but I'm not sure it's good for it either - I prefer to maintain a tighter, gentler temperature control.
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

ag123
Posts: 11
Joined: Sun Dec 18, 2016 7:54 am

Re: Need help with Pi3 temperature management

Wed Jan 04, 2017 2:03 pm

pi 3 is fun because u don't really need to overclock it, it is pushed to the performance limits (similar to overclocked) & u'd just need to find the solution to cool it down :lol:

aislanmds
Posts: 2
Joined: Sun Oct 14, 2018 7:41 pm

Re: Need help with Pi3 temperature management

Sun Oct 14, 2018 7:45 pm

Faramon,

I'd like to use your script and make an equal system to cool my pi. I want to know if I can use a relay module in place of the transistor. In this way, the GPIO port activates the relay allowing power to the fan.

Thanks!

faramon wrote:
Wed Jan 04, 2017 1:26 pm
Hi, you can read my solution for similar situation.
I buy heat sinks and fan for 5V from ebay.
Then I create a Python script that measure CPU temp and if it raises to xy degrees then it starts fan.
When fall to xz °C then stop cooling.
You will need to put some electronic in there to prevent GPIO from burning. It is done with transistor and resistor. Transistor is switch that receive GPIO signal and then switch 5V from Raspberry Pi to FAN..
This is post about how to do that but in °C not in F:
https://www.raspberrypi.org/forums/view ... n#p1000845
and script is running on reboot or starting Raspberry Pi:

Code: Select all

    #!/usr/bin/python

    import sys
    import time
    import datetime
    import subprocess
    import RPi.GPIO as GPIO

    FAN_PIN      = 23 #GPIO23 = PIN16
    TEMP_HIGH    = 70
    TEMP_LOW     = 48
    SLEEP_SEC    = 1 # sleep for loop
    LIMIT_SEC    = 220 #seconds

    COUNTER      = 0
    IS_FAN_ON    = 0
    CNT          = 0
    current_date = datetime.datetime.now()
    TMP_TEMP     = 0

    def GPIOsetup():
            print str(current_date)
            print "INITIALIZING..."
            GPIO.setwarnings(False)
            GPIO.setmode(GPIO.BCM)
            GPIO.setup(FAN_PIN, GPIO.OUT)
            print "SETTING FAN..."
            fanOFF()
            print "---------------"
           
    def fanON():
            GPIO.output(FAN_PIN, 1) #fan on
            print "FAN ON..."
           
    def fanOFF():
            GPIO.output(FAN_PIN, 0) #fan off
            print " "
            print "FAN OFF."

    GPIOsetup()

    while True:
            try:
                    CNT += 1

                    if CNT == 1000000:
                            CNT = 0
                   
                    temperature_int = float(subprocess.check_output(["/opt/vc/bin/vcgencmd","measure_temp"]).replace("temp=","").replace("'C",""))

                    if temperature_int > TMP_TEMP:
                            TMP_TEMP = temperature_int
                            current_date = datetime.datetime.now()
                            print "Max.temp. = "+str(temperature_int)+" - "+str(current_date)
                   
                    if temperature_int >= TEMP_HIGH:
                            if IS_FAN_ON == 0:
                                    #Start cooling fan
                                    if COUNTER == 0:
                                            COUNTER = 1
                                           
                                    print str(COUNTER)
                                    current_date = datetime.datetime.now()
                                    print str(current_date)
                                    print str(temperature_int)
                                    fanON()
                                    IS_FAN_ON = 1
                                    CNT = 1
                                    COUNTER += 1
                                    print "---------------"
                    else:
                            if temperature_int <= TEMP_LOW:
                                    if IS_FAN_ON == 1:
                                            current_date = datetime.datetime.now()
                                            print "---------------"
                                            print str(current_date)
                                            fanOFF()
                                            IS_FAN_ON = 0
                                            CNT = 1
                                            print "Temperature: " + str(temperature_int)+" - "+str(current_date)
                                            print "---------------"
                                           
                    #If FAN is ON for a while then set FAN OFF
                    if  CNT%LIMIT_SEC == 0:
                        if IS_FAN_ON == 1:
                            current_date = datetime.datetime.now()
                            print str(current_date)
                            fanOFF()
                            IS_FAN_ON = 0
                            CNT = 1
                            print "FAN sets OFF after continuous running!"
                            print "Temperature: " + str(temperature_int)+" - "+str(current_date)
                            print "----------------------------------------"
                           
                    time.sleep(SLEEP_SEC)

            except KeyboardInterrupt:
                    print " Quit"
                    GPIO.output(FAN_PIN,0)
                    GPIO.cleanup()       
            except Exception as e:
                    print "ERROR: ", sys.exc_info()
                    GPIO.output(FAN_PIN,0)
                    fanOFF()
                    GPIO.output(FAN_PIN,0)
                    GPIO.cleanup()
            except:
                    print " Quit from except!"
                    GPIO.output(FAN_PIN,0)
                    GPIO.cleanup()

    print " Quit from end!"
    GPIO.output(FAN_PIN,0)
    GPIO.cleanup()
Here is the sheme:
rpi_motor_only_1.jpg
You have to Buy flyback diode 1N4001 and put it like in shema to prevent returning current to overburn GPIO...

User avatar
faramon
Posts: 123
Joined: Sat Jun 11, 2016 8:36 am
Location: Croatia

Re: Need help with Pi3 temperature management

Mon Oct 15, 2018 9:34 am

Hi, you can use relay if you connect FAN direct to 5V source through relay, I do not see the problem.
But do not connect FAN to GPIO directly...

Faramon

User avatar
davidcoton
Posts: 3206
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Need help with Pi3 temperature management

Mon Oct 15, 2018 4:18 pm

aislanmds wrote:
Sun Oct 14, 2018 7:45 pm
I want to know if I can use a relay module in place of the transistor. In this way, the GPIO port activates the relay allowing power to the fan.
Are you using a ready-built Pi-compatible relay board, or a bare relay? A relay by itself probably won't work from the GPIO, it will need a transistor to drive it. At that point the relay is unnecessary because you can choose a transistor that will drive the fan directly.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

User avatar
Imperf3kt
Posts: 1383
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Need help with Pi3 temperature management

Mon Oct 15, 2018 8:16 pm

You don't need a transistor to control the relay, you can use a regular SPDT switch.

You lose the automated part of the process, but it does the same trick.
Stop plugging your fan directly into the GPIO 5v
https://www.electronics-tutorials.ws/power/transient-suppression.html

User avatar
davidcoton
Posts: 3206
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Need help with Pi3 temperature management

Mon Oct 15, 2018 8:40 pm

Imperf3kt wrote:
Mon Oct 15, 2018 8:16 pm
You don't need a transistor to control the relay, you can use a regular SPDT switch.

You lose the automated part of the process, but it does the same trick.
But if you use a switch, so it is a manual process, you don't need a relay. The switch can control the fan directly.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

User avatar
Imperf3kt
Posts: 1383
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Need help with Pi3 temperature management

Mon Oct 15, 2018 8:59 pm

davidcoton wrote:
Mon Oct 15, 2018 8:40 pm
Imperf3kt wrote:
Mon Oct 15, 2018 8:16 pm
You don't need a transistor to control the relay, you can use a regular SPDT switch.

You lose the automated part of the process, but it does the same trick.
But if you use a switch, so it is a manual process, you don't need a relay. The switch can control the fan directly.
Though of that one also, but only after I had posted xD
Just get a transistor, they're cheap if you buy in bulk. Ebay usually has packs of ten for a few bucks including postage.

Make sure to use one that can handle the current.
For example, I use a fan on one project that draws 150mA, so I switch it using a 2N2222 transistor, capable of switching 200mA
Stop plugging your fan directly into the GPIO 5v
https://www.electronics-tutorials.ws/power/transient-suppression.html

LTolledo
Posts: 736
Joined: Sat Mar 17, 2018 7:29 am

Re: Need help with Pi3 temperature management

Mon Oct 15, 2018 9:27 pm

Ok here's my take on your problem:

1. To monitor RPi's temperature in real time in Raspbian Stretch with desktop, enable the temperature monitor plugin to the top right panel
  • a. right click on the top right panel
    b. on the "Panel Preferences" window select "Panel Applets" tab
    c. click on the "Add" button
    d. in the "Add plugin to panel" scroll down and select "Temperature Monitor" and click the "Add" button.
    e. use the "Up" or "Down" button to position the plugin to your desired position.
2. To bring down the temperature, attach heatsink and fan
  • a. am using bigger heatink 20x20x6 heatsink, attached using thermal paste (not the double sided thermal tape)
    b. fan power source is tapped from the 5v microUSB port (not on the 40-pin GPIO, thereby by-passing RPi's internal power circuits). the fan is always ON when there is power from the microUSB cable. No need for "fancy" control circuits for the fan.
on this RPi3B+ am using now to post to this forum, the temperature reads 37C at an ambient of 27C. The highest temperature attained was 45C at an ambient of 33C.

this is the same solution that I applied on my RPi3B that this RPi3B+ replaced. its reading 39C at an ambient of 27, and the heatsink is still attached using a double sided thermal tape on that one. Will change to thermal paste later in the month.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Return to “General discussion”