Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Jetson Nano: Leverage PWM Fan #30

Open
adumont opened this issue Apr 25, 2020 · 7 comments
Open

Jetson Nano: Leverage PWM Fan #30

adumont opened this issue Apr 25, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@adumont
Copy link

adumont commented Apr 25, 2020

It's recommended to use a PWM fan (like the Noctua nf-a4x20 5V PWM fan) with the Jetson Nano board to avoid damaging it under normal operation (especially if used for long period of time, like rosetta-at-home).

Having a PWM fan is of course optional, but when we have one, it'd be best to leverage it to keep the board cooler if possible.

In the case of balenaOS on the nano, I noticed at the momento it doesn't seem to activate the PWM fan (tested yesterday, FAN didn't run at all, not even slowly).

Some software logic need to be used to adjust the fan speed.

On one hand, the temperature of the board can be read via software (just open and read value from /sys/devices/virtual/thermal/thermal_zone0/temp).

On the other hand the PWM fan speed can be adjusted by software by writing an int between 0 (low speed) and 255 (full speed) to /sys/devices/pwm-fan/target_pwm.

For example, if temp is below 20ºC, keep at speed 0, if temp > 50ºC , keep at full speed (255). Between 20 and 50, map/ramp up speed from 0 to 255. See example code here (https://github.com/Pyrestone/jetson-fan-ctl/blob/master/fanctl.py).

PS: I didn't find any way to access the balenaOS with SSH so I couldn't try this below. But it should be doable as it works fine in Linux with the official Nvidia image (meaning that the linux kernel exposes the necesarry API to read/write the temp sensor and the PWM fan speed).

More info:

If you give me instructions to enter the balenaOS via SSH for example and test command, don't hesitate to contact me (here or email)

@adolfogc
Copy link

adolfogc commented Apr 25, 2020

Hi @adumont,

You can gain access to a shell by using the web interface:

image

For example:

image

I noticed the power-management container exits in the case of the Jetson Nano, perhaps its Docker image can be modified to check the board is a Nano and run something like this script: https://github.com/Pyrestone/jetson-fan-ctl/blob/master/fanctl.py ?

Edit: add this additional reference that could be usefule: https://gist.github.com/bgulla/5d7afdb6575e8ef0260b7ab0507b014b

@chrisys
Copy link
Member

chrisys commented Apr 26, 2020

Hi guys, we did close this issue the other day which sets the fan on the Nano to run at 100%: #26 but this hasn't been deployed to the foldforcovid.io fleet yet.

Deploying your device and app manually via balenaCloud as @adolfogc points out is one way to gain access to the device; when you join the app via foldforcovid.io the devices are in a secure production mode so don't have open SSH. If you deploy via the dashboard you can use a development version of the OS which has open SSH.

@adumont
Copy link
Author

adumont commented Apr 26, 2020 via email

@chrisys
Copy link
Member

chrisys commented Apr 26, 2020

@adumont agree, and we'd welcome a PR that adds this, I was merely pointing out that it had at least been enabled in a recent update.

@chrisys chrisys added the enhancement New feature or request label Apr 26, 2020
@adolfogc
Copy link

@chrisys Thanks for the info., I wasn't aware of that. I'm running directly the master branch (using Balena CLI), but I don't yet have a fan to test. One question: the environment variable your script uses to check the device type must be added manually or is this set automatically by Balena OS?

@chrisys
Copy link
Member

chrisys commented Apr 27, 2020

@adolfogc that one is automatically set by the OS 👍 I didn't actually have a fan either but managed to find one in the attic on an old i5 CPU cooler!

@ptrm
Copy link
Contributor

ptrm commented Apr 28, 2020

IMHO the fan shouldn't be activated at full speed all the time. It's
precisely a PWM fan.

https://github.com/Pyrestone/jetson-fan-ctl – should be as simple as running in start.sh instead of writing to sysfs. Python3 is onboard the boinc-client service for some reason or other 😁

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants