Presentation is loading. Please wait.

Presentation is loading. Please wait.

RASPBERRY PI WORKSHOP.

Similar presentations


Presentation on theme: "RASPBERRY PI WORKSHOP."— Presentation transcript:

1 RASPBERRY PI WORKSHOP

2 SENSOR WITH RASPBERRY PI
A sensor is a device that detects and responds to some type of input from the physical environment. The specific input could be light, heat, motion, moisture, pressure, or any one of a great number of other environmental phenomena.

3 LCD with Raspberry Pi LCD (Liquid Crystal Display) is an electronic device that can be configured to display user defined characters. The LCD uses a parallel interface meaning that we will need many pins from our raspberry pi to control it.

4 CONNECTION OF LCD TO RASP PI

5 INSTALLING WIRING PI LIBRARY
First check that wiringPi is not already installed. In a terminal, run: gpio -v cd git clone git:// git.drogon.net/wiringPi If you have already used the clone operation for the first time, then cd ~/wiringPi git pull origin To build/install there is a new simplified script: cd ~/wiringPi ./build

6 INSTALLING THE RPLCD LIBRARY
The RPLCD library can be installed from the Python Package Index, or PIP. It might already be installed on your Pi, but if not, enter this at the command prompt to install it: After you get PIP installed, install the RPLCD library by entering: sudo apt-get install python-pip sudo pip install RPLCD

7 DISPLAY DATE AND TIME from RPLCD import CharLCD import time
lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[33, 31, 29, 23]) while True: lcd.write_string("Time: %s" %time.strftime("%H:%M:%S")) lcd.cursor_pos = (1, 0) lcd.write_string("Date: %s" %time.strftime("%m/%d/%Y"))

8 SERVO A Servomotor, or servo, is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. As long as the coded signal exists on the input line, the servo will maintain the angular position of the shaft. As the coded signal changes, the angular position of the shaft changes.

9 CONNECTION OF SERVO TO RASPBERRY PI

10 SERVO CODE import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) p = GPIO.PWM(12, 50) p.start(7.5) try: while True: p.ChangeDutyCycle(7.5) # turn towards 90 degree time.sleep(1) # sleep 1 second p.ChangeDutyCycle(2.5) # turn towards 0 degree p.ChangeDutyCycle(12.5) # turn towards 180 degree except KeyboardInterrupt: p.stop() GPIO.cleanup()


Download ppt "RASPBERRY PI WORKSHOP."

Similar presentations


Ads by Google