Arduino i rremote 1112
-
Upload
- -
Category
Technology
-
view
4.307 -
download
14
Transcript of Arduino i rremote 1112
![Page 1: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/1.jpg)
Arduino紅外線遙控
Cooper Maa
德明 Arduino 開發經驗分享 - 2011
http://www.danielandrade.net/
![Page 2: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/2.jpg)
Arduino
ARRRR, /
/ DWEE, just say "do we“ fast /
/ NO, as in no.
”ARRR-DWEE-NO”
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1191602549%3Bstart=all
![Page 3: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/3.jpg)
What is Arduino?
• Open Source + Software IDE + Community
Hardware
![Page 4: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/4.jpg)
What is for today?
• 接收紅外線訊號
• A Simple DIY IR Decoder
• 發射紅外線訊號
• DIY Keypad Remote Control
![Page 5: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/5.jpg)
Infrared Remote Control
• 非常普遍使用的無線通訊
• 用於電視、冷氣、DVD Player、MP3 Player, 玩具遙控車等各種設備的控制
![Page 6: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/6.jpg)
Arduino & IRRemote
• With Arduino & IRRemote Library, you can make your own infrared applications.
![Page 7: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/7.jpg)
What you need?
• First, you need an Arduino board and an USB cable
![Page 8: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/8.jpg)
What you need?
• Second, you need Arduino IDE to write program
![Page 9: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/9.jpg)
What you need?
• Third, an infrared receiver and a 940 nm Infrared LED (a.k.a Infrared Emitter)
![Page 10: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/10.jpg)
What you need?
• Last, download and install IRRemoteLibrary: http://goo.gl/2HKLm
![Page 11: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/11.jpg)
Make sure things work
• Load "File > Examples > 1.Basics > Blink"
![Page 12: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/12.jpg)
Examples used in this opentalk
• For your convenience, the examples used in this opentalk has been uploaded to google doc, you can download the examples from the following url:
http://goo.gl/KSOu6
![Page 13: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/13.jpg)
What is for today?
• 接收紅外線訊號
• A Simple DIY IR Decoder
• 發射紅外線訊號
• DIY Keypad Remote Control
![Page 14: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/14.jpg)
接收紅外線訊號
• The wiring:
![Page 15: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/15.jpg)
接收紅外線訊號• Load "File > Sketchbook > IRRemoteExamples > Example1_1"
![Page 16: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/16.jpg)
接收紅外線訊號
• Try your remote:
![Page 17: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/17.jpg)
接收紅外線訊號
• Open Serial Monitor and see the result:
![Page 18: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/18.jpg)
Four steps to receive Infrared signals
1. 引用 IRRemote 函式庫:#include <IRremote.h>
2. 建立 IRrecv 物件及 decode_results變數:const int irReceiverPin = 2; // 紅外線接收器 VOUT 腳位
IRrecv irrecv(irReceiverPin); // 用來接收紅外線訊號
decode_results results; // 用來存放解碼結果
3. 啟動紅外線解碼:irrecv.enableIRIn(); // 啟動紅外線解碼
4. 檢查有沒收到紅外線:if (irrecv.decode(&results)) { // 解碼成功…
![Page 19: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/19.jpg)
decode_results structure• The structure of decode_results
![Page 20: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/20.jpg)
decode_results structure• The structure of decode_results
![Page 21: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/21.jpg)
顯示紅外線協定種類
• Load "File > Sketchbook > IRRemoteExamples > Example1_2"
![Page 22: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/22.jpg)
顯示紅外線協定種類
• Open Serial Monitor and see the result:
![Page 23: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/23.jpg)
Infrared LED Indicator• Load "File > Sketchbook > IRRemoteExamples > Example1_3v2"
![Page 24: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/24.jpg)
Infrared LED Indicator
• The infrared LED indicator will blink when infrared signal is received.
![Page 25: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/25.jpg)
What is for today?
• 接收紅外線訊號
• A Simple DIY IR Decoder
• 發射紅外線訊號
• DIY Keypad Remote Control
![Page 26: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/26.jpg)
A simple DIY IR Decoder• http://coopermaa2nd.blogspot.com/2011/03/14-lcd-ir-decoder.html
• The Wiring:
![Page 28: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/28.jpg)
A simple DIY IR Decoder
• The result of decoded infrared signals will shown on the LCD:
![Page 29: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/29.jpg)
What is for today?
• 接收紅外線訊號
• A Simple DIY IR Decoder
• 發射紅外線訊號
• DIY Keypad Remote Control
![Page 30: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/30.jpg)
發射紅外線訊號• The wiring (IR LED 一定要接在 pin 3):
![Page 31: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/31.jpg)
發射紅外線訊號• Load "File > Sketchbook > IRRemoteExamples > Example2_1"
![Page 32: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/32.jpg)
Three steps to send Infrared signals
1. 引用 IRRemote 函式庫:#include <IRremote.h>
2. 建立 IRsend 物件:IRsend irsend; // 定義 IRsend 物件來發射紅外線訊號
3. 呼叫對應的 sendXXX() 函式發射紅外線訊號:irsend.sendNEC(0x4FB48B7, 32); // 記得換成你的紅外線編碼
![Page 33: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/33.jpg)
DIY Keypad Remote Control• http://coopermaa2nd.blogspot.com/2011/04/22-keypad.html
• The Wiring:
![Page 35: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/35.jpg)
DIY Keypad Remote Control
• Now you have made a simple Remote Control using Keypad and just a simple infrared LED:
![Page 36: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/36.jpg)
Questions?
![Page 37: Arduino i rremote 1112](https://reader031.fdocument.pub/reader031/viewer/2022020101/559793ae1a28abdd108b4657/html5/thumbnails/37.jpg)
References
• IRRemote 紅外線遙控教學
• 紅外線遙控原理與 NEC IR Protocol
• WinLIRC 紅外線遙控電腦