ogre_c
发表于 2013-7-25 19:33:35
文章真不错,很佩服楼主的动手精神,系统很强大,期待看到楼主的github学习学习^_^。
现在为了省着拆路由,使用树莓派这个方案和楼主想到一块去了. 在树莓派上用python做个服务器进行管理。
看楼主用的是android,不知道有没有http://www.prowlapp.com/这类推送软件,要不然可以在python上做事件触发判断,触发后以发送邮件的形式,消息就可以推送到手机上了。
ogre_c
发表于 2013-7-25 19:51:12
还有一个小提议是,可以考虑在每个开关插线板上再装上一个红外小接收头,在家里的时候,拿着遥控器开关控制,这样不用去找手机,来的快。
chzhewl
发表于 2013-7-26 11:30:17
本帖最后由 chzhewl 于 2013-7-26 11:47 编辑
ogre_c 发表于 2013-7-25 19:51 static/image/common/back.gif
还有一个小提议是,可以考虑在每个开关插线板上再装上一个红外小接收头,在家里的时候,拿着遥控器开关控制 ...
内部否认你的红外提议:lol,你的提议方向很对,我总了以下几点:
1.使用事实证明手控制在家里并没想象的那么麻烦,我这个控制页面是网页实现的,只要手边一台能访问网页的设备的都可以实现控制,比如手机,ipad,pc等.
2.使用红外遥控器有一定的局限性(无法穿墙,必顺对着被遥控设备),比如控制热水器的设备是安装在洗手间里面的,在客厅使用红外肯定没法控制.
3.如果真正想方便的话,我认为在家里时单独设计一台类似于遥控器那种操作方式的设备,使用无线通讯,简单点下屏幕或按下按键就可以实现控制.
4.如果今后非特定语音控制技术成熟的话,使用语音控制会更加方便:handshake
ogre_c
发表于 2013-7-26 11:58:48
chzhewl 发表于 2013-7-26 11:30 static/image/common/back.gif
内部否认你的红外提议,你的提议方向很对,我总了以下几点:
1.使用事实证明手控制在家里并没想象的那 ...
另外,卓万的zigbee怎么样,稳定不,在家里能穿墙不?设备重启后,串口还能正常通讯吧? 今儿又想起个小建议是,可以考虑加个语音模块在路由上,开关命令发出,还有个响动,看上去像钢铁侠助手似的。
linkkl
发表于 2013-7-26 12:39:12
紧跟楼主步伐~
chzhewl
发表于 2013-7-26 13:02:42
本帖最后由 chzhewl 于 2013-7-26 13:11 编辑
ogre_c 发表于 2013-7-26 11:58 static/image/common/back.gif
另外,卓万的zigbee怎么样,稳定不,在家里能穿墙不?设备重启后,串口还能正常通讯吧? 今儿又想起个小 ...
使用中感觉这款zigbee 还是不错的, 在家里隔两堵墙也可以用,重启后可以迅速进入网络. 很稳定.至今未发现问题, 卖家的淘宝店上还有一款号称高功率1.6公里的模块, 准备有时间入手试一下. 语音模块真是想到一块去了:handshake在淘宝上发现了一款非特定语音识别的模块,地址: http://item.taobao.com/item.htm?spm=a230r.1.14.8.zCe9YK&id=14012089456&_u=q245ujt00d4 看评价还不错,也准备有时间入手玩玩呢. 如果你有这方面的资源一起交流下.:)
chzhewl
发表于 2013-7-26 13:03:06
linkkl 发表于 2013-7-26 12:39 static/image/common/back.gif
紧跟楼主步伐~
感谢支持:handshake
linkkl
发表于 2013-7-26 14:38:00
chzhewl 发表于 2013-7-26 13:03 static/image/common/back.gif
感谢支持
谢谢你的分享才对{:2_33:}学习了
ogre_c
发表于 2013-7-26 14:43:01
chzhewl 发表于 2013-7-26 13:02 static/image/common/back.gif
使用中感觉这款zigbee 还是不错的, 在家里隔两堵墙也可以用,重启后可以迅速进入网络. 很稳定.至今未发现 ...
嗯,不错,购买时是买的1个主机(协调器),几个路由的方案吗? 还是别的? 他家的zigbee没用过,不太了解。语音模块,之前想买这款来着:http://item.taobao.com/item.htm?spm=a1z10.1.w4004-1912740700.43.1x4yEO&id=25039504519主要看着挺小巧的,听过例子音频,感觉还行。我现在是用的树莓派,跑的下边这个python角本,iphone运行了一个netio的软件,通过socket和这个角本通讯,基本能达到控制灯的效果,不过还有很多不尽如人意的地方,期待也能完整读读chzhewl 兄的python:)
# coding=utf-8
import socket
import SocketServer
import os
import RPi.GPIO as GPIO
import time
import serial
# Setup serial connection to arduino
DEVICE = "/dev/ttyAMA0"
BAUD = 9600
ser = serial.Serial(DEVICE, BAUD)
#Variables
comingHomeStatus = 0
class MyTCPHandler(SocketServer.BaseRequestHandler):
"""
The RequestHandler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""
def handle(self):
global comingHomeStatus, ser
while 1:
# self.request is the TCP socket connected to the client
self.data = self.request.recv(1024).strip()
if not self.data: break
print "Incoming connection from: {}".format(self.client_address)
print "Received data:", self.data
#LED1
if self.data == 'led1 on':
ser.write('{"ID":1,"things":"light","command":"on"}')
print 'received on'
self.request.sendall('led1 open')
elif self.data == 'led1 off':
ser.write('{"ID":1,"things":"light","command":"off"}')
print 'received off'
self.request.sendall('led1 close')
#LED2
if self.data == 'led2 on':
ser.write('{"ID":2,"things":"light","command":"on"}')
print 'received on'
self.request.sendall('led2 open')
elif self.data == 'led2 off':
ser.write('{"ID":2,"things":"light","command":"off"}')
print 'received off'
self.request.sendall('led2 close')
### GROUPED LIGHTS
#Coming-home-lights
if self.data == 'comingHomeOn':
self.request.sendall('On')
GPIO.output(5, True)
GPIO.output(11, True)
GPIO.output(12, True)
comingHomeStatus = 1
elif self.data == 'comingHomeOff':
self.request.sendall('Off')
GPIO.output(5, False)
GPIO.output(11, False)
GPIO.output(12, False)
comingHomeStatus = 0
#Turn all indoor lights off
if self.data == 'allIndoorLightsOff':
print "Turning all indoor lights off"
GPIO.output(5, False) #Garage roof light
GPIO.output(7, False) #Workshop roof light
GPIO.output(8, False) #Storage roof light
self.request.sendall('.')
#Turn all outdoor lights off
if self.data == 'allOutdoorLightsOff':
print "Turning all outdoor lights off"
GPIO.output(11, False) #Driveway light
GPIO.output(12, False) #Carport light
GPIO.output(13, False) #Workshop light
GPIO.output(16, False) #Storage light
self.request.sendall('.')
### INDOOR LIGHTS
#Garage roof light
if self.data == 'garageRoofOn':
print "Turning garage roof light on"
GPIO.output(5, True)
self.request.sendall('.')
elif self.data == 'garageRoofOff':
print "Turning garage roof light off"
GPIO.output(5, False)
self.request.sendall('.')
#Workshop roof light
if self.data == 'workshopRoofOn':
print "Turning workshop roof light on"
GPIO.output(7, True)
self.request.sendall('.')
elif self.data == 'workshopRoofOff':
print "Turning workshop roof light off"
GPIO.output(7, False)
self.request.sendall('.')
#Storage roof light
if self.data == 'storageRoofOn':
print "Turning storage roof light on"
GPIO.output(8, True)
self.request.sendall('.')
elif self.data == 'storageRoofOff':
print "Turning storage roof light off"
GPIO.output(8, False)
self.request.sendall('.')
### OUTDOOR LIGHTS
#Driveway light
if self.data == 'drivewayOn':
print "Turning driveway light on"
GPIO.output(11, True)
self.request.sendall('.')
elif self.data == 'drivewayOff':
print "Turning driveway light off"
GPIO.output(11, False)
self.request.sendall('.')
#Carport light
if self.data == 'carportOn':
print "Turning carport light on"
GPIO.output(12, True)
self.request.sendall('.')
elif self.data == 'carportOff':
print "Turning carport light off"
GPIO.output(12, False)
self.request.sendall('.')
#Workshop light
if self.data == 'workshopOn':
print "Turning workshop light on"
GPIO.output(13, True)
self.request.sendall('.')
elif self.data == 'workshopOff':
print "Turning workshop light off"
GPIO.output(13, False)
self.request.sendall('.')
#Storage light
if self.data == 'storageOn':
print "Turning storage light on"
GPIO.output(16, True)
self.request.sendall('.')
elif self.data == 'storageOff':
print "Turning storage light off"
GPIO.output(16, False)
self.request.sendall('.')
### STATUS SENDS
#Garagedoor button text
if self.data == 'door_button':
if GPIO.input(15):
self.request.sendall('Close')
#GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_UP)
print "Sending buttontext: Close"
else:
self.request.sendall('Open')
#GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
print "Sending buttontext: Open"
#Garagedoor position
if self.data == 'door_status':
#print "Sending Door status: ", GPIO.input(15)
if GPIO.input(15):
print "Sending that garagedoor is open"
self.request.sendall('open')
else:
print "Sending that garagedoor is closed"
self.request.sendall('closed')
#Coming-home-lights status
if self.data == 'comingHomeStatus':
if comingHomeStatus == 1:
self.request.sendall('On')
print "Sending that coming home lights are on"
else:
self.request.sendall('Off')
print "Sending that coming home lights are off"
if __name__ == "__main__":
HOST, PORT = "", 54321
# Create the server, binding to localhost on port 54321
server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server.serve_forever()
chzhewl
发表于 2013-7-26 17:01:51
ogre_c 发表于 2013-7-26 14:43 static/image/common/back.gif
嗯,不错,购买时是买的1个主机(协调器),几个路由的方案吗? 还是别的? 他家的zigbee没用过,不太了解。 ...
:handshake zigbee 使用协调器和路由, 代码在卖家发货前已经刷好的. 这款语音模块好小啊,但是只能合成语音不能识别吧? 看了你的python 代码,大体明白了实现原理,很好的思路.我的实现基本上没用到python,用c++写的(回头准备换成python 的,维护起来容易很多),代码还没整理,有需要可以传你份.
ogre_c
发表于 2013-7-26 20:18:43
chzhewl 发表于 2013-7-26 17:01 static/image/common/back.gif
zigbee 使用协调器和路由, 代码在卖家发货前已经刷好的. 这款语音模块好小啊,但是只能合成语音 ...
嗯,这只是一个语音合成模块,语音识别的话发现taobao上LD3320 ASR语音模块的方案很多,不过我也没玩过,不知道实际效果怎么样。那个语音合成模块到不是60元那种模块能比的,出来的语音感觉很自然,好像还有4-5种男声女音可选,所以有点心动。chzhewl要方便的话,代码发我
[email protected]邮箱一份,我现在arduino端用ajson解析的这种{"ID":1,"things":"light","command":"off"}字符串响应命令的,所以稳定性不如你那种有数据包头的好, 学习一下你的思路。
chzhewl
发表于 2013-7-29 13:28:07
ogre_c 发表于 2013-7-26 20:18 static/image/common/back.gif
嗯,这只是一个语音合成模块,语音识别的话发现taobao上LD3320 ASR语音模块的方案很多,不过我也没玩过, ...
邮件已发送
ogre_c
发表于 2013-7-29 21:25:22
chzhewl 发表于 2013-7-29 13:28 static/image/common/back.gif
邮件已发送
谢谢无为!!待我研究研究,感谢啊:D
huang1234
发表于 2013-7-29 23:58:37
很给力啊!感觉楼主的继电器模块可用光耦代替,那样体积会小很多的样子!
frankmcu
发表于 2013-7-31 15:21:07
很好的文章,这个要顶。
页:
1
2
3
4
5
[6]
7
8
9
10
11
12