How to get now playing data from raspberry to a microcontroller?

Is there any way to get the Now playing information(at least song and artist) from volumio installed raspberry to a microcontroller
Through i2c or any other communication methods??

Application
I am building a streaming player / amplifier with separate Bluetooth and Aux input and inputs are selecting by using an input selector powered by arduino,
So Right now I am using 2 separate small displays in my system, one for displaying volumio playback details(connected to raspberry) and other one for displaying the present input details(connected to Arduino )…
If I can fetch the now playing information from raspberry, I can display all details together in a single display? if anyone has any idea about this please help thanks in advance …

1 Like

I think the easiest way could be with serial communication, sending the command “volumio status” and parsing the response

1 Like

thanks for reply will check this ,

Using serial communication you can communicate both directions.
I had build streamer working like this: arduino controls pt231 as a sound selector and equalizer and displays what i want on VFD display, raspberry as a streamer and to receives and sends status/commands to home assistant.

Below code for sending strings to arduino from raspberry:

Python code:

import serial,time

if __name__ == '__main__':
    
    print('Running. Press CTRL-C to exit.')
    with serial.Serial("/dev/ttyUSB1", 115200, timeout=1) as arduino:
        time.sleep(0.1) #wait for serial to open
        if arduino.isOpen():
            print("{} connected!".format(arduino.port))
            try:
                while True:
                   your_string = "your string"
                   cmd_to_send = your_string+"\n"
                   arduino.write(cmd_to_send.encode())

                   time.sleep(1)

            except KeyboardInterrupt:
                print("KeyboardInterrupt has been caught.")

Arduino code:

add to: void setup()

  Serial.begin(115200);

add to: void loop()

String pi_string;

if (Serial.available()) 
      {
      delay(10);
      while (Serial.available() > 0) 
        {
        pi_string = Serial.readStringUntil('\n'); #recived string
        }
        
   Serial.flush(); 

Good luck

2 Likes

Thank you for the reply, I think this is the one I need, I have some doubts regarding the python parts, I am not good in that, how we will add the python code in volumio?

I found like this from some other forums
Install Python using SSH
then SSH I can access python
and run the script
is this correct?
if possible, can you just give the steps for this ??

Blockquote
I found like this from some other forums
Install Python using SSH
then SSH I can access python
and run the script
is this correct?
if possible, can you just give the steps for this ??

Also you need to also install needed python modules.

Steps:

  1. read how to connect to Volumio via SSH and connect
  2. install python3 on Volumio
    sudo apt-get install python3, sudo apt-get install python3-pip
  3. install modules (i do not remember if all needed modules will be installed with python so you can run those 2 commands)
    sudo pip3 install pyserial
  4. connect arduino and run script
    sudo python3 name_of_the_script.py
  5. If no errors, script works.

Give info about results, after I will tell you how to take data from Volumio via python, process and send.

Good luck

thanks :grinning:, I will try this and update