Tutorial: Adding a Fan to SkyWeather

SkyWeather Fan

Tutorial: Adding a Fan to SkyWeather

This is a tutorial on adding a 5V fan to SkyWeather.

SkyWeather  allows you to build your own weather station with a Sky Cam to take pictures of your Sky and display them the cloud on WeatherSTEM.  You might even make it to the WeatherChannel!  

All up-to-date information for SkyWeather is here.

Why Add a Fan to SkyWeather?

If your SkyWeather box is sitting directly in the sun the internals of the box can get quite warm.  The components in the kit are rated to 80 C (177 F) and generally, this is not a problem.  Nice to keep things cooler in any case.

The  Solar SkyWeather systems have a lower rating 51 C (125 F), because at the very time you are getting the most sun and working the SunControl charger the hardest, the thermal load in the box will be the highest and you can burn out the SunControl board because of the self heating of the components on SunControl that will take the chips higher than 80 C (177 F).

We have added a cooling fan to our Palm Springs box (more for fun than anything else) and in our Solar Powered box at SwitchDoc Labs (it gets really hot in the summer).

You can add cooling a couple of different ways.

Add a Solar Panel driving a Fan

You can attach a solar panel directly to a 5V fan and it will run the fan when the sun is out.  This makes sense in the summer, when you have high thermal loads, but not in the winter.   Cooling your box when it is cold out (below 0 C (32 F)) doesn’t make sense because it lowers or stops your LiPo battery charging.   We need some control.

Connect a Fan to the 5V power supply

This avoids the extra solar panel, but puts a continuous additional load to your systems (about 100mA in general or about 0.5W) and that just makes it harder to keep the batteries charged.   We also have the same problem with the fan running when it is cold out as using a Solar Panel to directly drive a fan.

Adding a Fan under SkyWeather Control

We are going to show you how to add a Fan to SkyWeather that will just be turned on and off depending on the temperature inside the box.  SkyWeather has an inside temperature sensor (and inside humidity sensor) built in to the BME680 Barometer inside the box.

We are going to use that inside temperature to set a turn on and turn off temperature for SkyWeather.  It turns out that this software is already built into SkyWeather and is just waiting to be use used.

The software is quite simple.

Parts List:

Assembly Steps

Step 1) Drill a 7/8″ hole above the right side RJ11 connector (note:  some of the pictures below has us drilling a hole somewhat to the left of the correct position.  If you drill it further to the left, the top latch gets in the way).   Take a small piece of screen material, put a circle of silicone caulking around the inner circle and push the screen into the silicone.

Step 2) Take the Grove PowerDrive and screw and glue some M3 pylons on the bottom for mounting inside the box.

 

 

 

 

 

Step 3) Glue the Grove PowerDrive to the bottom of the Bud Box.

Step 4) Write the Fan up with the Grove Male Header to Grove Cable.  Push the Yellow wire into the Red (+) plug of the Fan and the Black wire into there Black (ground) of the Fan.

 

 

 

 

 

 

 

 

 

 

 

 

Step 5) Plug in the other end of the Grove Male Header to Grove cable into the OUT side of the Grove PowerDrive

 

Step 6) Take a 20cm Grove to Grove Cable and cut the white wire. Tape up the ends so they can’t short against anything.Step 7) Plug the 20cm Grove to Grove cable from Step 6) into the “In” side of the Grove PowerDrive and plug the other end into D5/D6 on the Pi2Grover board on your Raspberry Pi.

page25image64853280
Step 8) Take the Fan and attach it to the fan hole on the Bud Box either using Glue or screws.    Put the label side towards the side of the box.  If you orient the fan in the other direction, things will still work, but the air will blowing in the box instead of out of the box.
You have now completed the assembly.

Testing and The Software

