Raspberry Pi Musicbox Help (Python code)

Hey everyone, I was wondering if someone would be available to provide some help with a raspberry pi project I’m working on. I’m quite sure the answer is simple but I’m unable to find the answer on the web.

Project
Creating a HiFi streaming station for my lounge area. Using a analog potentiometer to control the volume of the Pi out.

Hardware

  • Raspberry Pi
  • Adruino
  • USB Serial connection
  • 50k Analog Potentiometer
  • Inno-maker DAC HAT

Current status

I’ve got everything wired up, I’ve got the output from the Arduino going over serial to the Pi and I’m able to read the value from the Potentiometer on the Pi with a small bit of code on both the Arduino and Pi.

Where I’m stuck is with the code to use the data collected from the Potentiometer to control the volume of the Pi. I can’t seem to find any examples of how to do this with an analog input (Only digital).

I’m really wanting to get this done this week so I can get the enclosure designed and cut at work. I’d really appreciate some guidance if anyone is available to help.

Maybe see how the volume is changed here?

I’ll see if I can modify that to make it work for me. The main difference is they’re using GPIO pin input for their analog in, I’m using the usb serial communication from the Arduino.

But it’s something to work with.