37
Arduino 紅外線遙控 Cooper Maa 德明 Arduino 開發經驗分享 - 2011

Arduino i rremote 1112

  • Upload
    -

  • View
    4.307

  • Download
    14

Embed Size (px)

Citation preview

Page 1: Arduino i rremote 1112

Arduino紅外線遙控

Cooper Maa

德明 Arduino 開發經驗分享 - 2011

http://www.danielandrade.net/

Page 2: Arduino i rremote 1112

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

What is Arduino?

• Open Source + Software IDE + Community

Hardware

Page 4: Arduino i rremote 1112

What is for today?

• 接收紅外線訊號

• A Simple DIY IR Decoder

• 發射紅外線訊號

• DIY Keypad Remote Control

Page 5: Arduino i rremote 1112

Infrared Remote Control

• 非常普遍使用的無線通訊

• 用於電視、冷氣、DVD Player、MP3 Player, 玩具遙控車等各種設備的控制

Page 6: Arduino i rremote 1112

Arduino & IRRemote

• With Arduino & IRRemote Library, you can make your own infrared applications.

Page 7: Arduino i rremote 1112

What you need?

• First, you need an Arduino board and an USB cable

Page 8: Arduino i rremote 1112

What you need?

• Second, you need Arduino IDE to write program

Page 9: Arduino i rremote 1112

What you need?

• Third, an infrared receiver and a 940 nm Infrared LED (a.k.a Infrared Emitter)

Page 10: Arduino i rremote 1112

What you need?

• Last, download and install IRRemoteLibrary: http://goo.gl/2HKLm

Page 11: Arduino i rremote 1112

Make sure things work

• Load "File > Examples > 1.Basics > Blink"

Page 12: Arduino i rremote 1112

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

What is for today?

• 接收紅外線訊號

• A Simple DIY IR Decoder

• 發射紅外線訊號

• DIY Keypad Remote Control

Page 14: Arduino i rremote 1112

接收紅外線訊號

• The wiring:

Page 15: Arduino i rremote 1112

接收紅外線訊號• Load "File > Sketchbook > IRRemoteExamples > Example1_1"

Page 16: Arduino i rremote 1112

接收紅外線訊號

• Try your remote:

Page 17: Arduino i rremote 1112

接收紅外線訊號

• Open Serial Monitor and see the result:

Page 18: Arduino i rremote 1112

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

decode_results structure• The structure of decode_results

Page 20: Arduino i rremote 1112

decode_results structure• The structure of decode_results

Page 21: Arduino i rremote 1112

顯示紅外線協定種類

• Load "File > Sketchbook > IRRemoteExamples > Example1_2"

Page 22: Arduino i rremote 1112

顯示紅外線協定種類

• Open Serial Monitor and see the result:

Page 23: Arduino i rremote 1112

Infrared LED Indicator• Load "File > Sketchbook > IRRemoteExamples > Example1_3v2"

Page 24: Arduino i rremote 1112

Infrared LED Indicator

• The infrared LED indicator will blink when infrared signal is received.

Page 25: Arduino i rremote 1112

What is for today?

• 接收紅外線訊號

• A Simple DIY IR Decoder

• 發射紅外線訊號

• DIY Keypad Remote Control

Page 27: Arduino i rremote 1112

A simple DIY IR Decoder• Load from http://goo.gl/2qFfC

Page 28: Arduino i rremote 1112

A simple DIY IR Decoder

• The result of decoded infrared signals will shown on the LCD:

Page 29: Arduino i rremote 1112

What is for today?

• 接收紅外線訊號

• A Simple DIY IR Decoder

• 發射紅外線訊號

• DIY Keypad Remote Control

Page 30: Arduino i rremote 1112

發射紅外線訊號• The wiring (IR LED 一定要接在 pin 3):

Page 31: Arduino i rremote 1112

發射紅外線訊號• Load "File > Sketchbook > IRRemoteExamples > Example2_1"

Page 32: Arduino i rremote 1112

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

DIY Keypad Remote Control• http://coopermaa2nd.blogspot.com/2011/04/22-keypad.html

• The Wiring:

Page 34: Arduino i rremote 1112

DIY Keypad Remote Control• Load from http://goo.gl/Tr4a7

Page 35: Arduino i rremote 1112

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

Questions?