Author: mswiniuch

[Guide] Internet radio + LCD 2x16 + TactSwitch (Ready to use)

[Copy link]

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-1-22 07:23:32 | Show all floors
Edited by kris777 at 2017-3-17 00:58

I use the remote control OrigenAE RC153 ( Armbian 5.20- system )
Configuration for it:
/etc/lirc/lircd.conf
  1. begin remote

  2.   name        OrigenAE
  3.   bits                 16
  4.   flags  RC6|CONST_LENGTH
  5.   eps                  30
  6.   aeps                100
  7.   min_repeat 1
  8.   suppress_repeat 5

  9.   header       2667   889
  10.   one           444   444
  11.   zero          444   444
  12.   pre_data_bits        21
  13.   pre_data        0x37FF0
  14.   gap              150000
  15.   toggle_bit           22
  16.   rc6_mask    0x100000000
  17.   


  18.       begin codes

  19. #seen on HP Pavilion dv3t remote  --Tim Mann, 3 Nov 2009
  20.         Media         0x00007b7f
  21.           KEY_PLAYPAUSE            0x00007b91                #  Was: PlayPause


  22. #unused by HP remote
  23.           KEY_BLUE                 0x00007ba1                #  Was: Blue
  24.           KEY_YELLOW               0x00007ba2                #  Was: Yellow
  25.           KEY_GREEN                0x00007ba3                #  Was: Green
  26.           KEY_RED                  0x00007ba4                #  Was: Red
  27.           KEY_TEXT                 0x00007ba5                #  Was: Teletext

  28. #ba6 - bae unused
  29.         BA6           0x00007ba6
  30.         BA7           0x00007ba7
  31.         BA8           0x00007ba8
  32.         BA9           0x00007ba9
  33.         BAA           0x00007baa
  34.         BAB           0x00007bab
  35.         BAC           0x00007bac
  36.         BAD           0x00007bad
  37.         BAE           0x00007bae

  38.           KEY_RADIO                0x00007baf                #  Was: Radio
  39.         Print         0x00007bb1

  40. #bb2 - bb4 unused
  41.         BB2           0x00007bb2
  42.         BB3           0x00007bb3
  43.         BB4           0x00007bb4

  44.           KEY_VIDEO                0x00007bb5                #  Was: Videos
  45.           KEY_IMAGES               0x00007bb6                #  Was: Pictures
  46.           KEY_TV2                  0x00007bb7                #  Was: RecTV
  47.           KEY_AUDIO                0x00007bb8                #  Was: Music
  48.           KEY_TV                   0x00007bb9                #  Was: TV

  49. #bba - bbf unused
  50.         BBA           0x00007bba
  51.         BBB           0x00007bbb
  52.         BBC           0x00007bbc
  53.         BBD           0x00007bbd
  54.         BBE           0x00007bbe
  55.         BBF           0x00007bbf
  56. #bc1 - bca unused
  57.         BC1           0x00007bc1
  58.         BC2           0x00007bc2
  59.         BC3           0x00007bc3
  60.         BC4           0x00007bc4
  61.         BC5           0x00007bc5
  62.         BC6           0x00007bc6
  63.         BC7           0x00007bc7
  64.         BC8           0x00007bc8
  65.         BC9           0x00007bc9
  66.         BCA           0x00007bca

  67.           KEY_EJECTCD              0x00007bcb                #  Was: Eject
  68.         SlideShow     0x00007bcc
  69.         Visualization 0x00007bcd

  70. #bce - bcf unused
  71.         BCE           0x00007bce
  72.         BCF           0x00007bcf
  73. #bd1 - bd7 unused
  74.         BD1           0x00007bd1
  75.         BD2           0x00007bd2
  76.         BD3           0x00007bd3
  77.         BD4           0x00007bd4
  78.         BD5           0x00007bd5
  79.         BD6           0x00007bd6
  80.         BD7           0x00007bd7

  81.         Aspect        0x00007bd8
  82.           KEY_EPG                  0x00007bd9                #  Was: Guide
  83.           KEY_TV                   0x00007bda                #  Was: LiveTV
  84.           KEY_DVD                  0x00007bdb                #  Was: DVD
  85. #NoGap
  86.           KEY_BACK                 0x00007bdc                #  Was: Back
  87.           KEY_OK                   0x00007bdd                #  Was: OK
  88.           KEY_RIGHT                0x00007bde                #  Was: Right
  89.           KEY_LEFT                 0x00007bdf                #  Was: Left
  90.           KEY_DOWN                 0x00007be0                #  Was: Down
  91.           KEY_UP                   0x00007be1                #  Was: Up
  92. #NoGap
  93.           KEY_NUMERIC_STAR         0x00007be2                #  Was: Star
  94.           KEY_NUMERIC_POUND        0x00007be3                #  Was: Hash
  95. #NoGap
  96.           KEY_AGAIN                0x00007be4                #  Was: Replay
  97.           KEY_NEXT                 0x00007be5                #  Was: Skip
  98.           KEY_STOP                 0x00007be6                #  Was: Stop
  99.           KEY_PAUSE                0x00007be7                #  Was: Pause
  100.           KEY_RECORD               0x00007be8                #  Was: Record
  101.           KEY_PLAY                 0x00007be9                #  Was: Play
  102.           KEY_REWIND               0x00007bea                #  Was: Rewind
  103.           KEY_FORWARD              0x00007beb                #  Was: Forward
  104. #NoGap
  105.           KEY_CHANNELDOWN          0x00007bec                #  Was: ChanDown
  106.           KEY_CHANNELUP            0x00007bed                #  Was: ChanUp
  107.           KEY_VOLUMEDOWN           0x00007bee                #  Was: VolDown
  108.           KEY_VOLUMEUP             0x00007bef                #  Was: VolUp
  109. #NoGap
  110.           KEY_INFO                 0x00007bf0
  111.           KEY_MUTE                 0x00007bf1                #  Was: Mute
  112.           KEY_HOME                 0x00007bf2                #  Was: Home
  113.           KEY_POWER                0x00007bf3                #  Was: Power
  114. #NoGap
  115.           KEY_ENTER                0x00007bf4                #  Was: Enter
  116.           KEY_CLEAR                0x00007bf5                #  Was: Clear
  117. #NoGap
  118.           KEY_9                    0x00007bf6                #  Was: Nine
  119.           KEY_8                    0x00007bf7                #  Was: Eight
  120.           KEY_7                    0x00007bf8                #  Was: Seven
  121.           KEY_6                    0x00007bf9                #  Was: Six
  122.           KEY_5                    0x00007bfa                #  Was: Five
  123.           KEY_4                    0x00007bfb                #  Was: Four
  124.           KEY_3                    0x00007bfc                #  Was: Three
  125.           KEY_2                    0x00007bfd                #  Was: Two
  126.           KEY_1                    0x00007bfe                #  Was: One
  127.           KEY_0                    0x00007bff                #  Was: Zero
  128.       end codes

  129. end remote
