Presentation is loading. Please wait.

Presentation is loading. Please wait.

Raspberry Pi Project Control Your Home Lights with a Raspberry Pi.

Similar presentations


Presentation on theme: "Raspberry Pi Project Control Your Home Lights with a Raspberry Pi."— Presentation transcript:

1 Raspberry Pi Project Control Your Home Lights with a Raspberry Pi

2 What’s Raspberry Pi

3 Raspberry Pi is a single-board computer capable of doing everything you’d expect a desktop computer to do. Raspberry Pi comes in 4 different models A, B, B+ and 2 Raspberry Pi 2 is the latest and the fastest.

4 Raspberry-pi B+ technical specifications CPU 700 MHZ Memory Card Slot fits micro SD card Audio Output GPIO Connector 40 Pin Camera connector Display connector

5 Raspberry-pi B+ technical specifications 4 USB Port Ethernet socket HDMI port Memory 512 MB of RAM Power Micro USB socket 2.0 OS boots from Micro SD card

6 Hardware required for the project RaspberryPI TV/Computer Monitor HDMI Cable WIFI adapter Channel relay Female to Female Jumper Cable 16 GB micro SD card Power Outlet Electric Cables Keyboard & Mouse

7 OS and Web Server OS IS RASPBIAN Apache web server

8 Languages Python PHP HTML

9 OS Installation and Configuration Download and install SDFormatter software Format your micro SD card using SDFormatter software Download and Install Win32DiskImager software. Download the OS Image Run the Win32DiskImager and select the OS Imagefile. Select the micro SD card then Click Write.

10 OS Installation and Configuration Once completed remove the micro SD card and insert it into your Raspberry Pi Connect your Raspberry Pi to TV or computer monitor using your HDMI cable. Power up your raspberry Pi. You will be shown raspi-config on first booting into Raspbian.

11 OS Installation and Configuration

12 Click option 2 to change the password Click option 4 to change language and time zone Click on advanced option to enable ssh just incase you want to ssh to Raspberry Pi Once you finish with your changing click finish to take you to the desktop.

13 OS Installation and Configuration Connect to Internet Insert your WIFI adapter and install the driver or connect directly to your router or switch using Ethernet cable.

14 Web Server Installation Using LXTerminal type command below 1- Ifconfig To get an IP address for your Raspberry Pi 2- sudo apt-get update To update your system’s package 3- sudo apt-get upgrade To upgrade all installed packages to their latest versions.

15 Web Server Installation Using LXTerminal type Once web server installed, go to web browses and type your Raspberry Pi IP address or type http://localhost/ to test your web server. If you get It Works! That means your webserver is working fine. http://localhost/

16 Install PHP To install PHP type:

17 Project Connect your Raspberry Pi GPIO to your 8 Channels relay Raspberry pi has 40 GPIO Pin, 26 can be used as digital inputs or outputs. 14 can be used for power Channels relay had 10 Pin 8 for each relay and 2 for power

18 Project

19 Since I’m using only 8 channels relay, I used 10 GPIO Pin, 8 digital I/O, 1 5v, and 1 ground.

20 Connecting RaspberryPI GPIO to 8 Channels Relay RaspberryPI GPIO8 Channels Relay GRN GPIO26IN1 GPIO19IN2 GPIO11IN3 GPIO13IN4 GPIO27IN5 GPIO26IN6 GPIO10IN7 GPIO09IN8 5VVCC

21

22 Python Codes import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(26, GPIO.OUT) GPIO.output(26, True) GPIO.output(26, False) GPIO.setup(19, GPIO.OUT) GPIO.output(19, True) GPIO.output(19, False)

23 Python Codes (Continuous) GPIO.setup(11, GPIO.OUT) GPIO.output(11, True) GPIO.output(11, False) GPIO.setup(13, GPIO.OUT) GPIO.output(13, True) GPIO.output(13, False) GPIO.setup(27, GPIO.OUT) GPIO.output(27, True) GPIO.output(27, False)

24 Python Codes (Continuous) GPIO.setup(22, GPIO.OUT) GPIO.output(22, True) GPIO.output(22, False) GPIO.setup(10, GPIO.OUT) GPIO.output(10, True) GPIO.output(10, False) GPIO.setup(9, GPIO.OUT) GPIO.output(9, True) GPIO.output(9, False)

25 PHP codes

26 PHP codes (Continuous)

27

28

29

30

31

32

33

34 Test PHP codes To test you PHP code, save the PHP codes on /var/www/ and call it index.php then go to the internet browser and type your Raspberry Pi IP address or type http://localhost/http://localhost/ You should see your PHP codes as designed and you are able to control the light locally.

35

36 To control the light form anywhere is the world. Using the internet browser type: http://whatismyipaddress.com/ to get your public IP address. http://whatismyipaddress.com/ Set up port forwarding on your router Type your public IP address from different LAN to test you PHP codes. After testing, Create simple HTML codes to hyperlink your public IP address

37 HTML Codes Untitled Document http://173.54.222.14/

38

39 After creating your HTML codes you need to host you website. I used godaddy to host my site. http://hytham.kingoftech.com Connect your 8 channels relay to your 8 power outlet Each relay have negative and positive that they need to be connected to the negative and positive in the power outlet.

40 Connecting 8 Channels Relay to Power outlet.

41 Final Project Video


Download ppt "Raspberry Pi Project Control Your Home Lights with a Raspberry Pi."

Similar presentations


Ads by Google