KEMBAR78
Home Automation Using RPI | PDF
Bülent ÖZHORASAN
Ankara, 22 May 2014
Caution : Be Careful in Handling Mains Voltage!
 Welcome
 Open Source Hardware Projects Rpi, Arduino
 Raspberry Pi Features
 Possible Areas of Use
 Remote Connecting to Raspberry Pi
 Java and Raspberry Pi: Open JDK, Oracle JDK
 Installing Tomcat
 Installing no-ip.org Client and Internet Access
 Prime Faces Application Deployed in Tomcat in
Raspberry Pi
 Source Code Walkthrough
 Remote Deploying war file
 Hardware interfacing Digital Out
 Hardware interfacing Analog In
 Fritzing Tool
 Demo
Beagle Bone (Texas Instruments)
Korean Firm, former game platform
SOC: Sytem on a Chip
 Single Board Computer
 Broadcom BCM2835 system on a
chip (SoC)
 ARM1176JZF-S 700 Mhz processor
 VideoCore IV GPU
 512 MB RAM
 SD card for booting and persistent
storage.
 Linux Operating system
 Low Cost
 Low Power
 Python is the native programming
language C,Java,Perl available
 Hobbies
 Educational Purposes
 Low Cost File/Media Server
 Low Cost Web Server for small applications
 Fast Prototyping (In Development Stage)
 Even build a home brew supercomputer!
Check
 Kickstarter.com
 Make: Magazine
 Maker faires
 SSH
 Putty and WinSCP
 Without router: NO NEED for a cross-over cable.
RPi LAN chip is smart enough to reconfigure
itself for direct network connections.
 Routerless Connection: dhcpsrv2.4
 Mobile Connection: Juice SSH Android
 Open JDK,Oracle JDK
 Oracle JVM with ARM processor support is
available
 Comes in Raspberry Pi already installed
 Pi4J Lib
 Installing tomcat
Download tomcat package and unzip it to /usr/lib/apache-tomcat-
7.0.47
tar xzf apache-tomcat-7.0.28.tar.gz
cd apache-tomcat-7.0.28/conf
vim tomcat-users.xml
 Add a user to the authorization file
Tomcat-users.xml file
directly below <tomcat-users> add
<user username="pi" password="raspberry" roles="manager-
gui"/>
 Start Tomcat
sudo sh startup.sh
 Free Dynamic IP Adress
 Download no-ip client
wget http://www.no-ip.com/client/linux/noip-duc-
linux.tar.gz
 Run client
sudo /usr/local/bin/noip2
 Automatic startup
Create script in /etc/init.d
Can be used from Mobile Clients,too
 IoC
◦ GPIOControllerFactory
 Testability
◦ Apache Commons PropertiesConfiguration
◦ Parameters.properties
◦ MockGpioController and MockGpioPinDigitalOutput
Script using SSH command line tools
AutoDeploy.bat:
"d:programsputtypscp" -batch -pw raspberry
C:UsersRootDesktopPrime01.war pi@192.168.1.2:/home/pi
"d:programsputtyplink" -batch -ssh -2 -l pi -pw raspberry -m "deploy.cmd"
192.168.1.2
Deploy.cmd:
echo Shutting down...
sudo /usr/lib/apache-tomcat-7.0.47/bin/shutdown.sh
echo Shut down...
sudo rm -r /usr/lib/apache-tomcat-7.0.47/webapps/Prime01
sudo cp Prime01.war /usr/lib/apache-tomcat-7.0.47/webapps
echo Starting ...
sudo /usr/lib/apache-tomcat-7.0.47/bin/startup.sh
echo Started...
 Digital Outputs & Relay Driving
 Draw no more than 3mA from GPIO ports
 A small relay will draw between 50-100mA
from 5V power line.
Analog Input & Ambient Temperature Sampling
MCP3208 8-Channel
12-Bit A/D Converters
LM35 Precision Centigrade
Temperature Sensor
Bit banged SPI (Serial Peripheral Interface) interface of the A/D converter chip programmatically
Rpi, LM35 and MCP3208 Connections
 Testing other app servers namely Nginx
 Scalable i2c and SPI interfaces
 IoT namely Dweet.IO
 SQLite
 http://www.raspberrypi.org
 http://www.arduino.cc/
 http://www.dhcpserver.de/
 http://learn.adafruit.com/reading-a-analog-in-and-controlling-audiovolume-with-the-raspberry-pi
 http://pi4j.com/
 http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/
 Raspberry Pi Measurement Electronics: hardware and software [Kindle Edition]
 http://www.zdnet.com/build-your-own-supercomputer-out-of-raspberry-pi-boards-7000015831/
 http://fritzing.org/home/
 http://www.adafruit.com
 Thank you for your attention

