[vc_row][vc_column width=”1/1″][vc_column_text]Infrared is a type of wireless communication, which can be used to transmit data wireless.
Since its invention in 1974, it has been used widely, for example, infrared mouse, infrared printer, IR keyboards and so on. However, with the advent of Bluetooth and Wifi, it has been gradually replaced by the later.
In this tutorial, we are going to how to drive LinkSprite Infrared Shield on pcDuino.
[/vc_column_text][vc_tour][vc_tab title=”Pros and Cons of Infrared Communication” tab_id=”1387857549-1-51″][vc_column_text]Pros of infrared:
1.It can enable wireless communication between cell phones and computers;
2.You can also exchange information between devices with infrared interface;
3.As it needs light of sight, the information is secured.
Cons of infrared:
1. Short communication distance, and it needs light of sight to communicate.
2.Single function, poor scalability.[/vc_column_text][/vc_tab][vc_tab title=”Difference Between Infrared and Bluetooth” tab_id=”1387857549-2-8″][vc_column_text]1.Distance:
Infrared: point to point, requires line of sight.
Bluetooth: distance up to 10 meters. Doesn’t require line of sight. It supports one point to up to 7 devices.
2. Industry:
IR: phasing out
Bluetooth: widespread applications
3. Speed:
IR: Slow
Bluetooth: Fast
4. Security:
Infrared: No difference
Bluetooth: Encryption
5. Cost:
IR: Low
Bluetooth: High
6. speed:
IR: serial speed, 57600K/bps ~ 19200K/bps
Bluetooth: 1.1Mb / s ~ 2.1Mb / s or higher (Bluetooth 2.0)[/vc_column_text][/vc_tab][vc_tab title=”Parts List” tab_id=”1387858099882-2-3″][vc_column_text]1.pcDunio
[/vc_column_text][/vc_tab][vc_tab title=”Obtain the sample code” tab_id=”1387858318244-3-6″][vc_column_text](1) $ sudo apt-get update && sudo apt-get install pcduino-linux-headers-3.4.29 +
(2) $ git clone https://github.com/liaods/modules
(If git is not found, please install it using the command $ sudo apt-get install git-core)
(3) $ cd modules / pcduino-ir-keypad /
(4) $ make M = `pwd`-C / usr/src/linux-headers-3.4.29 + /
(5) $ sudo insmod ir-keypad.ko pin = X
(X indicates the GPIO pin number that the infrared receiver is connected to pcDuino. By default, please connect to GPIO8, optional GPIO to GPIO (0-4) or GPIO (7-17). In this experiment, LinkSprite Infrared Shield is connected to GPIO 11 of pcDuino.)[/vc_column_text][/vc_tab][vc_tab title=”Test Run” tab_id=”1387858409102-4-5″][vc_column_text]Pleases install LinkSprite Infrared shield on pcDuino.
Press the button of the infrared remote control:
(1) Check the value of button:
$ sudo cat / dev/ enevt0
(2)Check the source code of infrared:
There are 32 bits of the source code. For example, the first eight bits (‘e6′) of the source code (0xe619ff00) is the data code, and the following eight bits of the source code ( ’19’) is the inverted code of the data code. The last 16 bits (‘ff00’) is the user code. Note: the user code stays same for the same infrared remote control.
$ sudo cat / proc / kmsg
The source code of the remote controller may be different for different models. It is possible that when you pressed button ‘1’ of the remote control, and it displays key value as ‘2’. So we can update the source code in ‘remote.h’ , which is located under ‘/home/ubuntu/modules/pcduino-ir-underkeypad’. Then you can obtain correct key value.
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.