Skip to content

Instantly share code, notes, and snippets.

@EkoAdiWijayanto
Last active November 11, 2020 18:50
Show Gist options
  • Save EkoAdiWijayanto/ff6150d32ea6c41ee52bebcefe162556 to your computer and use it in GitHub Desktop.
Save EkoAdiWijayanto/ff6150d32ea6c41ee52bebcefe162556 to your computer and use it in GitHub Desktop.
Simple step to make Simple Orange Pi MP3 Player with IR Control, also has usb mass storage mode

DIY Orange Pi Digital Audio Player with IR Control

Installation

  1. Download Armbian using this torent

  2. Extract file

  3. Burn Armbian_5.38_Orangepizero_Debian_stretch_next_4.14.14.img to MicroSD using Etcher

  4. Open GParted

  5. Resize partition to 2GB (armbian OS)

  6. Create new fat32 partition & format from rest of unpartioned space, also give label OPI MUSIC

  7. Boot up

  8. Setup Account

  9. Reboot

  10. login using user account (don't use root account)

  11. Open armbian-config

    $ sudo armbian-config
    

    open System > Hardware, mark analog-codec & cir

  12. Reboot

  13. Edit /etc/modules, modif into

    #g_serial
    
  14. Get partition info

    $ sudo blkid
    /dev/mmcblk0p1: UUID="a2c25aee-d15d-4aa7-8f41-ab6bb511776f" TYPE="ext4" PARTUUID="378fc799-01"
    /dev/mmcblk0p2: LABEL="OPI MUSIC" UUID="7A29-7D5A" TYPE="vfat" PARTUUID="378fc799-02"
    /dev/mmcblk0: PTUUID="378fc799" PTTYPE="dos"
    
  15. Add fat32 partition to /etc/fstab

    UUID=a2c25aee-d15d-4aa7-8f41-ab6bb511776f / ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
    tmpfs /tmp tmpfs defaults,nosuid 0 0
    /var/swap none swap sw 0 0
    UUID=7A29-7D5A /mnt/storage vfat auto,users,dmask=000,fmask=0111,utf8  0  0
    
  16. Add to /etc/rc.local

    modprobe g_mass_storage file=/dev/mmcblk0p2
    
    exit 0
    
    
  17. Install mpd, mpc, ncmpcpp & lirc

    $ sudo apt-get update && sudo apt-get install mpd mpc lirc ncmpcpp 
    
  18. Edit /etc/mpd.conf

    ...
    music_directory         "/mnt/"
    ...
    
    audio_output {
        type            "alsa"
        name            "My ALSA Device"
        device          "hw:0,0"        # optional
        mixer_type      "hardware"      # optional
        mixer_device    "default"       # optional
        mixer_control   "Line Out"      # optional
        mixer_index     "0"             # optional
    }
    
  19. Edit /etc/lirc/lirc_options.conf

    [lircd]
    nodaemon        = False
    driver          = default
    device          = /dev/lirc0
    ...
    
    
  20. Create file /etc/lirc/lircd.cond.d/custom.lircd.conf

    begin remote
    
      name  cdr
      bits           32
      flags SPACE_ENC|CONST_LENGTH
      eps            30
      aeps          100
    
      header       9182  4489
      one           597  1647
      zero          597   542
      ptrail        597
      repeat       9167  2226
      gap          141332
      toggle_bit_mask 0x0
      frequency    38000
    
          begin codes
              KEY_CHANNELDOWN          0x00FFA25D 
              KEY_CHANNELUP            0x00FFE21D 
              KEY_CHANNEL              0x00FF629D 
              KEY_PREVIOUS             0x00FF22DD 
              KEY_NEXT                 0x00FF02FD 
              KEY_PLAYPAUSE            0x00FFC23D 
              KEY_VOLUMEDOWN           0x00FFE01F 
              KEY_VOLUMEUP             0x00FFA857 
              KEY_EQUAL                0x00FF906F 
              BTN_0                    0x00FF6897 
              BTN_1                    0x00FF30CF 
              BTN_2                    0x00FF18E7 
              BTN_3                    0x00FF7A85 
              BTN_4                    0x00FF10EF 
              BTN_5                    0x00FF38C7 
              BTN_6                    0x00FF5AA5 
              BTN_7                    0x00FF42BD 
              BTN_8                    0x00FF4AB5 
              BTN_9                    0x00FF52AD 
          end codes
    
    end remote
    
    
  21. create ~/.lircrc file

    begin
        prog = irexec
        button = KEY_PLAYPAUSE
        config = mpc toggle
    end
    begin
        prog = irexec
        button = KEY_VOLUMEUP
        config = mpc volume +2
    end
    begin
        prog = irexec
        button = KEY_VOLUMEDOWN
        config = mpc volume -2
    end
    begin
        prog = irexec
        button = KEY_NEXT
        config = mpc next
    end
    begin
        prog = irexec
        button = KEY_PREVIOUS
        config = mpc prev
    end
    
    
  22. edit crontab

    $ crontab -e
    

    add this

    @reboot /usr/bin/irexec && /usr/bin/mpc clear && /usr/bin/mpc update && /usr/bin/mpc listall | /usr/bin/mpc add
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment