CamillaDSP on Pi remote control

Member
Joined 2003
Paid Member
Hi!

Continuing from the "main thread" I wish to discuss and get help of implementing an infrared (?) remote control that can do:

  • Volume + / -
  • Mute
  • Play, Next, Pause
  • Change config
  • Tweak a PEQ parameter

Platform Pi5 and pCP picoreplayer with CamillaDSP.

As I understand it, I need:

  • Pi5
  • Power
  • An IR receiver eye
  • A remote - preferable the small metal Apple remote or the like.

I can hook up the IR to the Pi but then its get foggy ;-)

Please help!?

//
 
Here some of the nice post on the topic already made:


//
 
Hi!

As suggested before, the easyest way would be to add a USB dongle and use mdismon flirc.py python app. However, placing of the Pi and USB dongle can be a challenge if you want the Pi USB+ethernet ports to be available at the back of the case and have a tidy and professional looking build.

I have a Pi running CamillaDSP and a VS1838B IR receiver here in my workbench. I'll try to connect CDSP with the IR receiver through GPIO later today and let you know if it indeed works fine.
 
a tidy and professional looking build.
My goal 🙂

I have a TSOP4838 IR-modul 38 kHz coming my way that I hope will jive with a Apple remote...

AR.jpg


Thanks - just so you know... all these .py and flirs and whatnot 🙂 is greek to me so please, if you have the patience, be simple and clear? 🙂

GPIO are pins on the Pi if I understand it correctly.

I'm planning to use this guide for IR connection:

https://docs.picoreplayer.org/projects/add-an-ir-receiver/

And I'm quite set on using pCP with Camilla...

Thanks for your attention and spent efforts in supporting me!


//
 
I have a TSOP4838 IR-modul 38 kHz coming my way that I hope will jive with a Apple remote...
It should work just fine, as both are 38khz.

This seems to be a nice walkthrough!

I tried with my IR receiver and it seems to work:

1738594891918.png


I don't use piCorePlayer, but using a simple python app that is not greek, but brazilian (sorry, couldn't resist 😂), I was able to get the IR sensor to send commands to the PI and to decode them correctly.

You should try to go through that article and ask for help here if you face any issues.
 
  • Thank You
Reactions: TNT
🙂

Thats sound good. Yes, I will digest the whole article. But I assume that I will in the end come to the point where I want to tweak camilla things and perhaps this where it will get tricky for me...
  • Volume (Up / Down arrow)
  • Mute (center button)
  • Config (Menu pressed will shift to next config; A->B, B->C and C->A)
  • Play (Triangle)
  • Pause (Triangle)
  • Next (Right arrow)

I want be able to switch between 3 different CDSP config files and have on the front 3 LEDs to indicate the chosen config (A, B or C)

While the first three is for Camilla, the three last is for Lyrion player (or is it server - got unsure...).

So I wonder how one can control pCP via the remote....:

  • Play (Triangle)
  • Pause (Triangle)
  • Next (Right arrow)

for a Lyrion Server...

//
 
i have write a script for remote command
it has
  • Volume + / -
  • Mute
  • Play, Next, Pause
  • Change config (
  • Tweak a PEQ parameter ( bass and treble)
  • Bass treble on / bypass
  • Power on off amp ( trigger auto / forced on)
  • Display volume mute bass treble config on 6 digit TM1637 LED Display
I started with mdsimon2’s script, heavily modified to add the desired missing functions .
I use a bluethoot remote control, but it is not difficult to use an infrared remote control with flirc

for now, it work on camilladsp V2 and debian 11, i try it on 12 and V3 , when it work i can post the code , if interest.
 
  • Like
Reactions: TNT
This sounds almost exactly what I'm looking for - yes please thank You very much! 🙂

A small display would be awesome.

Power on/off - is that controlling a relay of sort or Is it a Pi on/off perhaps?

Which remote do you use for these actions if I may ask?

//
 
It's good you started your own thread for this! (Since it's not really specific to CamillaDSP.)

The hardware side is quite easy, 38kHz is the correct IR carrier frequency, and the remote uses the NEC IR protocol. The receiver will have three leads, one for power (3.3V or 5V), one for ground, and one for data. Check the datasheet for the specific model you buy to be sure which is which. Then you just connect the leads to the correct pins on the GPIO header as shown in the picture from @dptucunduva .
GPIO-Pinout-Diagram-2.png

Any of the pins labelled GPIO <number> can be used to connect the data lead, just be sure to note down which GPIO number you use.
There's a video about this process here:

Now, the software part can be confusing, as there are two main ways of adding a remote, using LIRC or using the remote controller built into jivelite. The LIRC method is more flexible (but more complex) and would probably be better for your desired use. I must add a big caveat here, as I setup the remote
on my PCP install to use the jivelite method, so I'm really just going off what I've worked out by reading the docs.

For some background on LIRC you can take a look at this page, which gives a comprehensive (i.e. rather long) description of the flow of events and data. Basically, you need two critical files, lirc.conf, which converts the raw keycodes into data strings, and lircrc, which specifies how those data strings are converted into commands that will be sent to an application program. lirc.conf is easy, as you can use the one provided by Ralphy here. (It looks like that's the model of Apple remote you're using.)

Here comes the potentially tricky part, as you're going to have to write your own application program in python to take these commands and send them to CamillaDSP via the websocket, and then modify lircrc to call that program with arguments that correspond to your desired action.

As an example, let's program it to decrease the volume by 1dB on pressing the down button. Here CamillaDSP has been run with the websocket set to use port 1234 (-p 1234) and the config contains a filter called 'volume'.
lircrc would contain the section
Code:
begin
remote = APL-A1294.conf
button = KEY_DOWN
repeat = 0
prog = python3.11
config = remote.py 1234 voldown
end
And you'd have a python script called remote.py that contained the following code:
Code:
# set volume
from camilladsp import CamillaClient
import sys
import time

try:
    port = int(sys.argv[1])
    command = str(sys.argv[2])
except:
    sys.exit()

cdsp = CamillaClient("127.0.0.1", port)
cdsp.connect()

if command == "voldown":
    current_vol = cdsp.volume.main()
    new_vol = current_vol - 1
    cdsp.volume.set_main(new_vol)

As you noted, the Play, Pause and Next commands actually need to go to squeezelite rather than CamillaDSP. You can invoke these commands by simply having your program call the corresponding PCP shortcut:
Code:
import subprocess

subprocess.run(["pcp", "pause"])
Note that you can also control volume using the 'pcp up' and 'pcp down' commands.
 
  • Thank You
Reactions: TNT
Thank you very much . that clears up a bit on how this works on a higher level.

So a Pi / OS take on how to receive low level signal on an interrupt pin (?) GPIO. Then associate the different signals on the GPIO to a command and in turn which software to direct that command to - in this case two different ones. Is that about correct?

Using pCP volume, what/where is this actually done - in Jivelite or perhaps Lyrion server? Do you know? Maybe CDSP is more accurate/has higher precision? 🙂

//
 
Using pCP volume, what/where is this actually done - in Jivelite or perhaps Lyrion server?

As far as I can tell from looking through the scripts, it sends a volume command to LMS. I have no idea whether it's better to change volume in LMS or Camilla. I found a post that says LMS is processing the volume using 24bit precision, I suspect CDSP uses more, but 24bit is already good to -144dB, so I doubt the difference would be audible.