8回答

1收藏

[原创] 树莓派HIFI DAC扩展板教程之红外线遥控Volumio

Raspberry Pi Raspberry Pi 16745 人阅读 | 8 人回复 | 2014-06-14

本帖最后由 ukonline2000 于 2014-6-23 23:29 编辑

扩展板简介:这是一款针对树莓派设计的专用HIFI DAC扩展板,采用TI公司高端DAC芯片(PCM5102A),使用的是I2S接口,非USB接口;使用这个扩展板后用户可以配合音频播放系统(如:volumio,xbmc系统等)搭建自己的网络HIFI播放器;扩展板提供2种输出接口方便外接功放等设备。有了它就可以摆脱PC功耗大,开机关机慢,电源杂音大等等困扰了。。。。

HIFI DAC扩展板购买地址:http://item.taobao.com/item.htm?id=38890455462

遥控器购买地址:http://item.taobao.com/item.htm?spm=a1z10.3.w4002-728255483.13.dDDR5L&id=39417392370


此教程是让Volumio支持HIFI DAC扩展板的红外线功能,这样大家就可以通过手中的遥控器控制树莓派播放音乐了,不一定非要使用网络控制。

http://player.youku.com/player.php/sid/XNzI2MDQ5ODI0/v.swf

教程:

前期准备:刷入volumio系统,安装上HIFI DAC扩展板并焊上红外线接收器(如下图)

1.启动树莓派,通过网络SSH方式登录树莓派,用户名:pi 密码:raspberry

2.更新并安装lirc软件,运行以下命令:

sudo apt-get update
sudo apt-get install lirc

2. 编辑modules ,并添加配置。扩展板的红外接收器=18

sudo nano /etc/modules

添加以下两行内容到modules中

lirc_dev

lirc_rpi gpio_in_pin=18

3.编辑LRIC的配置文件使能红外线功能

sudo nano /etc/lirc/hardware.conf

修改以下行

LIRCD_ARGS=”–uinput”

DRIVER=”default”

DEVICE=”/dev/lirc0″

MODULES=”lirc_rpi”

4.执行“sudo reboot”重启树莓派,并通过“ls /dev/l*”,查看红外线设备是否使能

如果有红框中的内容就说明使能了

5.录制按键

sudo /etc/init.d/lirc stop
irrecord -n -d /dev/lirc0 ~/lircd.conf

根据提示录制你的遥控器,分别录制“pause”,“nextsong”,“prevsong”,“stop”


将录制好的~/lircd.conf文件覆盖lirc软件的相应文件

sudo cp ~/lircd.conf /etc/lirc/lircd.conf


6.启动lirc软件

sudo /etc/init.d/lirc start

7.查看录制情况,执行以下命令

irw

然后按下刚才分别录制的按键

8.编辑“.lircrc”,执行以下命令

pico ~/.lircrc

将以下内容添加到文件中

begin
        prog = irexec
        button = pause
        config = mpc toggle
end
begin
        prog = irexec
        button = nextsong
        config = mpc next;mpc play
end
begin
        prog = irexec
        button = prevsong
        config = mpc prev;mpc play
end
begin
        prog = irexec
        button = stop
        config = mpc stop
end