Copy code

OrigenAE RC153  uses standard codes RC6 (mce)
However, the configuration file : /etc/lirc/hardware.conf
little different ( Armbian 5.20 )
  1. # Cubietruck automatic lirc device detection by Igor Pecovnik
  2. #str=$(cat /proc/bus/input/devices | grep "H: Handlers=sysrq rfkill kbd event" | awk '{print $(NF)}')
  3. #sed -i 's/DEVICE="\/dev\/input.*/DEVICE="\/dev\/input\/'$str'"/g' /etc/lirc/hardware.conf
  4. # /etc/lirc/hardware.conf
  5. #
  6. # Arguments which will be used when launching lircd
  7. LIRCD_ARGS=""

  8. #Don't start lircmd even if there seems to be a good config file
  9. #START_LIRCMD=false

  10. #Don't start irexec, even if a good config file seems to exist.
  11. #START_IREXEC=false

  12. #Try to load appropriate kernel modules
  13. LOAD_MODULES=true

  14. # Run "lircd --driver=help" for a list of supported drivers.
  15. # 'devinput' driver on Orange PI PC causes NO EVENTS TO OCCUR
  16. # via irw for some reason.
  17. DRIVER="default"

  18. # usually /dev/lirc0 is the correct setting for systems using udev
  19. DEVICE="/dev/lirc0"
  20. MODULES="sunxi-cir"

  21. # Default configuration files for your hardware if any
  22. LIRCD_CONF=""
  23. LIRCMD_CONF=""
Copy code

