Esempio n. 1
0
def main():
    #Main execution block
    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)
    GPIO.setup(FANPWR, GPIO.OUT)

    probe_modules()

    while True:
        temp = read_temp()
        print("Temp: %s" % temp)
        print("")

        trigger = False

        #COOLING
        if (MODE == 0):
            if float(temp) > THRESHOLD + SWING:
                turn_on()
            elif float(temp) < THRESHOLD - SWING:
                turn_off()

        #HEATING
        if (MODE == 1):
            if (float(temp) < THRESHOLD) - SWING:
                turn_on()
            elif float(temp) > THRESHOLD + SWING:
                turn_off()

        time.sleep(INTERVAL)
Esempio n. 2
0
def main():
    #Main execution block
    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)

    GPIO.setup(FAN, GPIO.OUT)
    GPIO.setup(LED2, GPIO.OUT)
    probe_modules()

    while True:
        speed = 0
        temp = read_temp()
        diff = THRESHOLD - temp
        if (diff > 0):
            speed = (RANGE / 100) * diff * FACTOR
            #speed = 1024
            #print("speed = " + str(speed))
            if speed >= RANGE:

                set_fan_speed(MAX)
            else:
                set_fan_speed(int(speed))
        else:
            set_fan_speed(0)

        print("Temp:" + str(temp))
        print("")

        trigger = False

        #COOLING
        if (MODE == 0):
            if float(temp) > THRESHOLD + SWING:
                turn_on()
            elif float(temp) < THRESHOLD - SWING:
                turn_off()

        #HEATING
        if (MODE == 1):
            if float(temp) < THRESHOLD - SWING:
                turn_on()
            elif float(temp) > THRESHOLD:
                turn_off()

        time.sleep(INTERVAL)
Esempio n. 3
0
#!/usr/bin/env python
import Stubs.RPi.GPIO as GPIO

THRESHOLD = 80
SWING = 1

METRIC = False
MODE = 0  #0 is cool 1 is heat
INTERVAL = 5

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(20, GPIO.OUT)
print(GPIO.input(20))
print("Turn Off!")
GPIO.output(20, GPIO.LOW)
print(GPIO.input(20))
Esempio n. 4
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import Stubs.RPi.GPIO as GPIO
import sys
#import os

FAN_PIN = 21
WAIT_TIME = 1
PWM_FREQ = 25

GPIO.setmode(GPIO.BCM)
GPIO.setup(FAN_PIN, GPIO.OUT, initial=GPIO.LOW)

fan = GPIO.PWM(FAN_PIN, PWM_FREQ)
fan.start(0)
i = 0

hyst = 1
tempSteps = [50, 70]
speedSteps = [0, 100]
cpuTempOld = 0

try:
    while 1:
        fanSpeed = float(input("Fan Speed: "))
        fan.ChangeDutyCycle(fanSpeed)

except (KeyboardInterrupt):
    print("Fan ctrl interrupted by keyboard")
    GPIO.cleanup()
Esempio n. 5
0
import Adafruit_GPIO.SPI as SPI

FC = 20
PWM = 21
Magic = 1

THRESHOLD = 225
SWING = 1

METRIC = False
MODE = 0  #0 is cool 1 is heat
INTERVAL = 5

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(FC, GPIO.OUT)

#HARDWARE SPI
SPI_PORT = 0
SPI_DEVICE = 0
sensor = MAX31855.MAX31855(
    spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=5000000))


def turn_on():
    print("Turn On!")
    GPIO.output(18, GPIO.HIGH)


def turn_off():
    GPIO.output(18, GPIO.LOW)
Esempio n. 6
0
#TODO: to be replaced by a sensor object.


THRESHOLD = 300
SWING = 1

METRIC=False

MODE=1 #0 is cool 1 is heat
INTERVAL = 5


GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(20, GPIO.OUT) # power to fan and led indicator
GPIO.setup(23, GPIO.OUT) # pwm fan control
GPIO.setup(24, GPIO.IN)

#HARDWARE SPI
SPI_PORT = 0
SPI_DEVICE = 0
sensor = MAX31855.MAX31855(spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=5000000))

def turn_on():
    print("Turn On!")
    GPIO.output(20, GPIO.HIGH)

def turn_off():
    GPIO.output(20, GPIO.LOW)
    print("Turn Off!")