[PLUGIN] SerialAmpController - Control Amplifiers with Serial Interface from Volumio (e.g. ROTEL A12/A11/A14)

Should be easy, the plug-in is also powering up the Rotel Amps - that should already work with updating the JSON file.
But it may require some code modifications, to make it run without volume control (I did not design the code for sich a scenario).
Are U using the amp to control the volume or are U using the volume control of a DAC hat?
There also is a chance, that the Cambridge interprets volume information sent with the audio stream. How are U connected to the Amp?

Not so easy for me… :wink:
I noticed that I can’t select the Serial Interface in the plugin settings:

But i can see the signal of the amp with the command: cat /dev/ttyUSB0, for example:
image

Log of the plugin starting:
Log.txt (8.6 KB)

I’m not sure also with the modifications of the file AmpCommand:
ampCommand.txt (9.3 KB)

I don’t understand what’s going wrong, if you have some time to spend, it would be helpfull.

Currently quite busy, but I may have some time on the weekend. Will see what I can do

I had some time tonight and looked into it.
I think there are several things going wrong. Please check below proposals step by step and come back with your findings:

  1. There were some issues with your ampCommands.json file. I fixed them for you with the documentation from Cambridge Audio.
    ampCommands.json (9.5 KB)
    The documentation is a bit ambiguous in some places, so you will have to try and let me know if it works.
    IMPORTANT: Different from what I wrote further up, you have to put the file into /data/configuration/system_hardware/serialampcontroller/. Please overwrite the existing file only after disabling the plugin in the volumio GUI.

  2. After putting the file, you need to enable the plugin and work through the settings from top to bottom. If setting the device is not possible, everything else will also fail.
    First you need to make sure, that your device is visible in the pull-down.
    You report that you can see /dev/ttyUSB0 from the terminal and also see communication from the amp with cat. In your log it is also visible, that the plugin sees the device as well (line 17 and 18 read [SERIALAMPCONTROLLER] listSerialDevices: [{"manufacturer":"Prolific Technology Inc. ","vendorId":"067b","productId":"23a3","path":"/dev/ttyUSB0"},{"path":"/dev/ttyAMA0"}]).
    Strangely, the “pnpId” key is missing in your log. Looks, like your serial is not reporting a pnp ID, this is probably the reason for the device not to show up. Try downloading version 2.0.9 from the Beta-Channel - it should fix your Serial not showing up.

  3. After the device shows up, select it, save the first section of the settings. Then configure the remaining section and make a log file again from enabling the plugin until it has fully started plus doing all the actions you can do from the amp or the GUI. Note down, if anything works or does not work and your observations.

I tried the ampCommands.json I am sending you with my system, it is properly sending everything, but I cannot verify correct function, because I do not own the Amp and cannot verify its reaction.
I also see some error messages already, because the missing Volume control is not properly managed yet - but I do not want to fix those, without more info of how the Amp reacts.
After I get a full log, I can probably add a few lines of code to the plugin to remove the errors and allow amps without volume control (may take a few days or weeks, though).

P.S.: Might be an idea to write to Cambridge and just ask, if they can update the firmware with a command for volume…

P.P.S: It looks, like the volume is controllable via the CXN61 but not via the Serial Interface. There seems to be a home-assistant implementation in Python that controls volume, but only via the CXN61.

And last: From the log I saw you are using French settings. It would be very cool, if you could make a French translation of the interface text. If you can, let me know - I will send you a PN with the details.

Thanks!
First, I must miss something: when I owerwrite “ampCommands”, enable the plugin, it doesn’t update the ampCommands file. To update it, I copy all the files of the plugin and re-install it.

I tried with the new beta version with and without re-install it to update the ampCommand and I always get the same problem:
error: [SERIALAMPCONTROLLER] onStart: FAILED to start plugin: TypeError: Cannot read property ‘path’ of undefined
info: Error: TypeError: Cannot read property ‘path’ of undefined

But, I can select a small line in the serial setting and I see it in the log:

info: [SERIALAMPCONTROLLER] listSerialDevices: [{“manufacturer”:“Prolific Technology Inc. “,“vendorId”:“067b”,“productId”:“23a3”,“path”:”/dev/ttyUSB0”},{“path”:"/dev/ttyAMA0"}]
info: [SERIALAMPCONTROLLER] listSerialDevices: found 1 devices.[{“manufacturer”:“Prolific Technology Inc. “,“vendorId”:“067b”,“productId”:“23a3”,“path”:”/dev/ttyUSB0”}]

With I check the communication with the command “cat /dev/ttyUSB0”, I only see the messages from the amp, nothing is sent by the plugin.

If I understand well, the plugin doesn’t work with the wire I use to connect the amp. Should I buy a new one? Or, it will be the same.

For sure, I can translate the interface in french, but I need some time, I will do it during the week.

And, yes, I will ask Cambridge for an update of the firmware… We never know!

Hi, seems like my fix did not work. Sorry! Do not buy a new cable yet - it is just not working with the way I implemented it.
Tried to fix it better now. I also added more debug messages to better understand what is going on on your end.
The problem was, that I used the pnpID of the USB devices to attach to them, but your adapter is not sending a pnpID. I added some code now, which will use the manufacturerID instead.
The TypeError: Cannot read property 'path' of undefined message is a bit odd. I also got it sometimes, but I’m not sure, where it comes from. It looks, like it happens during debugging sometimes. I could get rid of it by issuing a volumio vrestart. After that, it was all working again.

