Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use infrared remote control to control raspberry pie

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

I would like to share with you how to use infrared remote control to control raspberry pie. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it.

Before you begin, you need to follow this tutorial to build raspberry pie as an audio-visual center.

Required parts

After setting up the audio-visual center, you need to buy some parts.

Number of names

Infrared sensor

Http://adafruit.com/products/157

one

Infrared remote control

Http://adafruit.com/products/389

one

Mother to mother DuPont line

Http://adafruit.com/products/794

1 hardware connection

The infrared sensor has only three leading angles, all of which need to be connected to the GPIO pin of the raspberry pie. We need to connect them with mother-to-mother DuPont wires. A good DuPont line connected to an infrared sensor will make the connection more reliable.

Connect as shown in the following figure. The color of the jumper does not matter, but it is easier to distinguish between different colors.

Note that it takes 3.3 V to use an infrared sensor on a raspberry pie, not 5 V.

LIRC

The communication between the raspberry pie and the remote control is done through LIRC (Linux Infrared Remote Control). Most raspberry pie distributions are pre-installed, so we don't need to install them on Rasbmc, we just need to make some settings.

To ensure that the infrared hardware works properly, we can test it with a SSH connection to a raspberry pie with XBMC installed.

If you have never used SSH, please read this tutorial.

We can get the IP address of raspberry pie in XBMC's system information interface.

We need to turn off the infrared function, or we won't be able to use LIRC through SSH. Enter the XMBC settings interface, and then set the "Enable GPIO TSOP IR Receiver" option to disabled.

Remember to restart it after the change.

Then connect the raspberry pie with SSH and execute the following command:

Now operating the remote control in front of the infrared sensor, each press of the button should display a set of 'pulse' /' space' messages.

Congratulations! The infrared sensor is working normally.

Configure and test

We already know that the infrared hardware is OK, we need to give LIRC a configuration file to define the buttons on the remote control.

From a SSH session, execute the command:

Nano lircd.conf

Paste the following into the file, press CTRL-x to exit, press Y to OK.

# Please make this file available to others# by sending it to # # this config file was automatically generated# using lirc-0.9.0-pre1 (default) on Thu Mar 14 14:21:25 2013 contributed by # # brand: / home/pi/lircd.conf# model no. Of remote control: # devices being controlled by this remote:#begin remote name / home/pi/lircd.conf bits 16 flags SPACE_ENC | CONST_LENGTH eps 30 aeps 100 header 8945 4421 one 1634 zero 594 519 ptrail 598 repeat 8949 2187 pre_data_bits 16 pre_data 0xFD gap 106959 toggle_bit_mask 0x0 begin codes KEY _ VOLUMEDOWN 0x00FF KEY_PLAYPAUSE 0x807F KEY_VOLUMEUP 0x40BF KEY_SETUP 0x20DF KEY_UP 0xA05F KEY_STOP 0x609F KEY_LEFT 0x10EF KEY_ENTER 0x906F KEY_ RIGHT 0x50AF KEY_KP0 0x30CF KEY_DOWN 0xB04F KEY_BACK 0x708F KEY_KP1 0x08F7 KEY_KP2 0x8877 KEY_KP3 0x48B7 KEY_KP4 0x28D7 KEY_KP5 0xA857 KEY_KP6 0x6897 KEY_KP7 0x18E7 KEY_KP8 0x9867 KEY_KP9 0x58A7 end codesend remote

This configuration file should be placed in the home directory of the user pi.

Now, return to the XMBC settings interface to turn on the "Enable GPIO TSOP IR Receiver" option. Then set "GPIO IR Remote Profile" as shown in the following figure:

Restart XMBC and a prompt box similar to the following should be displayed in the lower right corner when booting.

The remote control should be able to use normally, no longer need the mouse and keyboard to control XMBC, oh also!

Use other models of remote control

I use a tool in LIRC, 'irrecord', to generate the remote control configuration file.

If you want to use other remote controls, you can use this tool to generate configuration files.

The steps are as follows:

Turn off the "Enable GPIO TSOP IR Receiver" option in XMBC.

Change the current lircd.conf file to a different name.

Enter the command 'irrecord-list-namespace'. Parameter indicates the name of the key that will be prompted for use.

Enter the command 'irrecord-d / dev/lirc0 ~ / lircd.conf'

Just follow the instructions. This program will automatically calculate the duration and code of the remote control.

The above is all the contents of the article "how to use infrared remote control to control raspberry pie". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report