This video about my home automation for lamp control in my room with raspberry pi, PLC and android phone.
1. Hardware required for home automation, especially to lamp control
My Home Automation with Raspberry Pi, PLC and Wireless LAN Router
Hardware of Home Automation with Raspberry Pi
Description of the image above:
1. Raspberry Pi, SD Card, mouse, keyboard, monitor and Adapter.
Note: mouse, keyboard and monitor are only used for the operating system setup
2. Programmable Logic Controller (PLC) : Siemens S7-200
3. PLC Cable: RS232-PPI
4. UART TTL to RS232 converter module
5. RS232 crossover cable
RS232 crossover cable diagram
6. Router with RJ45(LAN) and Wireless or Wireless LAN Router
7. RJ45 Cable
8. Adapter for Raspberry Pi and Router
2. Step by step to make home automation to lamp control in home
2.A. Preparation and setup in the raspberry pi
1. Download Raspbian (Debian Wheezy): http://downloads.raspberrypi.org/raspbian_latest
2. Download Win32DiskImager: click here
3. Insert sd card into computer with Windows OS
4. Run Win32DiskImager
5. Write Raspbian OS to sd card using Win32DiskImager
6. After write raspbian to sd card, take the sd card and insert it into the raspberry pi (turn off the electrical power)
7. Connect a mouse, keyboard and monitor to the raspberry pi.
8. Raspberry Pi should not be connected to the serial module.
9. Turn on the adapter to the raspberry pi. LOGIN: pi ,PASSWORD: raspberry , USE: startx
10. After Raspberry Pi ready to use with Raspbian OS/Wheezy OS, download project file.
11. Download project file: click here and Save to Flash disk
12. After download file in flash disk and Insert Flash disk into USB of Raspberry Pi.
13. Copy-Paste all project file to Raspberry Pi in folder: /home/pi
14. Look at this video for Auto Login on Raspberry Pi, Install PySerial on Raspberry Pi, Setup RS232 or UART pins on Raspberry Pi and Auto Run Python Script on Raspberry Pi.
15.1. Logout and shut off the power to the Raspberry Pi
15.2. Connect raspberry pi to serial/rs232 module, and LAN Router with RJ45
15.3. Unplug mouse, keyboard and monitor cables from the Raspberry Pi
3. Wiring and Connection between Raspberry Pi to Programmable Logic Controller (PLC)
3.A. Connect Raspberry Pi to LAN Router with RJ45 Cable
3.B. Connect Raspberry Pi to Serial/RS232 Module
3.C. Connect Serial/RS232 Module to Programmable Logic Controller (PLC) with RS232 crossover cable and PLC Cable
3.D. Connecting of Programmable Logic Controller (PLC) to Lamp in Home
4. Install Android Apps
Download APK File and Install to Android Phone, click here
How to use LampOnOff Android Apps:
1. Click LampOnOff
2. Edit IP Target: Ip address for raspberry pi
3. Edit Port Target to 5000
4. Click Connect, waiting until show: Lamp Num or Disconnect Button
5. Click screen for Lamp On or Lamp Off.
More information about communication between android and computer
5. Communication Test without Lamp in home, just light in PLC