Home Automation Using RPI

  • 1.
  • 2.
    Caution : BeCareful in Handling Mains Voltage!
  • 3.
     Welcome  OpenSource Hardware Projects Rpi, Arduino  Raspberry Pi Features  Possible Areas of Use  Remote Connecting to Raspberry Pi  Java and Raspberry Pi: Open JDK, Oracle JDK
  • 4.
     Installing Tomcat Installing no-ip.org Client and Internet Access  Prime Faces Application Deployed in Tomcat in Raspberry Pi  Source Code Walkthrough  Remote Deploying war file  Hardware interfacing Digital Out  Hardware interfacing Analog In  Fritzing Tool  Demo
  • 5.
    Beagle Bone (TexasInstruments) Korean Firm, former game platform SOC: Sytem on a Chip
  • 6.
     Single BoardComputer  Broadcom BCM2835 system on a chip (SoC)  ARM1176JZF-S 700 Mhz processor  VideoCore IV GPU  512 MB RAM  SD card for booting and persistent storage.  Linux Operating system  Low Cost  Low Power  Python is the native programming language C,Java,Perl available
  • 7.
     Hobbies  EducationalPurposes  Low Cost File/Media Server  Low Cost Web Server for small applications  Fast Prototyping (In Development Stage)  Even build a home brew supercomputer! Check  Kickstarter.com  Make: Magazine  Maker faires
  • 8.
     SSH  Puttyand WinSCP  Without router: NO NEED for a cross-over cable. RPi LAN chip is smart enough to reconfigure itself for direct network connections.  Routerless Connection: dhcpsrv2.4  Mobile Connection: Juice SSH Android
  • 9.
     Open JDK,OracleJDK  Oracle JVM with ARM processor support is available  Comes in Raspberry Pi already installed  Pi4J Lib
  • 10.
     Installing tomcat Downloadtomcat package and unzip it to /usr/lib/apache-tomcat- 7.0.47 tar xzf apache-tomcat-7.0.28.tar.gz cd apache-tomcat-7.0.28/conf vim tomcat-users.xml  Add a user to the authorization file Tomcat-users.xml file directly below <tomcat-users> add <user username="pi" password="raspberry" roles="manager- gui"/>  Start Tomcat sudo sh startup.sh
  • 11.
     Free DynamicIP Adress  Download no-ip client wget http://www.no-ip.com/client/linux/noip-duc- linux.tar.gz  Run client sudo /usr/local/bin/noip2  Automatic startup Create script in /etc/init.d
  • 12.
    Can be usedfrom Mobile Clients,too
  • 13.
     IoC ◦ GPIOControllerFactory Testability ◦ Apache Commons PropertiesConfiguration ◦ Parameters.properties ◦ MockGpioController and MockGpioPinDigitalOutput
  • 14.
    Script using SSHcommand line tools AutoDeploy.bat: "d:programsputtypscp" -batch -pw raspberry C:UsersRootDesktopPrime01.war pi@192.168.1.2:/home/pi "d:programsputtyplink" -batch -ssh -2 -l pi -pw raspberry -m "deploy.cmd" 192.168.1.2 Deploy.cmd: echo Shutting down... sudo /usr/lib/apache-tomcat-7.0.47/bin/shutdown.sh echo Shut down... sudo rm -r /usr/lib/apache-tomcat-7.0.47/webapps/Prime01 sudo cp Prime01.war /usr/lib/apache-tomcat-7.0.47/webapps echo Starting ... sudo /usr/lib/apache-tomcat-7.0.47/bin/startup.sh echo Started...
  • 15.
     Digital Outputs& Relay Driving  Draw no more than 3mA from GPIO ports  A small relay will draw between 50-100mA from 5V power line.
  • 16.
    Analog Input &Ambient Temperature Sampling MCP3208 8-Channel 12-Bit A/D Converters LM35 Precision Centigrade Temperature Sensor Bit banged SPI (Serial Peripheral Interface) interface of the A/D converter chip programmatically Rpi, LM35 and MCP3208 Connections
  • 18.
     Testing otherapp servers namely Nginx  Scalable i2c and SPI interfaces  IoT namely Dweet.IO  SQLite
  • 20.
     http://www.raspberrypi.org  http://www.arduino.cc/ http://www.dhcpserver.de/  http://learn.adafruit.com/reading-a-analog-in-and-controlling-audiovolume-with-the-raspberry-pi  http://pi4j.com/  http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/  Raspberry Pi Measurement Electronics: hardware and software [Kindle Edition]  http://www.zdnet.com/build-your-own-supercomputer-out-of-raspberry-pi-boards-7000015831/  http://fritzing.org/home/  http://www.adafruit.com
  • 21.
     Thank youfor your attention