more information : Orange PI PC to receive IR/InfraRedmy sample file: /etc/lirc/lircrc
  1. begin
  2.   prog = irexec
  3.   button = KEY_DOWN
  4.   config = mpc prev
  5.   repeat = 0
  6. end

  7. begin
  8.   prog = irexec
  9.   button = KEY_UP
  10.   config = mpc next
  11.   repeat = 0
  12. end

  13. begin
  14.   prog = irexec
  15.   button = KEY_PLAY
  16.   config = mpc toggle
  17. end

  18. begin
  19.    prog = irexec
  20.    button = KEY_VOLUMEDOWN
  21.    config = mpc volume -2
  22.    repeat = 0
  23. end

  24. begin
  25.    prog = irexec
  26.    button = KEY_VOLUMEUP
  27.    config = mpc volume +2
  28.    repeat = 0
  29. end

  30. begin
  31.    prog = irexec
  32.    button = KEY_STOP
  33.    config = mpc stop
  34.    repeat = 0
  35. end

  36. begin
  37.    prog = irexec
  38.    button = KEY_1
  39.    config = mpc play 1
  40.    repeat = 0
  41. end

  42. begin
  43.    prog = irexec
  44.    button = KEY_2
  45.    config = mpc play 2
  46.    repeat = 0
  47. end

  48. begin
  49.    prog = irexec
  50.    button = KEY_3
  51.    config = mpc play 3
  52.    repeat = 0
  53. end
Copy code


This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-1-22 19:37:14 | Show all floors
Edited by kris777 at 2017-3-25 03:55

I have OrangePi lite ... so there is no audio output eg. Jack ....
So I used an external USB sound card eg. C-Media USB Headphone


I made small changes in the system Armbian and configure MPD
to get control volume using the button on the remote control
sudo aplay -l
  1. **** List of PLAYBACK Hardware Devices ****
  2. card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 []
  3.   Subdevices: 1/1
  4.   Subdevice #0: subdevice #0
  5. card 1: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 []
  6.   Subdevices: 1/1
  7.   Subdevice #0: subdevice #0
  8. card 2: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  9.   Subdevices: 1/1
  10.   Subdevice #0: subdevice #0
Copy code

a change in the file: /etc/asound.conf
  1. pcm.!default {
  2.     type hw
  3.     card 2
  4. }

  5. ctl.!default {
  6.     type hw
  7.     card 2
  8. }
Copy code

in the configuration file mpd small change in line ( /etc/mpd.conf) : hardware on the "software"
  1. audio_output {
  2.         type                "alsa"
  3.         name                "My ALSA Device"
  4. #        device                "hw:0,0"        # optional
  5.         mixer_type      "software"      # optional
  6.         mixer_device        "default"        # optional
  7. #        mixer_control        "PCM"                # optional
  8. #        mixer_index        "0"                # optional
  9. }
Copy code
lsusb:Bus 007 Device 002: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-1-28 20:33:23 | Show all floors
Edited by kris777 at 2017-4-1 23:29

