Jetson Nano-PWM自动调速
由于Nano散热差时,会造成宕机等问题,所以必须配上风扇,PWM最佳
手动设置
PWM范围:0 - 255
最小0即不转,255为最大转速
sudo sh -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'
运行后,若风扇引脚正确,则此时风扇会以最大速度运行
自动调速
- 编写自动运行的py文件
#!/usr/bin/env python
import os
# import commands# from the path of this pattern
path = '/sys/kernel/debug/soctherm/{dev}/temp'
# get the temperature from following sensors
dev = ['cpu', 'gpu', 'mem', 'pll']
# the fan PWM factor is 0 ~ 255, make 10 as the min, 255 as the max
# the fan speed will be sliding from 10% ~ 100% according to the temperature
# the greater, the cooler yet noisier, this script will balance it
MIN=80
MAX=255
RANGE=MAX-MIN
# the target file to write PWM factor to control the fan speed
TARGET_PWM = '/sys/devices/pwm-fan/target_pwm'# defined the lowest temperature (Celsius), fan speed at MIN if temp lower then this
LOWEST=38.0
# defined the highest temperature (Celsius), fan speed at MAX if temp higher then this
HIGHEST=60.0
# the temp at range between HIGHEST and LOWEST, the fan speed is auto ajusted
# to balance the cool and the quiet
TMP_RANGE=HIGHEST-LOWESTdef getTmpFromFile(p):'''get temp value in Celsius from a file'''with open(p, 'r') as f:x = f.read()y = int(x)/1000.0return ydef getSpeedByTemp(temp):'''calculate a fan speed pwm factor from a temperature in Celsius'''if temp<=LOWEST-5:return 0if temp<=LOWEST:return MINif temp>=HIGHEST:return MAXrate = (temp-LOWEST)/TMP_RANGEreturn MIN+int(RANGE*rate) if rate<1.0 else MAXdef setSpeed(pwm):'''write target PWM factor to the target file to set fan speed'''with open(TARGET_PWM, 'w') as f:f.write(str(pwm))# get max temperature from all sensors
max_temp = max(map(getTmpFromFile, map(lambda x: path.format(dev=x), dev)))
print(max_temp)
# calculate the target fan pwm factor
target_speed = getSpeedByTemp(max_temp)
print(target_speed)
# set to target file to take effect
setSpeed(target_speed)
- 开机自启,编写/etc/rc.local文件如下
#!/bin/bash
sudo /usr/bin/jetson_clocks
nohup sudo watch -n 20 '/usr/bin/python /root/adj_fan_pwm.py > /tmp/fan_pwm_log.log' &
即每20秒运行一次,其中/root/adj_fan_pwm.py 记为上面到py文件,并将运行的log保存到/tmp/fan_pwm_log.log
实时观察状态:jtop
- 创建rc-local.service文件
sudo vi /etc/systemd/system/rc-local.service
- 复制以下内容到rc-local.service文件
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99[Install]
WantedBy=multi-user.target
- 设置rc.local的权限
sudo chmod +x /etc/rc.local
- 启动服务
sudo systemctl enable rc-local
- 开启服务和查看状态
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
Jetson Nano-PWM自动调速相关推荐
- jetson nano 风扇自动调速
jetson nano 风扇自动调速 概述 一.临时调试 二.驱动脚本 概述 jetson nano一定要配一个可调风扇,jetson nano散热不好极容易死机!! 一.临时调试 PWM范围:0-2 ...
- pwm电机调速的原理介绍与代码实现
文章目录 1.pwm实现调速的原理与介绍 1)占空比 2)配置模式 2.pwm信号配置流程 1)设置自动重装载数值 2)设置捕获比较数值 3)设置pwm输出模式及对齐方式 4)配置信号输出极性并使能输 ...
- 【51单片机学习】PWM电机调速
简单的PWM电机调速--基于51单片机 (一)51单片机需要用到的寄存器 (二)PWM波的产生及调速原理 (三)电机调速的实现 (一)51单片机需要用到的寄存器 中断允许寄存器,详情可以看STC51单 ...
- 【毕业设计】基于超声波与红外的自动调速风扇系统(代码开源) -物联网 嵌入式 stm32
文章目录 1 简介 1 设计概要 2 系统设计 2.1 系统供电问题 2.2 自动/手动模式的切换 2.3 PWM信号的产生 2.4 单片机内部资源的分配 三.硬件搭建 3.1 单片机最小系统 3.2 ...
- 基于51的多功能小风扇,可以实现定时,摇头,超声波自动调速等功能
最近也是想加入一个实验室,考核题目就是写一个小风扇!下面是题目要求 由于我也是大一新生,也就自学了一点51和c语言知识,代码写的可能有点拙,还请多多指教! #include <REGX52.H& ...
- STM32小车——PWM电机调速
PWM电机调速(寄存器版) 我的上一篇博客已经写了如何用定时器产生PWM来实现LED灯的呼吸灯效果,当我想实现PWM来控制电机调速时,网上翻阅了很多的资料但是大多数是在呼吸灯的基础上改一下代码实现的, ...
- 基于Arduino的自动调速风扇
好久没有更新了,家里实在太乱,最近趁着618活动,买了一堆收纳抽屉和置物架,把家里彻底收拾了一下,然后客厅就成了这个奇葩样子,注孤生的节奏了. 话不多说,夏天到了,天气逐渐热起来,风扇成了必不可少的消 ...
- 毕业设计 超声波红外自动调速风扇系统
文章目录 1 简介 1 设计概要 2 系统设计 2.1 系统供电问题 2.2 自动/手动模式的切换 2.3 PWM信号的产生 2.4 单片机内部资源的分配 三.硬件搭建 3.1 单片机最小系统 3.2 ...
- 树莓派Pico直流电机接口技术及PWM电机调速控制MicroPython编程
内容目录: 一.树莓派Pico开发板直流电机接口技术 1.H桥驱动电路的基本工作原理 2.典型H桥驱动电路分析 3.DRV8833双H桥电机驱动模块介绍 4.Pico开发板与直流电机接口 二.Pico ...
最新文章
- pycharm的anaconda配置
- GAN不只会造假:捕获数据中额外显著特征,提高表征学习可解释性
- 计算机软件基础操作,计算机软件基础 第九章 Excel基本操作(1页)-原创力文档...
- 链表--只知道当前节点指针删除当前节点
- 文件与文件夹课后作业
- 使用jquery+css实现瀑布流布局
- shell 编程(难题分析)
- java图书商城项目介绍_JavaWeb网上图书商城完整项目--11.项目所需jquery函数介绍...
- AngularJS缓存
- 数据--第24课 - 队列的特别实现
- html文档utf8文档字节,HTML UTF-8 参考手册
- LaTeX数学符号大全(转载)
- scrapy之spiders
- 计算机管理如何格式化u盘,详细教您如何格式化u盘
- 高数 | 函数在间断点处的极值问题
- 京东如何建设基于云原生架构的监控 - 日志系统?
- 端口号,UDP,TCP
- 云媒体服务器设置在哪个文件夹,安装和使用Jellyfin配置Linux媒体服务器
- Oracle动态授权用户权限
- js数组遍历的方法的一些细节