1cd2ee3b89ccff4de6f02f3f9985a973.ppt
- Количество слайдов: 26
Home Automation with Perl and X 10 Mike Schilli, Yahoo! 06/25/2007
What’s X 10? • Sender sends signals over power lines • Receiver switches electrical devices on/off • Cheap Technology – Sender $10 – Receiver $10
What can you do with X 10? Examples include … • Water your plants • Reboot your cable modem • Control any device via Gaim/Jabber
X 10 Signal Flow
X 10 CM 11 Control Unit • Serial plug connects to PC • Power plug injects X 10 signals into power line • < $10 plus shipping on Ebay • Don’t have a serial port? Buy a PCI card (tty. S 4/5) • Alternatively: CM 17 (RF)
No Serial Port? • PC: $10 PCI card – /dev/tty. S 4 • Mac: $30 Keyspan 19 HS – /dev/tty. S 0
Receiver • E. g. connected to your Cable Modem:
Protocol • One four-bit house code (A-P) • One or more four-bit unit code(s) (1 -16) • One four-bit command • Example: “House Code K”, “Unit 9”, “Turn on”
How X 10 transmits
How X 10 transmits
Protocol • 1110 Starting sequence • Binary 1: Presence, Absence • Binary 0: Absence, Presence • Each signal sent twice • Overall data transfer: 20 bits/sec
Setting up a serial port • Init serial port: use Device: : Serial. Port; my $serial = Device: : Serial. Port->new( “/dev/tty. S 0”, undef); $serial->baudrate(4800); • Send command: use Control. X 10: : CM 11; Control. X 10: : CM 11: : send($serial, $house_code. $unit_code); Control. X 10: : CM 11: : send($serial, $house_code. “J”); # J=ON K=OFF
Receivers • Lamp Module: – Triac Solid State – On/Off/Dimming – No Appliances or electronic devices • Appliance Module: – Relay switches On/Off – Maintains last state during power outages
Example 1: Lights on/off with Gaim • Net: : Jabber
Example 1: Lights on/off with Gaim • A Jabber listener performs X 10: : CM 11 commands:
Example 2: X 10 Console • YUI components for ajaxed web console • Reboot routers, print servers, DSL modem
Example 3: Water your Plants • Aquarium Pump in Water container • Switched on/off by X 10 • Host checks weather report (Weather: : Com) to determine amount of water • Secured by external timer
Video Demo
X 10: : Home use X 10: : Home; my $x 10 ->X 10: : Home->new(); # Address services by name $x 10 ->send("bedroom_lights", "on"); # Also remembers status
X 10: : Home #x 10. conf sample file module: Control. X 10: : CM 11 device: "/dev/tty. S 0“ receivers: - name: office_lights code: K 10 desc: Office Back Lights - name: water code: K 11 desc: Plant Sprinkler
Problems with X 10 • • • No security on the X 10 level No feedback with cheap units Signals get lost Power outages might affect outcome Two senders: Collisions Slow (1 sec/command)
Precautions • Use Fail Safe strategies • Limit potential damage • Consider additional autonomous devices like digital timers
Q&A Questions?
Thanks! Contact: mschilli@yahoo-inc. com
References • X 10 YUI Console http: //www. linuxmagazin. de/heft_abo/ausgaben/2007/04/heimsc haltwarte • http: //www. linuxmagazine. com/issue/50/Perl_Building_a_Jabber _Bot. pdf • ftp: //ftp. x 10. com/pub/manuals • http: //misterhouse. net • Moshe Bar, “Home Automation with Perl”, TPJ, 02/2003
References (continued) http: //forums. cabling-design. com/X 10 -and. Linux-article 12453 --49. htm