注:可以在这里参考mpc的命令,自行添加自己想要的按键和功能(http://linux.die.net/man/1/mpc


9.执行以下命令就能控制volumio了

irexec -d

10.编辑rc.local文件,让volumio启动后自动使能红外线接收功能,执行以下命令

sudo nano /etc/rc.local

在exit0之前,添加以下内容

(sleep 3;
sudo -u pi irexec -d
)&

保存退出,然后重启,恭喜你就成功完成红外控制volumio功能了,好好享受音乐盛宴吧!!!

博客站点:http://ukonline2000.com
网店:http://ukonline2000.taobao.com
分享到:
回复

使用道具 举报

回答|共 8 个

倒序浏览

沙发

ukonline2000

发表于 2014-6-14 02:48:54 | 只看该作者

一边看球一边写教程,必须留个沙发坐坐,表扬以下自己
博客站点:http://ukonline2000.com
网店:http://ukonline2000.taobao.com
板凳

ukonline2000

发表于 2014-6-23 21:50:49 | 只看该作者

为啥没人关注呢
博客站点:http://ukonline2000.com
网店:http://ukonline2000.taobao.com
地板

haothree

发表于 2014-6-24 08:56:41 | 只看该作者

IT宅男最近看球的多,哈哈!UK大神,必顶~
5#

ukonline2000

发表于 2014-6-24 10:34:09 | 只看该作者

haothree 发表于 2014-6-24 08:56
IT宅男最近看球的多,哈哈!UK大神,必顶~

看球玩派两不误,哈哈
博客站点:http://ukonline2000.com
网店:http://ukonline2000.taobao.com
6#

liuwent

发表于 2014-7-7 17:14:41 | 只看该作者

录制完启动后怎么没反应啊?
7#

451506709

发表于 2014-7-25 23:37:52 | 只看该作者

世界杯已过,帮顶
KingQueenWong
8#

touchstone

发表于 2014-12-31 15:22:42 | 只看该作者

楼主,我问下,为啥我irw后什么都不输出呢??
  1. Press RETURN to continue.


  2. Now start pressing buttons on your remote control.

  3. It is very important that you press many different buttons and hold them
  4. down for approximately one second. Each button should generate at least one
  5. dot but in no case more than ten dots of output.
  6. Don't stop pressing buttons until two lines of dots (2x80) have been
  7. generated.

  8. Press RETURN now to start recording.
  9. ................................................................................
  10. Found const length: 107564
  11. Please keep on pressing buttons like described above.
  12. ................................................................................
  13. Space/pulse encoded remote control found.
  14. Signal length is 67.
  15. Found possible header: 8968 4484
  16. Found trail pulse: 544
  17. Found repeat code: 8965 2267
  18. Signals are space encoded.
  19. Signal length is 32
  20. Now enter the names for the buttons.

  21. Please enter the name for the next button (press <ENTER> to finish recording)
  22. KEY_UP

  23. Now hold down button "KEY_UP".

  24. Please enter the name for the next button (press <ENTER> to finish recording)
  25. KEY_DOWN

  26. Now hold down button "KEY_DOWN".

  27. Please enter the name for the next button (press <ENTER> to finish recording)
  28. KEY_LEFT

  29. Now hold down button "KEY_LEFT".

  30. Please enter the name for the next button (press <ENTER> to finish recording)
  31. KEY_RIGHT

  32. Now hold down button "KEY_RIGHT".

  33. Please enter the name for the next button (press <ENTER> to finish recording)
  34. KEY_ESC

  35. Now hold down button "KEY_ESC".

  36. Please enter the name for the next button (press <ENTER> to finish recording)
  37. KEY_ENTER

  38. Now hold down button "KEY_ENTER".

  39. Please enter the name for the next button (press <ENTER> to finish recording)

  40. Checking for toggle bit mask.
  41. Please press an arbitrary button repeatedly as fast as possible.
  42. Make sure you keep pressing the SAME button and that you DON'T HOLD
  43. the button down!.
  44. If you can't see any dots appear, then wait a bit between button presses.

  45. Press RETURN to continue.

  46. ..............................
  47. No toggle bit mask found.
  48. Successfully written config file.
复制代码
下面这是我cat lircd.conf的内容:
  1. # Please make this file available to others
  2. # by sending it to <lirc@bartelmus.de>
  3. #
  4. # this config file was automatically generated
  5. # using lirc-0.9.0-pre1(default) on Wed Dec 31 07:07:03 2014
  6. #
  7. # contributed by
  8. #
  9. # brand:                       /home/pirc.conf
  10. # model no. of remote control:
  11. # devices being controlled by this remote:
  12. #

  13. begin remote

  14.   name  /home/pirc.conf
  15.   bits           16
  16.   flags SPACE_ENC|CONST_LENGTH
  17.   eps            30
  18.   aeps          100

  19.   header       8968  4484
  20.   one           547  1699
  21.   zero          547   570
  22.   ptrail        544
  23.   repeat       8965  2267
  24.   pre_data_bits   16
  25.   pre_data       0x2FD
  26.   gap          107564
  27.   toggle_bit_mask 0x0

  28.       begin codes
  29.           KEY_UP                   0x9867
  30.           KEY_DOWN                 0xB847
  31.           KEY_LEFT                 0x629D
  32.           KEY_RIGHT                0xE21D
  33.           KEY_ESC                  0x22DD
  34.           KEY_ENTER                0x50AF
  35.       end codes

  36. end remote
复制代码
9#

touchstone

发表于 2014-12-31 15:24:18 | 只看该作者

touchstone 发表于 2014-12-31 15:22
楼主,我问下,为啥我irw后什么都不输出呢??下面这是我cat lircd.conf的内容: ...

还有 问一下怎么修改第个人打断总的第16行的name呢?
您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条