WRT54G-TM auto cooling fan.

Post new topic   Reply to topic    DD-WRT Forum Index -> Hardware DIY / Hardware Mods
Author Message
armbrusterc
DD-WRT Novice


Joined: 18 Jul 2010
Posts: 9
Location: Ohio, United States of America

PostPosted: Sun Jul 18, 2010 6:53    Post subject: WRT54G-TM auto cooling fan. Reply with quote
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 Laughing 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.
Sponsor
armbrusterc
DD-WRT Novice


Joined: 18 Jul 2010
Posts: 9
Location: Ohio, United States of America

PostPosted: Sun Jul 18, 2010 12:02    Post subject: no luck on the script Reply with quote
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
Wolf Kodi
DD-WRT User


Joined: 13 Jun 2010
Posts: 126

PostPosted: Mon Jul 19, 2010 23:23    Post subject: Script for Variable Fan speed based on CPU Load Reply with quote
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#*.}"

  counter=$delay

  if [ $load -gt $high ];then
    $gpio disable $fan
    sleep $delay
  elif [ $load -gt $med ];then
    while [ $counter -gt 0 ];do
      $gpio disable $fan
      usleep 250000
      $gpio enable $fan
      usleep 250000
      $gpio disable $fan
      usleep 250000
      $gpio enable $fan
      usleep 250000
      let counter-=1
    done
  elif [ $load -gt $low ];then
    while [ $counter -gt 0 ];do
      $gpio disable $fan
      usleep 300000
      $gpio enable $fan
      usleep 700000
      let counter-=1
    done
  else
    $gpio enable $led
    sleep $delay
  fi
done


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?
armbrusterc
DD-WRT Novice


Joined: 18 Jul 2010
Posts: 9
Location: Ohio, United States of America

PostPosted: Thu Jul 22, 2010 7:08    Post subject: Re: Script for Variable Fan speed based on CPU Load Reply with quote
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
Shocked
Wolf Kodi
DD-WRT User


Joined: 13 Jun 2010
Posts: 126

PostPosted: Thu Jul 22, 2010 23:33    Post subject: Auto variable fan rate based on cpu load Reply with quote
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. Smile

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"

Download autofan: http://www.dd-wrt.com/phpBB2/download.php?id=15539
armbrusterc
DD-WRT Novice


Joined: 18 Jul 2010
Posts: 9
Location: Ohio, United States of America

PostPosted: Fri Jul 23, 2010 16:30    Post subject: Re: Auto variable fan rate based on cpu load Reply with quote
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.

_________________


Wolf Kodi
DD-WRT User


Joined: 13 Jun 2010
Posts: 126

PostPosted: Sat Jul 24, 2010 0:22    Post subject: Reply with quote
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.
armbrusterc
DD-WRT Novice


Joined: 18 Jul 2010
Posts: 9
Location: Ohio, United States of America

PostPosted: Sat Jul 24, 2010 4:53    Post subject: Reply with quote
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.

_________________


armbrusterc
DD-WRT Novice


Joined: 18 Jul 2010
Posts: 9
Location: Ohio, United States of America

PostPosted: Thu Aug 05, 2010 14:09    Post subject: good news and bad. Reply with quote
Good: i have the other TM done and installed with the circuit.

Bad: i didnt make a video but i have a new schematic.

Good: I had a fan to use on it.

Bad: I broke a blade on the fan i was going to use. (breaking blades off on the opposite side does not re-balance the head lol)

Good: I got fired yesterday so i have plenty of time for making mods and videos.

Bad: i got fired yesterday so i have no income.

Good: I have been sending out resumes like mad.

_________________


Wolf Kodi
DD-WRT User


Joined: 13 Jun 2010
Posts: 126

PostPosted: Fri Aug 06, 2010 0:46    Post subject: Reply with quote
Let's see your new schematic. I thought breaking blades off the opposite side would actually balance it, at least better than just having one side broken off? Times must be getter harder huh
_________________


YouTube | Facebook Page
Per-user Live Down/Upload Rate Monitoring [No PC needed!]
somo
DD-WRT User


Joined: 04 Sep 2010
Posts: 128

PostPosted: Sat Mar 01, 2014 17:12    Post subject: Reply with quote
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
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11563
Location: Wherever the wind blows- North America

PostPosted: Sun Mar 02, 2014 16:16    Post subject: Reply with quote
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.
somo
DD-WRT User


Joined: 04 Sep 2010
Posts: 128

PostPosted: Mon Mar 03, 2014 1:50    Post subject: Reply with quote
redhawk0 wrote:
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
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11563
Location: Wherever the wind blows- North America

PostPosted: Tue Mar 04, 2014 12:26    Post subject: Reply with quote
Here is what I based my circuit off of....

http://www.sentex.ca/~mec1995/circ/auto-fan.html

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.
somo
DD-WRT User


Joined: 04 Sep 2010
Posts: 128

PostPosted: Wed Mar 05, 2014 2:00    Post subject: Reply with quote
redhawk0 wrote:
Here is what I based my circuit off of....

http://www.sentex.ca/~mec1995/circ/auto-fan.html

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
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Hardware DIY / Hardware Mods All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum