Ejemplo n.º 1
0
def displayLCD():
    data = request.get_json()
    data = data['lcd_text']
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
    print_message(lcd, data)

    return 'data was received successfully'
Ejemplo n.º 2
0
def TempAndHumidityLCD(lcdColumns, lcdRows, tempSensor, tempPin):
    # Initialize the LCD using the pins
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)

    temperature, humidity = Adafruit_DHT.read(tempSensor, tempPin)
    time.sleep(1)
    GPIO.cleanup()

    temperature = temperature * 9 / 5.0 + 32

    temperatureStr = str(temperature)
    humidityStr = str(humidity)

    # print temp
    lcd.set_backlight(0)
    lcd.message("Current temp \n" + temperatureStr + " F")
    time.sleep(5.0)
    lcd.clear()

    # print humidity
    lcd.set_backlight(0)
    lcd.message("Current humidity \n" + humidityStr + " %")
    time.sleep(5.0)
    lcd.clear()
    GPIO.cleanup()
Ejemplo n.º 3
0
    def __init__(self, address=0x20):
        self.mMcp = MCP.MCP23017(
            address)  #create an object to interface with io expander
        self.mLcd = LCD.Adafruit_CharLCDBackpack()
        self.mLcd.set_backlight(0)
        self.mLcd.clear()
        self.mLcd.blink(True)

        for i in range(self.mRows):  #set pins GPA3-A6 as input pins
            self.mMcp.setup(self.mRowPins[i], GPIO.IN)
            self.mMcp.pullup(self.mRowPins[i], True)
            self.mMcp.setup(self.mRelayPins[i], GPIO.OUT)
            self.mMcp.output(self.mRelayPins[i], GPIO.HIGH)
Ejemplo n.º 4
0
def press_button_to_fill():
    # configure down button for 5 gallon
    button_pin_5_down = 13
    # configure down button for 10 gallon
    button_pin_10_up = 26
    # Used power gpio
    power_pin = 18
    # set GPIO as GPIO.BOARD
    GPIO.setmode(GPIO.BCM)
    # Setup button pin asBu input and power pins
    GPIO.setup(button_pin_5_down, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(button_pin_10_up, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(power_pin, GPIO.OUT)
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
    # Turn backlight on
    lcd.set_backlight(0)

    def Fill_keg(button_pin_5_down, power_pin, button_pin_10_up):
        while True:
            # check if button pressed for 5 gallon
            if (GPIO.input(button_pin_5_down) == 0):
                # set power on
                GPIO.output(power_pin, GPIO.HIGH)
                lcd.message('Button is \nPressed')
                # Power is off automatically after 5 second
                time.sleep(3)
                # check if button pressed for 10 gallon
            elif (GPIO.input(button_pin_10_up) == 0):
                # set power on
                GPIO.output(power_pin, GPIO.HIGH)
                lcd.message('Button is \nPressed')
                # Power is off automatically after 5 second
                time.sleep(6)
            else:
                # it's not pressed, set button off
                GPIO.output(power_pin, GPIO.LOW)
                lcd.message('Button is not \nPressed \n')
                time.sleep(1)
                lcd.clear()
        GPIO.cleanup()

    Fill_keg(button_pin_5_down, power_pin, button_pin_10_up)
Ejemplo n.º 5
0
def QualityCheck():
    # button  used as buzzer to check the quality
    # change
    Qc_empbutton_left = 25
    # buzzer
    buzzerpin = 18
    # set GPIO as GPIO.BOARD
    GPIO.setmode(GPIO.BCM)
    # Setup button pin asBu input and power pins
    GPIO.setup(Qc_empbutton_left, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    # buzzer
    GPIO.setup(buzzerpin, GPIO.OUT)
    # Initialize the LCD using the pins
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
    # Turn backlight on
    lcd.set_backlight(0)

    def quality_check(Qc_empbutton_left, lcd, Prep, buzzerpin):
        # regular quality check using lcd screen
        Prep = True
        while Prep:
            quality_check = False
            # Prep employee sets quality check
            if GPIO.input(Qc_empbutton_left) == 1:
                # turn on LED
                lcd.message('Quality Check request by employee')
                GPIO.output(buzzerpin, GPIO.LOW)
                time.sleep(5)
                # after Quality check complete employee press button for QC Completed
            elif GPIO.input(Qc_empbutton_left) == 0:
                lcd.message('Employee completed the Quality Check ')
                GPIO.output(buzzerpin, GPIO.HIGH)
                time.sleep(0.8)
                # Wait half a second
                time.sleep(5)
                Prep = False
            else:
                lcd.message('Waiting for Request order')
                time.sleep(3)

    quality_check(quality_check)
Ejemplo n.º 6
0
def motion_detect_keg():
    # Used Motion gpio
    motion_pin = 23
    # set GPIO as GPIO.BOARD
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(motion_pin, GPIO.IN)
    # Initialize the LCD using the pins
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
    # Turn backlight on
    lcd.set_backlight(0)

    def motion_detect_Point_A(motion_pin):
        while True:
            if GPIO.input(motion_pin) == 0:
                lcd.message('Waiting for Keg\n')
                time.sleep(0.5)
                lcd.clear()
            elif GPIO.input(motion_pin) == 1:
                lcd.message('Keg is arrived\n')
                time.sleep(1)
        GPIO.cleanup()

    motion_detect_Point_A(motion_pin)
Ejemplo n.º 7
0
def main():
	# Define LCD column and row size for 16x2 LCD.
	lcd_columns = 16
	lcd_rows    = 2
	lcd_address = 27

	# Initialize the LCD using the pins
	lcd = LCD.Adafruit_CharLCDBackpack()

	# Turn backlight on
	lcd.set_backlight(0)

	'''
	### Demo showing the cursor.
	lcd.clear()
	#lcd.show_cursor(True)
	#lcd.blink(True)
	
	### Stop blinking and showing cursor.
	#lcd.show_cursor(False)
	#lcd.blink(False)

	# Demo scrolling message right/left.
	lcd.clear()
	message = 'Scroll'
	lcd.message(message)
	for i in range(lcd_columns-len(message)):
		time.sleep(0.5)
		lcd.move_right()
	for i in range(lcd_columns-len(message)):
		time.sleep(0.5)
		lcd.move_left()
	'''

	show_time()
	show_message()
Ejemplo n.º 8
0
def carbonation_check():
    # set type of the sensor for temp
    sensor = 11
    # set pin number for temp
    pin = 4
    # Define LCD column and row size for 16x2 LCD.
    lcd_columns = 16
    lcd_rows = 2
    # Initialize the LCD using the pins
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
    # Initialize the temperature sensor
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

    # Turn backlight on
    lcd.set_backlight(0)

    def Carbonation_temp(humidity, temperature, lcd):
        # Might need to Record before and after temp and huminity
        for i in range(2):
            if humidity is not None and temperature is not None:
                lcd.message('Temp={0:0.1f} & \nHumidity={1:0.1f}%'.format(temperature, humidity))
                # temp sensor will take reading after 2 second
                time.sleep(2)
                # Record Temperature in text file
                with open("file.txt", "w+") as f:
                    f.write('Temp={0:0.1f} & \nHumidity={1:0.1f}%'.format(temperature, humidity))
                    f.write('\n')
            else:
                lcd.message('Failed to get reading. Try again!')
            # In 5 seconds LCD will turn off
            time.sleep(5)
            lcd.clear()
            lcd.set_backlight(1)
        GPIO.cleanup()

    Carbonation_temp(humidity, temperature, lcd)
GPIO.setmode(GPIO.BCM)
hall_pin = 4
buzzer_pin = 5
led_pin = 6
GPIO.setup(hall_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(buzzer_pin, GPIO.OUT)
GPIO.setup(led_pin, GPIO.OUT)

start_timer = time.time()
taketime = 10

# define LCD column and row size for 16x2 LCD
lcd_columns = 16
lcd_rows = 2
# initialize the I2C
lcd = LCD.Adafruit_CharLCDBackpack(address=0x20)
# turn backlight on
lcd.set_backlight(0)


def hall_pulse(channel):
    global pulses
    pulses += 1


GPIO.add_event_detect(hall_pin,
                      GPIO.FALLING,
                      callback=hall_pulse,
                      bouncetime=50)

pulses = 0
Ejemplo n.º 10
0
bus.write_i2c_block_data(address, 0x20, [0x03])
time.sleep(1)

bus.write_i2c_block_data(address, 0x20, [0x08])
time.sleep(1)

#sound
pygame.init()
pygame.mixer.init()

# Define    LCD column and row size for 16x2   LCD.
lcd_columns = 16
lcd_rows = 2

# Initialize the  LCD using the pins
lcd = LCD.Adafruit_CharLCDBackpack()

# Turn backlight on
lcd.set_backlight(0)

# Create an ADS1115 ADC (16-bit) instance.
adc = Adafruit_ADS1x15.ADS1115()

#Data ready event enabled for altitude, pressure, temperature
bus.write_byte_data(0x60, 0x13, 0x07)

time.sleep(.5)
# Active mode, OSR = 128, Barometer mode
bus.write_byte_data(0x60, 0x26, 0x39)
time.sleep(.5)
#co2 reading
Ejemplo n.º 11
0
 def __init__(self):
     # Initialize the LCD using the pins
     self.lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
Ejemplo n.º 12
0
def clearLCD():
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
    clear_lcd(lcd)

    return 'LCD was cleared successfully'
Ejemplo n.º 13
0
 def __init__(self):
     """
     Initializes the module
     """
     tlu_hardwarebase.__init__(self)
     self.lcd = LCD.Adafruit_CharLCDBackpack(address=self.lcd_address)
Ejemplo n.º 14
0
def Main():
    BrewTask.BrewTaskGET()
    RecipeiTableYeast.YeastGet()

    segment = SevenSegment.SevenSegment(address=0x70)
    # Initialize the display. Must be called once before using the display.
    segment.begin()

    # initialize ledmatrix
    msg = ""
    LEDMatrix(cascaded, block_orientation, rotate, msg)

    # initialize LCD screen
    TempAndHumidityLCD(lcdColumns, lcdRows, tempSensor, tempPin)
    lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)

    msg = "."

    temperature, humidity = Adafruit_DHT.read(tempSensor, tempPin)
    time.sleep(1)
    GPIO.cleanup()

    temperature = temperature * 9 / 5.0 + 32
    lcd.set_backlight(0)
    lcd.message("Current temp\n" + temperature)  # pulled from mother brew
    time.sleep(3.0)
    lcd.clear()
    GPIO.cleanup()

    # checking temp
    for i in range(0, 6):
        # temp too low
        if (temperature < 68):
            lcd.set_backlight(0)
            lcd.message("Temperature is\n" + "too low: " + str(temperature) + " F")
            time.sleep(3.0)
            lcd.clear()
            GPIO.cleanup()

        # temp too high
        elif (temperature > 78):
            lcd.set_backlight(0)
            lcd.message("Temperature is\n" + "too high: " + str(temperature) + " F")
            time.sleep(3.0)
            lcd.clear()
            GPIO.cleanup()

        # temp acutally worked
        elif (temperature == 78):
            break
        i += 1

    lcd.set_backlight(0)
    lcd.message("Temperature is:\n" + str(temperature) + " F")
    time.sleep(5.0)
    lcd.clear()
    GPIO.cleanup()

    # pull yeast and sugar to check amounts
    RecipeiTableYeast.Yeast1Get()
    RecipeiTableYeast.Yeast2Get()
    RecipeiTableYeast.Yeast3Get()

    RecipieTableSugar.SugarGet()

    # update API level and gravity check
    RecipieTableABV.ABVGet()

    # choose second ferment - if/elif branch
    SecondFerment.secondFermentGet()

    today = datetime.date.today()
 
     # end time
    outgoingTemp = datetime.date.today()

    FermentDuration.durationGet()


    QualityCheck.qualityCheckGet()


    FermentClean.CleanGet()
    Stepmotor()

    # push to boil

    print("Ferment Completed.")
    imprt CHeckForRecipie