Skip to content
This repository has been archived by the owner on Dec 12, 2017. It is now read-only.

jezman/weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

  1. Raspberry Pi 3
  2. LCD Screen MT-20S4A 20x4 (Made in Russia). Based on HD44780.
  3. Ralay switch RTD14005
  4. DHT11 Humidity & Temperature Sensor
LCD Pin Pin assignment Raspberry Pi 2/3
1 GND GND
2 +3V/5V +5V
3 Uo GPIO 23/Pin 16
4 Ao GPIO 7/Pin 26
5 R/W GND
6 E GPIO 8/Pin 24
11 DB4 GPIO 24/Pin 18
12 DB5 GPIO 17/Pin 11
13 DB6 GPIO 27/Pin 14
14 DB7 GPIO 22/Pin 15
15 +LED GPIO 18/ Pin 12
16 -LED GND
  • LCD Pin 7-10 not used.

Relay switch to NC (normal closed)

#!/usr/bin/env python

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(4, GPIO.OUT) # GPIO 4/ Pin 7 - Ralay.
GPIO.output(4, False)
GPIO.cleanup(4)

Relay switch to NO (normal open)

#!/usr/bin/env python

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(4, GPIO.OUT) # GPIO 4/ Pin 7 - Ralay.
GPIO.output(4, True)

Brightness control

#!/usr/bin/env python

import time
import RPi.GPIO as GPIO

lcd_pin = 18
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(lcd_pin, GPIO.OUT)

current_time = time.strftime('%H')
br = GPIO.PWM(lcd_pin, 50)
br.start(0)

try:
    while True:
        if '07' < current_time < '17':
            br.ChangeDutyCycle(100)
        else:
            br.ChangeDutyCycle(50)
    time.sleep(900)
except KeyboardInterrput:
    pass

br.stop()
GPIO.cleanup(18)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages