ΣSigmaStudio Ask AI Русский Log in

Volume control from microcontroller

SigmaDSP & SigmaStudio solonello Apr 8, 2025 00:00 8 replies Original on forum ↗
Subscribe
solonello Question
Apr 8, 2025 00:00

Hi all,

I was wondering If it’s possible to control the volume output of the DSP (in self-boot mode) from a digital pin of a microcontroller connected to a multi-purpose pin of the DSP. Any suggestion?

If not, which are the alternatives to achieve the same result?

The microcontroller must directly control the volume, so I’m excluding the use of an external potentiometer.

Thanks in advance for any reply!

Audio Signal Processors

dsp

hardware

microcontroller

SigmaDSP Audio Processors

volume control

adau1701

Show More

KJBob Reply
Apr 9, 2025 00:00

Hello solonello,

There’s several ways, each with their own ups and downs:

Connect two of your micro’s i/o pins to two MP pins set up for up-down pushbutton volume control. This is easy but uses double pins on both ends.

Have your micro generate an oscillating signal on one pin, making its percentage of high time relate to the desired volume (pulse-width modulation). At the DSP, lowpass filter this to have it operate an external slew volume block. Ideally, your micro should have a counter-timer set up for PWM. You could do it entirely by running code, but this would keep your micro rather busy. Also, if the uC program should depart to Mars, your volume could either mute or go full blast.

The most versatile way by far is by I2C or SPI control. This lets the micro control volume, EQ, and many more functions. At this point you would likely have the micro boot the DSP as well. This method needs a micro with the appropriate port, and some serious programming which I’ve described as a rite of passage for engineers. Yet the possibilities are awesome!

Others here or I could offer examples for at least the first two methods (or think of another one!). Which microcontroller are you working with, and are you planning to lay out a custom board?

Best regards,

Bob

solonello Reply
Apr 9, 2025 00:00

Hi KJBob, thanks for your reply.

Yes, I'm trying to lay out a custom board.

The problem with the first approach is that, on system restart, I would like to tell the DSP the "last volume level" saved before shutdown.

The second solution at least solves this problem. Are you suggesting to set up the low pass filter directly inside SigmaStudio? Or with external passive components?

I'm very curious about the last solution, because I see that is giving me full control on the DSP parameters. However I'm worried about booting the DSP from the uC. Do you know of any guide or library that could accomplish or at least help me doing this?

I'm using an ESP32-S3 as the microcontroller.

Thanks again!

DaveThib Reply
Apr 9, 2025 00:00

Hello solonello,

KJBob is the best person to listen to and follow on the forum!!

The low pass filter would be inside the DSP and so therefore also consume resources of the DSP. Bob also pointed out about keeping the MCU busy.

Saving the last volume level is a little tricky to do. I suggest starting to walk rather than run. Have the DSP selfboot and have the project be setup to boot up in a safe way with the volume most likely muted or at a super low level.

Then using SPI or I2C have your controller update the settings. Have the MCU save the last settings and update them once the DSP is booted. You can have the DSP send out a signal that it has completed booting. You could just wait for more than enough time for the DSP to boot but having a GPIO flag come up also verifies that the DSP is actually up and running and there is not problem with it.

I just looked for one of my example files on how to do a "self boot complete" signal but I do not have one for this processor. It would not be very different from the others. But I will not confuse things by including that here. Search for other posts if you do not find it then ask in a new post.

Have you found my YouTube channel yet?

Dave T

solonello Reply
Apr 9, 2025 00:00

Hi Dave!

So you're suggesting to have the DSP in self-boot mode but still changing the parameters from the microcontroller via I2C? Is this possibile? Sorry for my poor knowledge.

Having the MCU saving the last volume value is very simple for me and also is an approach that I prefer since I've already implemented it in the past.

Feel free to link your YouTube channel, I'm pleased to follow you!

DaveThib Reply
Apr 9, 2025 00:00

Hello solonello,

Yes, you let the DSP boot up a program on its own and it starts running the program. Then you read and write data to the parameter addresses in memory that control the object running in the DSP. The objects are volume controls, mutes, EQs compressors etc.,

This is EXACTLY the same way that SigmaStudio controls the DSP program graphically after you compile and download the program. The messages you see scrolling by on the Capture window is the communication between the Windows program and the DSP program. I have a video about the Capture window. Your MCU can do anything that SigmaStudio is doing to control the running program.

Here is my channel.

How to SigmaDSP and SigmaStudio - YouTube

Dave T

solonello Reply
Apr 9, 2025 00:00

That sounds very interesting! And also solves a lot of problems.

From the Datasheet I see there are two pins responsible of determining the I2C address of the DSP while it is in I2C control configuration. But, in the case the DSP is self booting, what is its address on the I2C bus to change the parameters by the MCU, since the two mentioned pins are now related to other functions (I see that the ADDR1 pin is related to the writeback function)?

Thanks again and congratulations for your work on the YouTube channel

DaveThib Reply
Apr 9, 2025 00:00

Hello solonello,

The complication of having the DSP try to writeback and save settings is not trivial. This is why I suggested your MCU save the settings. So you can ignore the Writeback function. The address pins are still active when you selfboot so you need to set them to the address you want. If you have only one DSP then ground the two pins. If you plan on having more or connecting together more than one of your boards then perhaps having options with zero-ohm resistors would be a good idea.

Dave T

solonello Reply
Apr 10, 2025 00:00

Thanks Dave,

I'll give it a try! Hopefully I will get good results