楼主: baoxiaozhong
收起左侧

Raspbmc 设置红外线接收器

 楼主| 2013-1-22 17:02:05 | 显示全部楼层
本帖最后由 baoxiaozhong 于 2013-1-22 17:20 编辑
linux0ne 發表於 2013-1-22 15:25
你是否可以翻譯一下這個文章,這是一個用pi結合iphone手機開啟車庫門的創意,也是不錯的,只是E文能力不濟, ...

Hi, this is my first real Raspberry Pi project - SiriProxy running on the Raspberry Pi, along with wiringPi to access the Pi's GPIO pins and turn a relay on/off. The relay is then hooked up to my automatic garage door system. So, I have control of the door with Siri on my iPhone.
大意為作者想要用PI的 GPIO 來控制RELAY的 開關,進而控制車庫的門,(車庫門在中國或是台灣大都是鐵捲門,所以應該是上 停 下 三個RELAY),然後用Siri 語音控制iPhone手機,然後送訊號給 Pi 。

註︰事實上這個並不難,知道GPIO的定義腳,送出 上 停 下三個訊號,可能只難在SIRI的部份,這部份APP可能比較不好寫。

There are probably other ways to do the same thing, such as running a web server on the Pi and have that access the GPIO's etc but I basically cobbled this together for my own needs - and it works fine.

作者認為要利用網頁伺服器架在PI來做。

I am running the Pi as "root" for this whole setup as it just makes things easier for me and I'm using the "wheezy" distro.
Follwing the instructions here: http://www.idownloadblog.com/201 ... oxy-tutorial-video/ should get SiriProxy up and running, if you do follow these instructions then swap commands 11, 12 and 13 to 12, 13, 11. Command 7 by the way will take about 90 minutes to compile on the pi!

作者利用 wheezy 這個OS,取的root 權限進行規劃,並且依照 http://www.idownloadblog.com/201 ... oxy-tutorial-video/ 這個網頁的說明,安裝了 SiriProxy 這個程式。

註:也就是說作者不是自行寫 app,而是利用現有的軟體,讓siri 語音系統能夠直接丟指令給另一個作業系統,但是在另一個作業系統上,你必需安裝GIT 程式,來與 iphone OS 溝通。

Then install wiringPi from https://projects.drogon.net/raspberry-p ... d-install/
GIT 安裝方法在這裡 https://projects.drogon.net/rasp ... wnload-and-install/
依照他提供的方法安裝GIT 在你的Pi 上,其中 WiringPi 是要自已編譯的。

Once these are installed its just a case of modifying the example ruby script included with siriproxy.
Edit this file: /root/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb

在這裡要編輯 /root/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb 這個檔案,將下面的程式碼貼上去。 你可以用 sudo nano /root/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb 新增檔案,按 ctrl+o存檔,ctrl+x 離開,先找到下面的程式碼:
listen_for /test siri proxy/i do
    say "Siriproxy is up and running!" #say something to the user!

    request_completed #always complete your request! Otherwise the phone will "spin" at the user!
  end
然後再換成或加入下面的程式碼:
     listen_for /open the garage door/i do
        say "Opening the garage door.."
        request_completed
        system("gpio mode 1 out")
        system("gpio write 1 1")
        system("sleep 0.5")
        system("gpio write 1 0")
      end

      listen_for /close the garage door/i do
        say "Closing the garage door.."
        request_completed
        system("gpio mode 1 out")
        system("gpio write 1 1")
        system("sleep 0.5")
        system("gpio write 1 0")
      end

從上面程式碼中,你可以看到 說 Opening the garage door 就是開門(只能說英文,不能說中文),控制gpio mode 1 輸出, 說 Closing the garage door  ,也是控制gpio mode 1 輸出。

註:這裡我認為有點問題,也就是它開和關門,都是同一個點,與我們常用的鐵捲門開關是不同的,。

As you can see, the ruby script is basically calling "system" commands to access wiringPi. Setting a GPIO pin as an output then setting it high for half a second then low again.

作者說這就是一個基本的程式碼,讓你知道它是如何運作的。

You can have siri to call any command you can type in a terminal window, such as a passwordless SSH login to a remote pc to have it shut down or rebooted.

作者說你現在應該會利用siri來呼叫Pi幫你做事了吧,基至你可以用來幫你做電腦上的重啟或是開關機。

listen_for /turn off my laptop/i do
    response = ask "Are you sure you want me to shut down your laptop?"

    if(response =~ /yes/i)
      say "OK, I'll shut it down now.."
      system("ssh root@192.168.1.74 shutdown -h now")
    else
      say "OK, I wont!"
    end

    request_completed
  end
作者又舉個例子,教你如何用siri 的語音來做電腦的SSH 登入,然後關機動作。在這裡是 SSH登入 192.168.1.74,而且是以root帳號進行關機。

作者把他控制車庫門的影片貼在下面網址,你可能要翻牆才看的到:
http://www.youtube.com/watch?v=NUJ5z76Xv5o&feature=youtu.be