Please uninstall the plugin and re-install version 2.0.9 (I did not change the version number). You should now either see directly the device in the pull-down or at least we should get some more log-messages showing us, what is wrong. I tried to simulating your situation on my setup by hiding the pnpId from the plugin, but not 100% if that gives the same result.

Last but not least: I included your amp in the ampCommands.json this time, so you wont have to copy it to the RPi manually anymore.

Hi,

Thanks, but it looks like the last version is not available from the plugin store (still the same problem and no cambridge amp in the setting).

Here the french translation file:
strings_fr.json (2.9 KB)

Sorry, looks like the upload did not work. I just see, that I get an Error uploading plugin: Error: got 500 response when I call volumio plugin submit. Need to ask for support there, since that seems to be a server issue.
Patience please.

Thanks!


I checked the log:
The plugin gets the message from the amp (pause when power off):
info: [SERIALAMPCONTROLLER] openSerialPort: Listener received: #02,01,0
info: [SERIALAMPCONTROLLER] openSerialPort: call processResponse with: respPowerOff
info: [SERIALAMPCONTROLLER] processResponse: Amp signaled PowerOff
info: [SERIALAMPCONTROLLER] processResponse: Amp Status is now {“volume”:5,“mute”:false,“source”:“16”,“power”:“standby”}
info: CoreCommandRouter::volumioPause
but it looks like nothing is sent to the amp.I tried to change a bit the protocol to check, but nothing.
Here the log:
info: [SERIALAMPCONTROLLER] on.pushState: undefined - play
info: [SERIALAMPCONTROLLER] sendCommand: send source,USB
info: [SERIALAMPCONTROLLER] sendCommand: switch to source: USB
info: [SERIALAMPCONTROLLER] sendCommand: now sending cmdString: #3,04,16
info: [SERIALAMPCONTROLLER] sendCommand: sent cmdString: #3,04,16
I also failed manually with:
echo -e -n #3,04,16\r > /dev/ttyUSB0
I don’t understand the problem.

First step made… 1 step at a time…
Updating below info after reading a bit of info about escaping # and doing some tests with echo in the shell:

According to the documentation, it should be #03,04,16 with 3 two-digit numbers, might be, that the amp is picky about that.
Please try the below commands and let me know, which one works:

  1. echo -e -n \#03,04,16\\n > /dev/ttyUSB0
  2. echo -e -n \#03,04,16\\r > /dev/ttyUSB0
  3. echo -e -n '#03,04,16\n' > /dev/ttyUSB0
  4. echo -e -n '#03,04,16\r' > /dev/ttyUSB0

All the commands works! The amp is comprehensive :wink:
To get the message from the amp in Volumio, I had to change the delimiter by “\r” in the ampcommand file.
The log looks good, but the amp doesn’t get any message from Volumio:
info: [SERIALAMPCONTROLLER] on.pushState: undefined - play
info: [SERIALAMPCONTROLLER] sendCommand: send source,USB
info: [SERIALAMPCONTROLLER] sendCommand: switch to source: USB
info: [SERIALAMPCONTROLLER] sendCommand: now sending cmdString: #03,04,16
info: [SERIALAMPCONTROLLER] sendCommand: sent cmdString: #03,04,16
Is there a way to check what is really sent?

Ok, it works with this file:
ampCommands.json (9.5 KB)
Thanks, I will try the plugin now! And maybe try to add a new function: I would like to power up the amp when Volumio starts playing.
Thanks a lot!

Cool :sunglasses:
For the Rotel, Power-up at play works. If the amp is in Standby and Volumio starts to play, the Amp wakes up and in case the wrong input is selected, it Switches to the correct input.
If that does not work for you, we may need another log to see what happens.
BTW : thanks for the translation file!

I had a short look at the code for “power-up on start” - with the Rotel it works, because they are waking up on “change source” command.
I slightly modified the code. If the plugin is aware now, that the amp is in Standby, it will first issue a “power up” and then send the command to change source.
You can try version 2.0.11 if you want to try.
I also fixed the delimiter from \n to \r in the json.

Thanks, it works now! But, we have to use the ampCommands file I sent you yesterday: I had “\r” in each command. You maybe can copy this section in your file, it works like this!
Thanks again!

Thanks! I did not open your attachment, because I thought that you just changed the delimiter. Have updated the ampConfig.json with your suggestion.
I also read the documentation of the SerialPort.io again - I did not remember the details and did not remember, that the delimiter was only used for the parser, not for terminating data that is sent. Therefore it makes perfect sense, that the \r is required after the commands additionally.

Is it possible to use one of the internal RPI UART"s instead of a USB port?

Hi!
Never tried, but it should probably be possible, if the OS exposes it as a serial interface.
I use the serialport.io package for communication with the port.
If the UART can be configured such, that it is recognized by serialport.io, it will probably work.

Internally, the plug-in calls serialport.list() first to find all ports available.

You could try to enable it like described here and see if it showed up in the pull down, when you Restart the plug-in.
I did not verify, where the hardware is used for anything else, you may need to check, if enabling the UART will have other unwanted consequences.

1 Like

Thanks. I will give it a try and report back.

I should have known it would not be that easy! I added the following to my boot_cfg.txt:

enable_uart=1
dtoverlay=uart0
dtoverlay=uart1
dtoverlay=uart2
dtoverlay=uart3
dtoverlay=uart4
dtoverlay=uart5

But nothing shows on the plugin drop down menu. :frowning:
Honestly not sure if I have truly enabled them so I need to connect one of them to a terminal and test some more.

BTW, plugging in a USB UART works fine.