You may ask what exactly do you use the LCD models....any links ?
Not all models that use the driver HD44780 work correctly !.......(RaspberyPi / Arduino)
I failed to run 2x16 LCD .... :-(
Maybe another potentiometer ? ...
I think you need to know exactly entries for used LCD ??? :
  1. LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line
  2. LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line

  3. # Timing constants
  4. E_PULSE = 0.00010
  5. E_DELAY = 0.1
Copy code
I used this 40x2 LCD and it is OK : ERM4002DNS-1 5V Black 40x2 LCD HD44780

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

2

posts

36

credits

Novice

Rank: 1

credits
36
Published in 2017-2-3 16:01:46 | Show all floors
Sorry for late reply.
I am using Armbian Server, boot time is about 25 seconds. It has nice sound from internal codec

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-2-8 03:36:50 | Show all floors
Edited by kris777 at 2017-5-11 00:15

The second remote controller that works properly
this: medion x10 .....remote control works with a dedicated sensor !... but
on another system ( beta ).....Armbian-5.25-Orangepilite-Ubuntu-xenial-3.4.113-desktop : Ubuntu-xenial-3.4.113-desktop

start-up procedure is simple:
apt-get install lirc
# reconfigure lirc
sudo dpkg-reconfigure lirc
Remote control configuration: ATI/NVidia/X10 RF Remote (userspace)
IR transmitter, if present: None !!! ....enter
configuration file 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.8.3(default) on Sat Apr 23 13:45:36 2011
  6. #
  7. # contributed by
  8. #
  9. # brand: or24v / or28v :-)
  10. # model no. of remote control:
  11. # devices being controlled by this remote:
  12. #

  13. begin remote

  14. name or28v
  15. bits 16
  16. eps 30
  17. aeps 100

  18. one 0 0
  19. zero 0 0
  20. pre_data_bits 8
  21. pre_data 0x14
  22. post_data_bits 16
  23. post_data 0x0
  24. gap 219976
  25. toggle_bit_mask 0x80800000
  26. min_repeat 1
  27. suppress_repeat 5

  28. begin codes
  29. UP 0xEF1A
  30. DOWN 0x77A2
  31. LEFT 0xF21D
  32. RIGHT 0x749F
  33. VOL_UP 0xDE09
  34. VOL_DOWN 0x5D88
  35. CH_UP 0xE00B
  36. CH_DOWN 0x618C
  37. MUTE 0xD500
  38. OK 0x739E
  39. SELECT 0xF01B
  40. 1 0x628D
  41. 2 0xE30E
  42. 3 0x648F
  43. 4 0xE510
  44. 5 0x6691
  45. 6 0xE712
  46. 7 0x6893
  47. 8 0xE914
  48. 9 0x6A95
  49. 0 0xEC17
  50. CLEAR 0x85B0
  51. ENTER 0x0B36
  52. PLAY 0x7AA5
  53. PAUSE 0xFE29
  54. STOP 0x7DA8
  55. RECORD 0xFC27
  56. REW 0x79A4
  57. FORWARD 0xFB26
  58. BACK 0x75A0
  59. INFO 0x042F
  60. POWER 0xD702
  61. RED 0x0732
  62. YELLOW 0x89B4
  63. BLUE 0x0A35
  64. GREEN 0x88B3
  65. PREV 0xF621
  66. NEXT 0x78A3
  67. TEXT 0xEB16
  68. RECORDED 0xED18
  69. MOVIE 0x719C
  70. MUSIC 0x0631
  71. FOTO 0x5984
  72. HASH 0x0D38
  73. STAR 0x8CB7
  74. end codes

  75. end remote
Copy code
mpd.conf
  1. audio_output {
  2.         type                "alsa"
  3.         name                "My ALSA Device"
  4. #        device                "hw:0,0"        # optional
  5.     format      "44100:16:2"
  6.         mixer_type      "software"      # optional
  7.         mixer_device        "default"        # optional
  8. #        mixer_control        "PCM"                # optional
  9. #        mixer_index        "0"                # optional
  10. }
Copy code
create     .asoundrc     ................. nano ~/.asoundrc
  1. pcm.!default {
  2.     type hw
  3.     card 2
  4. }

  5. ctl.!default {
  6.     type hw
  7.     card 2
  8. }
Copy code

USB Sound Card (lsusb) :  Bus 001 Device 004: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller I ran up to two remotes simultaneously with the program mpc mpd ( internetradio ) .... For two remote controls configuration in the lircd.conf file:
  1. #Configuration for the ATI/NVidia/X10 RF Remote (userspace) remote / OrigenAE RC153 :
  2. include "/etc/lirc/lircd.conf.atilibusb"
  3. include "/etc/lirc/lircd.conf.origenae"
Copy code
my hardware.conf
  1. # /etc/lirc/hardware.conf
  2. #
  3. #Chosen Remote Control
  4. REMOTE="ATI/NVidia/X10 RF Remote (userspace)"
  5. REMOTE_MODULES=""
  6. REMOTE_DRIVER="atilibusb"
  7. REMOTE_DEVICE=""
  8. REMOTE_SOCKET=""
  9. REMOTE_LIRCD_CONF="atiusb/lircd.conf.atilibusb"
  10. REMOTE_LIRCD_ARGS=""

  11. #Chosen IR Transmitter
  12. TRANSMITTER="None"
  13. TRANSMITTER_MODULES="sunxi_cir"
  14. TRANSMITTER_DRIVER=""
  15. TRANSMITTER_DEVICE="/dev/lirc0"
  16. TRANSMITTER_SOCKET=""
  17. TRANSMITTER_LIRCD_CONF=""
  18. TRANSMITTER_LIRCD_ARGS=""

  19. #Disable kernel support.
  20. #Typically, lirc will disable in-kernel support for ir devices in order to
  21. #handle them internally.  Set to false to prevent lirc from disabling this
  22. #in-kernel support.
  23. #DISABLE_KERNEL_SUPPORT="true"

  24. #Enable lircd
  25. START_LIRCD="true"

  26. #Don't start lircmd even if there seems to be a good config file
  27. #START_LIRCMD="false"

  28. #Try to load appropriate kernel modules
  29. LOAD_MODULES="true"

  30. # Default configuration files for your hardware if any
  31. LIRCMD_CONF=""

  32. #Forcing noninteractive reconfiguration
  33. #If lirc is to be reconfigured by an external application
  34. #that doesn't have a debconf frontend available, the noninteractive
  35. #frontend can be invoked and set to parse REMOTE and TRANSMITTER
  36. #It will then populate all other variables without any user input
  37. #If you would like to configure lirc via standard methods, be sure
  38. #to leave this set to "false"
  39. FORCE_NONINTERACTIVE_RECONFIGURATION="false"
  40. START_LIRCMD=""

  41. DEVICE="/dev/lirc0"
  42. MODULES="sunxi-cir"
Copy code


This remote is not Infra Red but radio !  remote control + sensor operates through a wall :-)