註:影片中作者的門,並不是鐵捲門,而是一整個門板上下翻,所以只用一個relay,不過作者提供了很好的控制理念,用語音控制pi(事實上是控制 iOS,也就是說你要先買一台 iOS 設備)幫你完成一些事情。

另外如果看不到影片,請再通知我一下,我再把影片傳到國內網站,不過也沒什麼可以看的,就是你對手機叫開門,然後pi就輸出訊號到relay ,relay 動作輸出訊號給車庫門開關,車庫門就進行開或關的動作。
回复 支持 反对

使用道具 举报

2013-1-24 19:57:00 | 显示全部楼层
baoxiaozhong 发表于 2013-1-22 17:02
Hi, this is my first real Raspberry Pi project - SiriProxy running on the Raspberry Pi, along with ...

verry感谢你的翻译,大体上有了思路了。
视频我看到了,他的门和我们的确实不一样。
这个无线操作需要wifi环境或者是VPN,应该是这样……

只是不知道如何具体的实现,而恰巧我手里有一部iphone3GS手机,但无wifi功能 -_-.

再次感谢你的翻译,期待那34个链接中你还会有新的翻译作品出现。
回复 支持 反对

使用道具 举报

2013-1-24 19:59:53 | 显示全部楼层
baoxiaozhong 发表于 2013-1-22 15:08
目前卡在一个地方,那就是字幕问题,射手网抓下来字幕,有时候会发生时间徧移的情形,射手播放器(WIN 版本) ...

这个我还真没有经验,因为我下载的影片都是带中文字幕的,所以不用这个插件。
回复 支持 反对

使用道具 举报

 楼主| 2013-1-24 23:13:30 | 显示全部楼层
linux0ne 发表于 2013-1-24 19:57
verry感谢你的翻译,大体上有了思路了。
视频我看到了,他的门和我们的确实不一样。
这个无线操作需要w ...

其实在美国3G&4G覆盖率已经很普及,如果加上pi能够取的实体ip的port,那就不用wif&vpn了。
回复 支持 反对

使用道具 举报

 楼主| 2013-1-24 23:19:15 | 显示全部楼层
linux0ne 发表于 2013-1-24 19:59
这个我还真没有经验,因为我下载的影片都是带中文字幕的,所以不用这个插件。

字幕徧移和时间的调整,这几天我已经测出来了,因为看这篇文章,讨论的人并不多,所以我就没再写下去了,目前Raspbmc算是已经完全取代射手播放器了。

目前尚无法解决的还有声音控制:射手播放器可以调整到原来的声音1000%,字幕编码:射手播放器自动将你下载下来的字幕转换为你现在的使用环境,例如下载下来是GB 简体,会自动调整为使用环境 BIG5 正体,这二个部份还在找解决方案。
回复 支持 反对

使用道具 举报

2013-1-25 10:01:48 | 显示全部楼层
baoxiaozhong 发表于 2013-1-24 23:13
其实在美国3G&4G覆盖率已经很普及,如果加上pi能够取的实体ip的port,那就不用wif&vpn了。

恩,在发达国家确实是有着极为方便的无线网络资源,更有良好的语言环境和代码环境……
but,中国就不是这样了,不过物联技术还是相当有前景的。
回复 支持 反对

使用道具 举报

2013-1-26 17:26:30 | 显示全部楼层
linux0ne 发表于 2013-1-22 15:25
你是否可以翻译一下这个文章,这是一个用pi结合iphone手机开启车库门的创意,也是不错的,只是E文能力不济, ...

翻译了,你看看  http://www.shumeipai.net/thread-12387-1-1.html
回复 支持 反对

使用道具 举报

2013-1-26 18:47:31 | 显示全部楼层
linux0ne 发表于 2013-1-22 15:25
你是否可以翻译一下这个文章,这是一个用pi结合iphone手机开启车库门的创意,也是不错的,只是E文能力不济, ...

发送到太空的也翻译了一部分,实在太长了。

http://www.shumeipai.net/thread-12391-1-1.html

后续接着翻译。
回复 支持 反对

使用道具 举报

2013-1-28 08:24:51 | 显示全部楼层
whtech 发表于 2013-1-26 18:47
发送到太空的也翻译了一部分,实在太长了。

http://www.shumeipai.net/thread-12391-1-1.html

感谢,十分感谢 ,有好的E文基础,做这样的事儿实在是意义重大。
你可以和版主联系,单独开一个翻译的版块或者专题了。
回复 支持 反对

使用道具 举报

2013-2-4 12:42:11 | 显示全部楼层
是不是所有的红外要控制,都可以集成到这个里面啊?
电视机的、空调的等等?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热点推荐

关注我们,了解更多

官方微信

服务时间:10:00-16:00

13714503811

公司地址:深圳市龙岗区南湾街道东门头路8号

Copyright © 2012-2020 Powered by 树莓派论坛 2019.4  粤ICP备15075382号-1
快速回复 返回列表 返回顶部