SlideShare a Scribd company logo
1 of 33
Download to read offline
1032
Practical Linux System Administration
Final Report
Group 8 - 吳 芷 恩 <100212067>
1
題目
2
題目發想緣起
3
實作所需材料
4
材料 取得來源 價格
Raspberry Pi BlueT $--
Logitech Webcam C310 PChome $699
Servo motor SG90 Ruten $48
Stepper motor 28BYJ-48-5V Ruten $50
ULN2003 Driver Board Ruten $27
Dupont Line Ruten $20
Steel wire Hardware store $5
Mouse toy DAISO $39
★ Web server - LAMP
★ Automatically send ip to Email - Postfix
運用與課程內容中相關的技巧
5
★ Stepper motor
○ software: Pi4J http://pi4j.com/
○ code:https://github.com/Pi4J/pi4j/blob/master/pi4j-
example/src/main/java/StepperMotorGpioExample.java
★ Servo motor
○ software: Python
○ code:https://www.youtube.com/watch?v=ddlDgUymbxc
★ Webcam
○ software: MJPG-streamer http://sourceforge.net/projects/mjpg-
streamer/
★ Webpage
○ software: LAMP
○ code: HTML, PHP, JavaScript AJAX http://php.
net/manual/en/function.shell-exec.php http://www.w3schools.
com/ajax/ajax_example.asp
使用的現有軟體與來源
6
ULN2003
Driver Board
(Stepper motor)
實作過程 - GPIO 配置
7
Servo motor
實作過程 - GPIO 配置 (cont’d)
8
實作過程 - webcam
9
Builds MJPG-streamer
➢ sudo apt-get update
➢ sudo apt-get install subversion libjpeg8-dev imagemagick
➢ sudo svn checkout svn://svn.code.sf.net/p/mjpg-streamer/code
➢ cd code/mjpg-streamer
➢ sudo make clean all
➢ export LD_LIBRARY_PATH=.
➢ ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
Auto run MJPG-streamer when pi boots up
➢ sudo vim /etc/rc.local
➢ add codes before exit 0 :
export STREAMER_PATH=/home/pi/code/mjpg-streamer
export LD_LIBRARY_PATH=$ STREAMER_PATH
$STREAMER_PATH/mjpg_streamer -i “input_uvc.so -y = YUYV” -o
“output_http.so -w $STREAMER_PATH/www” &s
實作過程 - MJPG-streamer
10
★ servo90.php
<?php
echo shell_exec("sudo python servo90.py")
?>
實作過程 - Coding
(servo90.php & servo90.py)
11
★ servo90.py
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
p = GPIO.PWM(7,50)
p.start(7.5)
count=0
while (count<4):
p.ChangeDutyCycle(2.5)
time.sleep(0.25)
p.ChangeDutyCycle(7.5)
time.sleep(0.25)
count=count+1
p.stop()
GPIO.cleanup()
★ servo180.php
<?php
echo shell_exec("sudo python servo180.py")
?>
實作過程 - Coding
(servo180.php & servo180.py)
12
★ servo180.py
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
p = GPIO.PWM(7,50)
p.start(7.5)
count=0
while (count<4):
p.ChangeDutyCycle(12.5)
time.sleep(0.5)
p.ChangeDutyCycle(2.5)
time.sleep(0.5)
count=count+1
p.stop()
GPIO.cleanup()
★ step45.php
<?php
echo shell_exec("sudo java -classpath .:classes:
/opt/pi4j/lib/'*' step45")
?>
★ step-45.php
<?php
echo shell_exec("sudo java -classpath .:classes:
/opt/pi4j/lib/'*' stepm45")
?>
★ step90.php
<?php
echo shell_exec("sudo java -classpath .:classes:
/opt/pi4j/lib/'*' step90")
?>
★ step-90.php
<?php
echo shell_exec("sudo java -classpath .:classes:
/opt/pi4j/lib/'*' stepm90")
?>
實作過程 - Coding
(step45/-45/90/-90/180/-180.php)
13
★ step180.php
<?php
echo shell_exec("sudo java -classpath .:classes:
/opt/pi4j/lib/'*' step180")
?>
★ step-180.php
<?php
echo shell_exec("sudo java -classpath .:classes:
/opt/pi4j/lib/'*' stepm180")
?>
★ step45.java
import com.pi4j.component.motor.impl.GpioStepperMotorComponent;
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;
public class step45 {
public static void main(String[] args) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Stepper Motor Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pins #00 to #03 as output pins and ensure in LOW state
final GpioPinDigitalOutput[] pins = {
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, PinState.LOW)};
實作過程 - Coding
(step45.java)
14
★ step45.java (cont’d)
// this will ensure that the motor is stopped when the program terminates
gpio.setShutdownOptions(true, PinState.LOW, pins);
// create motor component
GpioStepperMotorComponent motor = new GpioStepperMotorComponent(pins);
// @see http://www.lirtex.com/robotics/stepper-motor-controller-circuit/
// for additional details on stepping techniques
// create byte array to demonstrate a double-step sequencing
// (In this method two coils are turned on simultaneously. This method does not generate
// a smooth movement as the previous method, and it requires double the current, but as
// return it generates double the torque.)
byte[] double_step_sequence = new byte[4];
double_step_sequence[0] = (byte) 0b0011;
double_step_sequence[1] = (byte) 0b0110;
double_step_sequence[2] = (byte) 0b1100;
double_step_sequence[3] = (byte) 0b1001;
// define stepper parameters before attempting to control motor
// anything lower than 2 ms does not work for my sample motor using single step sequence
motor.setStepInterval(1);
motor.setStepSequence(double_step_sequence);
實作過程 - Coding
(step45.java <cont’d>)
15
★ step45.java (cont’d)
// There are 32 steps per revolution on my sample motor, and inside is a ~1/64 reduction gear set.
// Gear reduction is actually: (32/9)/(22/11)x(26/9)x(31/10)=63.683950617
// This means is that there are really 32*63.683950617 steps per revolution = 2037.88641975 ~ 2038 steps!
motor.setStepsPerRevolution(2038);
motor.rotate(0.125);
System.out.println(" Motor STOPPED.");
// final stop to ensure no motor activity
motor.stop();
// stop all GPIO activity/threads by shutting down the GPIO controller
// (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks)
gpio.shutdown();
}
}
實作過程 - Coding
(step45.java <cont’d>)
16
change some code...
★ stepm45.java
public class stepm45 {
……………….
motor.rotate(-0.125);
★ step90.java
public class step90 {
……………….
motor.rotate(0.25);
★ stepm90.java
public class stepm90 {
……………….
motor.rotate(-0.25);
實作過程 - Coding
(stepm45/90/m90/180/m180.java)
17
★ step180.java
public class step180 {
……………….
motor.rotate(0.5);
★ stepm180.java
public class step180 {
……………….
motor.rotate(0.5);
★ index.php
<html>
<Iframe src="http://192.168.0.106:8080/javascript_simple.html" width="660" height="500"></Iframe>
<p>toy control:
<button type="button" name="button" onclick="servo90()">90 degrees</button>
<button type="button" name="button2" onclick="servo180()">180 degrees</button></p>
<p>Webcam control:
<img src="playmeow.png" align="right" height="100">
<button type="button" name="button3" onclick="step45()">L 45 degrees</button>
<button type="button" name="button4" onclick="stepm45()">R 45 degrees</button></p>
<p><font color="#ffffff">Webcam control: </font>
<button type="button" name="button5" onclick="step90()">L 90 degrees</button>
<button type="button" name="button6" onclick="stepm90()">R 90 degrees</button></p>
<p><font color="#ffffff">Webcam control: </font>
<button type="button" name="button7" onclick="step180()">L 180 degrees</button>
<button type="button" name="button8" onclick="stepm180()">R 180 degrees</button></p>
<script>
function servo90(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","servo90.php",true);
xmlhttp.send();
}
實作過程 - Coding
(index.php)
18
★ index.php (cont’d)
function servo180(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","servo180.php",true);
xmlhttp.send();
}
function step45(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","step45.php",true);
xmlhttp.send();
}
function stepm45(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","step-45.php",true);
xmlhttp.send();
}
function step90(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","step90.php",true);
xmlhttp.send();
}
實作過程 - Coding
(index.php <cont’d>)
19
function stepm90(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","step-90.php",true);
xmlhttp.send();
}
function step180(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","step180.php",true);
xmlhttp.send();
}
function stepm180(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("POST","step-180.php",true);
xmlhttp.send();
}
</script>
</html>
實作過程
20
實作過程
21
!在網頁上控制 伺服馬達&步進馬達 !
➔ 以超連結控制會跳出新視窗 Noooooo~!!!
Helper - RichEGG
RichEGG : 改用AJAX ~
!在沒有Public ip、路由器不是自己的情況下,從外部開啟控制網頁!
➔ DDNS 無法設定 Noooooo~!!!
➔ 以3G行動網卡代替 $_$不是長遠之計
Helper - BlueT
BlueT : 可以用ssh 或vpn解決, 到 ipv6 普及就沒有這個問題了~
➔ ssh reverse tunnel 需要額外一台有Public ip的機器=.=
➔ VPN 綁定裝置以外的裝置會無法使用 T_T
➔ 無解 >_<....
實作過程 - 困難與解決
22
實際產出 - 外觀
23
實際產出 - 外觀
24
實際產出 - 試玩(改良前)
25
實際產出 - 試玩 (改良後)
26
實際產出 - Firefox
27
實際產出 - Safari
28
實際產出 - Chrome
29
實際產出 - ipad safari
30
實際產出 - smartphone chrome
31
網頁:
http://www.w3schools.com
https://www.youtube.com/watch?v=ddlDgUymbxc
http://www.codedata.com.tw/java/java-embedded-10-gpio-motor
http://www.ntex.tw/wordpress/545.html
https://sites.google.com/site/raspberypishare0918/
http://www.powenko.com/wordpress/?p=4324
書籍:
Raspberry Pi最佳入門與實戰應用 , 柯博文 , 碁峰 ,2015-01-08
Raspberry Pi超炫專案與完全實戰 , 柯博文 , 碁峰 ,2014-09-26
參考資料
32
END
THANK YOU !
Q & A
33

More Related Content

Similar to 1032 practical linux system administration

機器學習應用於蔬果辨識
機器學習應用於蔬果辨識機器學習應用於蔬果辨識
機器學習應用於蔬果辨識Kobe Yu
 
Process Management using Circus
Process Management using CircusProcess Management using Circus
Process Management using Circussamof76
 
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)savageautomate
 
Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Dev_Events
 
Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Yu-Shuan Hsieh
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealTzung-Bi Shih
 
Free5 gc installation
Free5 gc installationFree5 gc installation
Free5 gc installationChia-An Lee
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemCyber Security Alliance
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightLinaro
 
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON
 
Webinar - Manage Firewall with Puppet
Webinar - Manage Firewall with PuppetWebinar - Manage Firewall with Puppet
Webinar - Manage Firewall with PuppetOlinData
 
Hack.LU 2018 ARM IoT Firmware Emulation Workshop
Hack.LU 2018 ARM IoT Firmware Emulation WorkshopHack.LU 2018 ARM IoT Firmware Emulation Workshop
Hack.LU 2018 ARM IoT Firmware Emulation WorkshopSaumil Shah
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Dobrica Pavlinušić
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptablesKernel TLV
 
Robotic Platform for Appearance Editing
Robotic Platform for Appearance EditingRobotic Platform for Appearance Editing
Robotic Platform for Appearance EditingTharindu Mathew
 
Palo alto outline course | Mostafa El Lathy
Palo alto outline course | Mostafa El LathyPalo alto outline course | Mostafa El Lathy
Palo alto outline course | Mostafa El LathyMostafa El Lathy
 
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineShapeBlue
 
Kernel Recipes 2015 - The Dronecode Project – A step in open source drones
Kernel Recipes 2015 - The Dronecode Project – A step in open source dronesKernel Recipes 2015 - The Dronecode Project – A step in open source drones
Kernel Recipes 2015 - The Dronecode Project – A step in open source dronesAnne Nicolas
 

Similar to 1032 practical linux system administration (20)

機器學習應用於蔬果辨識
機器學習應用於蔬果辨識機器學習應用於蔬果辨識
機器學習應用於蔬果辨識
 
Process Management using Circus
Process Management using CircusProcess Management using Circus
Process Management using Circus
 
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
RASPBERRY PI WITH JAVA 8 + Pi4J (Devoxx 2014)
 
Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...
 
Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo Run Go applications on Pico using TinyGo
Run Go applications on Pico using TinyGo
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
 
Free5 gc installation
Free5 gc installationFree5 gc installation
Free5 gc installation
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
 
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
 
Webinar - Manage Firewall with Puppet
Webinar - Manage Firewall with PuppetWebinar - Manage Firewall with Puppet
Webinar - Manage Firewall with Puppet
 
Hack.LU 2018 ARM IoT Firmware Emulation Workshop
Hack.LU 2018 ARM IoT Firmware Emulation WorkshopHack.LU 2018 ARM IoT Firmware Emulation Workshop
Hack.LU 2018 ARM IoT Firmware Emulation Workshop
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
 
Network Docs
Network DocsNetwork Docs
Network Docs
 
Robotic Platform for Appearance Editing
Robotic Platform for Appearance EditingRobotic Platform for Appearance Editing
Robotic Platform for Appearance Editing
 
Palo alto outline course | Mostafa El Lathy
Palo alto outline course | Mostafa El LathyPalo alto outline course | Mostafa El Lathy
Palo alto outline course | Mostafa El Lathy
 
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
 
Kernel Recipes 2015 - The Dronecode Project – A step in open source drones
Kernel Recipes 2015 - The Dronecode Project – A step in open source dronesKernel Recipes 2015 - The Dronecode Project – A step in open source drones
Kernel Recipes 2015 - The Dronecode Project – A step in open source drones
 

Recently uploaded

Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaDubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaUnited Arab Emirates
 
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gapedkojalkojal131
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样qaffana
 
(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...
(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...
(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...ranjana rawat
 
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...nagunakhan
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Call Girls in Nagpur High Profile
 
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service NashikLow Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...Pooja Nehwal
 
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberCall Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberMs Riya
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Pooja Nehwal
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311  Call Girls in Thane , Independent Escort Service ThanePallawi 9167673311  Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service ThanePooja Nehwal
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...Pooja Nehwal
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...Suhani Kapoor
 
presentation about microsoft power point
presentation about microsoft power pointpresentation about microsoft power point
presentation about microsoft power pointchhavia330
 
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...Pooja Nehwal
 

Recently uploaded (20)

Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaDubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
 
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai GapedCall Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
Call Girls Dubai Slut Wife O525547819 Call Girls Dubai Gaped
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
 
(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...
(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...
(MEGHA) Hinjewadi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune E...
 
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
Russian Call Girls In South Delhi Delhi 9711199012 💋✔💕😘 Independent Escorts D...
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
 
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service NashikLow Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
Low Rate Call Girls Nashik Vedika 7001305949 Independent Escort Service Nashik
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
 
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Sakshi Call 7001035870 Meet With Nagpur Escorts
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberCall Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
 
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Kothrud Call Me 7737669865 Budget Friendly No Advance Booking
 
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311  Call Girls in Thane , Independent Escort Service ThanePallawi 9167673311  Call Girls in Thane , Independent Escort Service Thane
Pallawi 9167673311 Call Girls in Thane , Independent Escort Service Thane
 
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...9004554577, Get Adorable Call Girls service. Book call girls & escort service...
9004554577, Get Adorable Call Girls service. Book call girls & escort service...
 
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Chakan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
 
presentation about microsoft power point
presentation about microsoft power pointpresentation about microsoft power point
presentation about microsoft power point
 
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...High Profile Call Girls In Andheri 7738631006 Call girls in mumbai  Mumbai ...
High Profile Call Girls In Andheri 7738631006 Call girls in mumbai Mumbai ...
 

1032 practical linux system administration

  • 1. 1032 Practical Linux System Administration Final Report Group 8 - 吳 芷 恩 <100212067> 1
  • 4. 實作所需材料 4 材料 取得來源 價格 Raspberry Pi BlueT $-- Logitech Webcam C310 PChome $699 Servo motor SG90 Ruten $48 Stepper motor 28BYJ-48-5V Ruten $50 ULN2003 Driver Board Ruten $27 Dupont Line Ruten $20 Steel wire Hardware store $5 Mouse toy DAISO $39
  • 5. ★ Web server - LAMP ★ Automatically send ip to Email - Postfix 運用與課程內容中相關的技巧 5
  • 6. ★ Stepper motor ○ software: Pi4J http://pi4j.com/ ○ code:https://github.com/Pi4J/pi4j/blob/master/pi4j- example/src/main/java/StepperMotorGpioExample.java ★ Servo motor ○ software: Python ○ code:https://www.youtube.com/watch?v=ddlDgUymbxc ★ Webcam ○ software: MJPG-streamer http://sourceforge.net/projects/mjpg- streamer/ ★ Webpage ○ software: LAMP ○ code: HTML, PHP, JavaScript AJAX http://php. net/manual/en/function.shell-exec.php http://www.w3schools. com/ajax/ajax_example.asp 使用的現有軟體與來源 6
  • 8. Servo motor 實作過程 - GPIO 配置 (cont’d) 8
  • 10. Builds MJPG-streamer ➢ sudo apt-get update ➢ sudo apt-get install subversion libjpeg8-dev imagemagick ➢ sudo svn checkout svn://svn.code.sf.net/p/mjpg-streamer/code ➢ cd code/mjpg-streamer ➢ sudo make clean all ➢ export LD_LIBRARY_PATH=. ➢ ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www" Auto run MJPG-streamer when pi boots up ➢ sudo vim /etc/rc.local ➢ add codes before exit 0 : export STREAMER_PATH=/home/pi/code/mjpg-streamer export LD_LIBRARY_PATH=$ STREAMER_PATH $STREAMER_PATH/mjpg_streamer -i “input_uvc.so -y = YUYV” -o “output_http.so -w $STREAMER_PATH/www” &s 實作過程 - MJPG-streamer 10
  • 11. ★ servo90.php <?php echo shell_exec("sudo python servo90.py") ?> 實作過程 - Coding (servo90.php & servo90.py) 11 ★ servo90.py import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(7,GPIO.OUT) p = GPIO.PWM(7,50) p.start(7.5) count=0 while (count<4): p.ChangeDutyCycle(2.5) time.sleep(0.25) p.ChangeDutyCycle(7.5) time.sleep(0.25) count=count+1 p.stop() GPIO.cleanup()
  • 12. ★ servo180.php <?php echo shell_exec("sudo python servo180.py") ?> 實作過程 - Coding (servo180.php & servo180.py) 12 ★ servo180.py import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(7,GPIO.OUT) p = GPIO.PWM(7,50) p.start(7.5) count=0 while (count<4): p.ChangeDutyCycle(12.5) time.sleep(0.5) p.ChangeDutyCycle(2.5) time.sleep(0.5) count=count+1 p.stop() GPIO.cleanup()
  • 13. ★ step45.php <?php echo shell_exec("sudo java -classpath .:classes: /opt/pi4j/lib/'*' step45") ?> ★ step-45.php <?php echo shell_exec("sudo java -classpath .:classes: /opt/pi4j/lib/'*' stepm45") ?> ★ step90.php <?php echo shell_exec("sudo java -classpath .:classes: /opt/pi4j/lib/'*' step90") ?> ★ step-90.php <?php echo shell_exec("sudo java -classpath .:classes: /opt/pi4j/lib/'*' stepm90") ?> 實作過程 - Coding (step45/-45/90/-90/180/-180.php) 13 ★ step180.php <?php echo shell_exec("sudo java -classpath .:classes: /opt/pi4j/lib/'*' step180") ?> ★ step-180.php <?php echo shell_exec("sudo java -classpath .:classes: /opt/pi4j/lib/'*' stepm180") ?>
  • 14. ★ step45.java import com.pi4j.component.motor.impl.GpioStepperMotorComponent; import com.pi4j.io.gpio.GpioController; import com.pi4j.io.gpio.GpioFactory; import com.pi4j.io.gpio.GpioPinDigitalOutput; import com.pi4j.io.gpio.PinState; import com.pi4j.io.gpio.RaspiPin; public class step45 { public static void main(String[] args) throws InterruptedException { System.out.println("<--Pi4J--> GPIO Stepper Motor Example ... started."); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // provision gpio pins #00 to #03 as output pins and ensure in LOW state final GpioPinDigitalOutput[] pins = { gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, PinState.LOW), gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, PinState.LOW)}; 實作過程 - Coding (step45.java) 14
  • 15. ★ step45.java (cont’d) // this will ensure that the motor is stopped when the program terminates gpio.setShutdownOptions(true, PinState.LOW, pins); // create motor component GpioStepperMotorComponent motor = new GpioStepperMotorComponent(pins); // @see http://www.lirtex.com/robotics/stepper-motor-controller-circuit/ // for additional details on stepping techniques // create byte array to demonstrate a double-step sequencing // (In this method two coils are turned on simultaneously. This method does not generate // a smooth movement as the previous method, and it requires double the current, but as // return it generates double the torque.) byte[] double_step_sequence = new byte[4]; double_step_sequence[0] = (byte) 0b0011; double_step_sequence[1] = (byte) 0b0110; double_step_sequence[2] = (byte) 0b1100; double_step_sequence[3] = (byte) 0b1001; // define stepper parameters before attempting to control motor // anything lower than 2 ms does not work for my sample motor using single step sequence motor.setStepInterval(1); motor.setStepSequence(double_step_sequence); 實作過程 - Coding (step45.java <cont’d>) 15
  • 16. ★ step45.java (cont’d) // There are 32 steps per revolution on my sample motor, and inside is a ~1/64 reduction gear set. // Gear reduction is actually: (32/9)/(22/11)x(26/9)x(31/10)=63.683950617 // This means is that there are really 32*63.683950617 steps per revolution = 2037.88641975 ~ 2038 steps! motor.setStepsPerRevolution(2038); motor.rotate(0.125); System.out.println(" Motor STOPPED."); // final stop to ensure no motor activity motor.stop(); // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) gpio.shutdown(); } } 實作過程 - Coding (step45.java <cont’d>) 16
  • 17. change some code... ★ stepm45.java public class stepm45 { ………………. motor.rotate(-0.125); ★ step90.java public class step90 { ………………. motor.rotate(0.25); ★ stepm90.java public class stepm90 { ………………. motor.rotate(-0.25); 實作過程 - Coding (stepm45/90/m90/180/m180.java) 17 ★ step180.java public class step180 { ………………. motor.rotate(0.5); ★ stepm180.java public class step180 { ………………. motor.rotate(0.5);
  • 18. ★ index.php <html> <Iframe src="http://192.168.0.106:8080/javascript_simple.html" width="660" height="500"></Iframe> <p>toy control: <button type="button" name="button" onclick="servo90()">90 degrees</button> <button type="button" name="button2" onclick="servo180()">180 degrees</button></p> <p>Webcam control: <img src="playmeow.png" align="right" height="100"> <button type="button" name="button3" onclick="step45()">L 45 degrees</button> <button type="button" name="button4" onclick="stepm45()">R 45 degrees</button></p> <p><font color="#ffffff">Webcam control: </font> <button type="button" name="button5" onclick="step90()">L 90 degrees</button> <button type="button" name="button6" onclick="stepm90()">R 90 degrees</button></p> <p><font color="#ffffff">Webcam control: </font> <button type="button" name="button7" onclick="step180()">L 180 degrees</button> <button type="button" name="button8" onclick="stepm180()">R 180 degrees</button></p> <script> function servo90(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","servo90.php",true); xmlhttp.send(); } 實作過程 - Coding (index.php) 18
  • 19. ★ index.php (cont’d) function servo180(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","servo180.php",true); xmlhttp.send(); } function step45(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","step45.php",true); xmlhttp.send(); } function stepm45(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","step-45.php",true); xmlhttp.send(); } function step90(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","step90.php",true); xmlhttp.send(); } 實作過程 - Coding (index.php <cont’d>) 19 function stepm90(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","step-90.php",true); xmlhttp.send(); } function step180(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","step180.php",true); xmlhttp.send(); } function stepm180(){ var xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","step-180.php",true); xmlhttp.send(); } </script> </html>
  • 22. !在網頁上控制 伺服馬達&步進馬達 ! ➔ 以超連結控制會跳出新視窗 Noooooo~!!! Helper - RichEGG RichEGG : 改用AJAX ~ !在沒有Public ip、路由器不是自己的情況下,從外部開啟控制網頁! ➔ DDNS 無法設定 Noooooo~!!! ➔ 以3G行動網卡代替 $_$不是長遠之計 Helper - BlueT BlueT : 可以用ssh 或vpn解決, 到 ipv6 普及就沒有這個問題了~ ➔ ssh reverse tunnel 需要額外一台有Public ip的機器=.= ➔ VPN 綁定裝置以外的裝置會無法使用 T_T ➔ 無解 >_<.... 實作過程 - 困難與解決 22
  • 26. 實際產出 - 試玩 (改良後) 26
  • 30. 實際產出 - ipad safari 30