Joined: 18 Jul 2010 Posts: 9 Location: Ohio, United States of America
Posted: Sun Jul 18, 2010 6:53 Post subject: WRT54G-TM auto cooling fan.
Hi all, this is my first post in this forum. But I have come here for advice before, so I decided its time I give something back.
Many people have installed cooling fans in their routers, no big deal right?
Well after looking at some scripts located on the wiki http://www.dd-wrt.com/wiki/index.php/Useful_Scripts.
I came up with a quick build i wanted to try.
There is already a script to indicate CPU usage with the white/amber light here so I wanted to exploit this to turn a cooling fan on and off.
It required a little tinkering but I feel I have a pretty stable design on the hardware side here now.
The gpio pins dont supply much power but it is enough to trigger a darlington transistor like a TIP120 which I had in my parts bin. Using this idea I have set up the 120 to switch the fan on and off in concert with the white led. (The light comes on and the fan stops, when the light is off the fan is on)
Here are a couple face pics.
I will post a link to a working demo video on youtube once I get the script modified. Shouldnt take too long, but i'm no good at script so there's no telling.
EDIT: forgot to mention this is still in testing, so attempt at your own risk. also the extra diode in the schematic from the emitter to the collector of the 120 is optional it is recommended for a large size fan however.
Joined: 18 Jul 2010 Posts: 9 Location: Ohio, United States of America
Posted: Sun Jul 18, 2010 12:02 Post subject: no luck on the script
if anyone can help me out here i would appreciate it.
the pin controlling the fan is GPIO 4.
just need a simple script to monitor cpu usage. Turn the fan on when it is high and turn it off under normal conditions.
When the light is on the fan is off.
thanks for any help
Posted: Mon Jul 19, 2010 23:23 Post subject: Script for Variable Fan speed based on CPU Load
Hi armbrusterc, I find it really interesting how these GPIOs can be used for unlimited applications.
I wrote/modified the script below for your purpose. Let me know if it works. Also tell me how the speed-reduced fan performs in CPU "low" and "med" mode:
Code:
#!/bin/sh
# Variable fan rate based on cpu load
gpio="gpio"
# GPIO number you want to use to control fan
fan=4
high=75
med=55
low=35
# Set how often you want to check cpu load and adjust fan in seconds
delay=10
while [ 0 ];do
set -- $(cat /proc/loadavg)
load="${1%.*}${1#*.}"
Some thoughts about your setup:
1) Wouldn't it be logically more appropriate connect the positive lead of the LED to TIP120's Base? That way, when the LED lights up, the fan runs. Or is that not possible?
2) Won't the extra diode short the collector and emitter causing the fan to be always powered, even for a larger fan? Or is the polarity of the diode switched in your diagram?
Joined: 18 Jul 2010 Posts: 9 Location: Ohio, United States of America
Posted: Thu Jul 22, 2010 7:08 Post subject: Re: Script for Variable Fan speed based on CPU Load
Wolf Kodi wrote:
Hi armbrusterc, ....
Some thoughts about your setup:
1) Wouldn't it be logically more appropriate connect the positive lead of the LED to TIP120's Base? That way, when the LED lights up, the fan runs. Or is that not possible?
2) Won't the extra diode short the collector and emitter causing the fan to be always powered, even for a larger fan? Or is the polarity of the diode
switched in your diagram?
yes the diode is reversed in the schematic, but you honestly shouldnt need it for this application.
in order to set up with light and fan on you need a pnp and the 120 is a npn transistor. a 125 may work.
and thanks for the code, havent tested it on the mod router yet, but on another tm i couldnt get it to start at boot when i used the gui. through the console i got it running but couldnt figure out how to stop it lol. im pretty new to the world of linux
Posted: Thu Jul 22, 2010 23:33 Post subject: Auto variable fan rate based on cpu load
Alright, extra diode not needed and let's stick to the NPN 120 transistor. Doesn't really make much of a difference and if anything, it might provide more power for the processor under high load as it is disabled.
Sounds like you've got lots of TMs. If you want to start this script during boot, I recommend you to put a "sleep 10" prior to running this script. As with any other script, I find you have a better chance of it running if you allow your router ample time to load its cores first.
So, lets call this script "autofan". You'll then add this in your startup script:
Code:
sleep 10 && /path_to/autofan &
If you're running it through the console, to start it:
#/path_to/autofan
and to stop/end it you just use "Ctrl+C".
If you've started it as a background process using:
#/path_to/autofan &
you can use #ps to check the list of running processes and use
#killall autofan
to kill/stop/end it.
I've compiled the script into a file and added options to test your fan. You can run this script in console with the options: "set high", "set med", "set low" or "set off". Eg: "/path_to/autofan set high"
Joined: 18 Jul 2010 Posts: 9 Location: Ohio, United States of America
Posted: Fri Jul 23, 2010 16:30 Post subject: Re: Auto variable fan rate based on cpu load
Wolf Kodi wrote:
Sounds like you've got lots of TMs....
I've compiled the script into a file and added options to test your fan. You can run this script in console with the options: "set high", "set med", "set low" or "set off". Eg: "/path_to/autofan set high"
Download...
I have 3 TMs total, also have one v6. I use the v6 as a test bed for mods lol.
Two of the tms are on my network and the other one (with the fan) is in a separate off site network.
You could not have made that any simpler, much appreciated!
Im out of 120s so i will have to get some more and mod my other tms.
i will remake the schematic and take better photos this time. maybe even a wiki page haha?
i will check out this info and thanks for the help, again. _________________
That's a pretty decent internet connection speed you have there. What's the highest speed your Internet Service Provider provides? When Fiber To The Home reaches my area soon, the highest I can get is 20Mbps, comes with a price too.
Yeah, a wiki page would be great when this is successful. Also, I forgot to mention earlier, make sure you set the properties of that script to allow execution or else it can't run.
Joined: 18 Jul 2010 Posts: 9 Location: Ohio, United States of America
Posted: Sat Jul 24, 2010 4:53 Post subject:
I worked for FiOS for a year or so doing technical support, it really seemed like a awesome service when it worked right, the only draw back i could think of was price.. that and it wont make it to my area for a long time.
Not sure on the speed im supposed to be getting, i think its the highest offered. Im happy with it though, never had any problems.
i will start on my other TM tomorrow making a thorough video and how to guide. _________________
did this mod get sorted out enough to be practical?
if a fan mod is needed this would be the way to go but Ive read conflicting reports that these routers (WRTs) dont need a fan and rarely need a heat sink. _________________ -WRT54G V2 v24-sp2 Build:12476M vpn-small + AutoAP
-WRT54G V4 w/SDCard Mod v24-sp2 Build:14929 VPN + MyPage
-WRT54G-TM w/SDCard Mod v24-sp2 Build:12476M mega + AutoAP
-WRT54GS V3 w/64MB RAM & SDCard Mods v24-sp2 Build:15962 + OTRW2
Joined: 04 Jan 2007 Posts: 11563 Location: Wherever the wind blows- North America
Posted: Sun Mar 02, 2014 16:16 Post subject:
Hi guys...instead of using a GPIO sensed circuit and script...why don't you use a thermal activated switch. Attach a Thermistor to the CPU and/or radio chip and at any given temperature have it turn on the fan. I did this with an old ReplayTV Showstopper unit that I had. When the disk would reach a certain temperature, I turned the fan on to expel the heat....when the temperature dropped...the circuit turned the fan off. It worked for years and didn't have but a handful of components to build....If interested...I'll try to find my original circuit schematic.
redhawk _________________ The only stupid question....is the unasked one.
Hi guys...instead of using a GPIO sensed circuit and script...why don't you use a thermal activated switch. Attach a Thermistor to the CPU and/or radio chip and at any given temperature have it turn on the fan. I did this with an old ReplayTV Showstopper unit that I had. When the disk would reach a certain temperature, I turned the fan on to expel the heat....when the temperature dropped...the circuit turned the fan off. It worked for years and didn't have but a handful of components to build....If interested...I'll try to find my original circuit schematic.
redhawk
I like that idea! auto-thermostatically controlled..
tricky part is determining what Thermistor. (I have never heard of those) what temp range it cuts in and out at.
I might try some fan experiments just to see if it truely has advantages. was reading somewhere here that a one wire temp sensor could be incorporated into a WRT too somehow but I lost where I read about it. _________________ -WRT54G V2 v24-sp2 Build:12476M vpn-small + AutoAP
-WRT54G V4 w/SDCard Mod v24-sp2 Build:14929 VPN + MyPage
-WRT54G-TM w/SDCard Mod v24-sp2 Build:12476M mega + AutoAP
-WRT54GS V3 w/64MB RAM & SDCard Mods v24-sp2 Build:15962 + OTRW2
A thermistor just changes resistance with a change in temperature....that way it can be used to sense a voltage level to a comparitor...in this circuit...the 741....then it triggers the 2n2222A or 3904...I used a 3904...its what I had laying around.
redhawk _________________ The only stupid question....is the unasked one.
A thermistor just changes resistance with a change in temperature....that way it can be used to sense a voltage level to a comparitor...in this circuit...the 741....then it triggers the 2n2222A or 3904...I used a 3904...its what I had laying around.
redhawk
I wasnt expecting that it would be such complex circuitry.
I found the one-wire deal linked to the Quick_list_of_Optware_packages. http://www.digitemp.com/ but it is just a monitor however the one-wire device it uses may could be used to trip a relay and turn on/off the fan.
EDIT: here is more info on the digitemp http://www.lecad.fs.uni-lj.si/~leon/other/wlan/wrt54ow/index.html _________________ -WRT54G V2 v24-sp2 Build:12476M vpn-small + AutoAP
-WRT54G V4 w/SDCard Mod v24-sp2 Build:14929 VPN + MyPage
-WRT54G-TM w/SDCard Mod v24-sp2 Build:12476M mega + AutoAP
-WRT54GS V3 w/64MB RAM & SDCard Mods v24-sp2 Build:15962 + OTRW2