This software is from the SkyWeather software (https://github.com/switchdoclabs/SDL_Pi_SkyWeather) and it uses the SDL_Pi_GrovePowerDrive (https://github.com/switchdoclabs/SDL_Pi_GrovePowerDrive) library.

Testing

To test the Fan software, run this program (testFan.py located in the SDL_Pi_SkyWeather) directory:

import sys
sys.path.append('./SDL_Pi_GrovePowerDrive')

import  SDL_Pi_GrovePowerDrive
import time

GPIO_Pin_PowerDrive_Sig1 = 5
GPIO_Pin_PowerDrive_Sig2 = 6


myPowerDrive = SDL_Pi_GrovePowerDrive.SDL_Pi_GrovePowerDrive(GPIO_Pin_PowerDrive_Sig1, GPIO_Pin_PowerDrive_Sig2, True, True)
    
while True:
    print "turning Pin %i off" % GPIO_Pin_PowerDrive_Sig1
    myPowerDrive.setPowerDrive(1,0)


    myPowerDrive.setPowerDrive(2,0)

    time.sleep(10)
    
    print "turning Pin %i on" % GPIO_Pin_PowerDrive_Sig1
    myPowerDrive.setPowerDrive(1,1)
    time.sleep(10)

The fan will turn on for 10 seconds and then turn off 10 seconds and then repeat.

SkyWeather Software

Here are the libraries that are located in SkyWeather.py.  Note that the fan turns on at 37 C (98.6 F) and back off at 34 C (93.2 F).  This technique of turning on and off devices at different points is called hysteresis.   It keeps the fan from being turned on and off continuously.

###############
# Fan Control
###############

import SDL_Pi_GrovePowerDrive

TEMPFANTURNON = 37.0
TEMPFANTURNOFF = 34.0

myPowerDrive = SDL_Pi_GrovePowerDrive.SDL_Pi_GrovePowerDrive(config.GPIO_Pin_PowerDrive_Sig1, config.GPIO_Pin_PowerDrive_Sig2, False, False)
def turnFanOn():
   if (state.fanState == False):
    pclogging.log(pclogging.INFO, __name__, "Turning Fan On" )
    if (config.USEBLYNK):
        updateBlynk.blynkStatusTerminalUpdate("Turning Fan On")
    myPowerDrive.setPowerDrive(1, True) 
    myPowerDrive.setPowerDrive(2, True) 
    state.fanState = True

def turnFanOff():
   if (state.fanState == True):
    pclogging.log(pclogging.INFO, __name__, "Turning Fan Off" )
    if (config.USEBLYNK):
       updateBlynk.blynkStatusTerminalUpdate("Turning Fan Off")
    myPowerDrive.setPowerDrive(1, False) 
    myPowerDrive.setPowerDrive(2, False)
    state.fanState = False
 

turnFanOff()

And the code that actually turns on and off the fan in the sampleWeather subroutine:

        # check for turn fan on
        if (state.currentInsideTemperature > TEMPFANTURNON):
            turnFanOn()
        # check for turn fan off
        if (state.currentInsideTemperature < TEMPFANTURNOFF):
            turnFanOff()

The Thermal Page on the Blynk App

On the Blank App for SkyWeather (Docs located in documentation section here.), there is a Thermal page that shows what is going on inside of the SkyWeather box.   Below is a page from the Palm Spring SkyWeather Unit (WeatherSTEM page here: https://skyweather.weatherstem.com/xanadu) Blynk App showing the Thermal page.

 

SkyWeather Fan

The blue line is the Fan turning on and off in the top display.   The first couple of days of this run (May 25-May 26) were pretty cool, but the temperature has been increasing as the week went on.  The fan responded by turning on for more and more time to keep the temperature down.

 

6 Comments

  1. Not sure what humidity might do inside in addition to the heat. Would it make sense to add high humidity as an additional reason to vent with the fan?

    • Adding Humidity is a great idea. I’ll add that to the next SkyWeather release. If the inside humidity is above the outside humidity and above some certain % then turn the fan on.

      BP

  2. Do you have similar recommendations for a fan in the WxLink solar version? That’s the part of mine that’ll be out in the sun!

    • The same unit should work. The internal heat load will be a little smaller in a WXLink system so you should be fine.

      John

Comments are closed.