This thread contains more resources

You need to Log in to download or view,No account?    Register

x

3

threads

46

posts

691

credits

Senior member

Rank: 4

credits
691
 Author| Published in 2017-3-10 20:53:37 | Show all floors
I present you new version of my radio python code.
Now it is possible to play mp3 from internal memory or USB and internet radio of course
- on USB - folders with music on pendrives root folder (Fat32)
- folders with music should be in: /media/mp3
- internet radio playlist should be: /media/radio.pls
Of course you have to modify /etc/mpd.conf:
- change line: "music_directory         "/media""

In attached file is second version of the same program but for LCD connected thrue I2C and buttons on another pins 36, 38 and 40.

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-4-5 02:38:16 | Show all floors
Edited by kris777 at 2017-8-8 15:57

@mswiniuch ....Thank you !!!  for your python software for internet radio

Ps. How to use the entry to turn off the internet radio / mpc stop
The LCD screen was just a clock ...?......................................................................

Guide: Using 16x2 ('1602') LCD with I2C connector with Orange Pi PC

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

3

threads

46

posts

691

credits

Senior member

Rank: 4

credits
691
 Author| Published in 2017-4-5 18:55:58 | Show all floors
I did'nt implement stopping radio. You can only play/pause or reload by buttons from menu. Clock is newer shown.
I never stop radio - just power off ;)

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-4-5 22:57:13 | Show all floors
I understand .... I am missing the clock option After stopping the mpc program
  1. mpc stop
Copy code

In the first internet radio software
There is an entry:
  1. show_time = datetime.now().strftime('%b %d  %H:%M:%S')
Copy code

Unfortunately I'm not a programmer ... in python
But I will still try
Regards!

0

threads

20

posts

1599

credits

Gold member

Rank: 6Rank: 6

credits
1599
Published in 2017-4-8 03:32:43 | Show all floors
Edited by kris777 at 2017-4-8 19:58

Little success .... new screen with date and time
Configuration for LCD 2x40  
I found a cool program : mpdalarm / homepage : mpdalarmI insert slightly modified Installation is simple:
We unpack and copy the mpdalarm-0.1 folder, eg to ...../root  (And commands)
  1. chmod +x mpdalarm-0.1
  2. cd mpdalarm-0.1
  3. apt-get install bc at docbook-to-man
  4. make
  5. make install
Copy code

Can be used as an alarm clock radio. Increasing or decreasing the intensity of the sound from the radio or mp3 file to a certain level.Example:
  1. mpdalarm -s 1 0
Copy code

1 - minutes to run : mpdfadeout ( mpdfadeout : program for percentage mute the volume of the sound)
0 - mute to volume 0%
Finally, the mpc goes to the pause option
  1. mpdalarm -i 100 0935
Copy code
100 - % volume
0935 - 9:35 am  ... ( 1345 - 13:45 ..e.t.c ) the clock time that the mpdfadein program will run ...program mpc play :-)more information
  1. mpdalarm --help
Copy code

View running tasks of the program mpdalarm :
  1. atq
Copy code
job 7 at Sun Apr  9 09:35:00 2017
Delete tasks:
atrm 7
more information:
at --help






This thread contains more resources

You need to Log in to download or view,No account?    Register

x
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list