Arduino Expert Help Required - Pan/fader project for audio.

Hi all,

I don't currently own any Arduino products, but I thought it might offer the solution to a project I am working on. I shall describe this as best I can, if anything is unclear please ask for clarification.

Project overview: I want to control the volume level of four speakers as is done in a car, i.e Pan and Fade, using a joystick.

Practical example: I have four speakers, two placed in front (Left and Right) and two behind (Left and Right). Each is connected to its own dedicated amplifier. Using a PS3 controllers joystick, connected via Bluetooth to a Bluetooth Dongle connected to a USB Shield on an Arduino Uno. The value of the potentiometers of the joystick are translated by the Uno and the PWM data is then fed to servo's that physically move the volume controls of the amplifiers, based on the joystick values.

This example was based on what I thought I might practically achieve (without getting deeply into electronics, which are not my thing).

I have created a prototype on 123D Circuits that contains one potentiometer and two servo's. The code I wrote happily controls the servo's (I've included reversing the map values of one of the servo's to allow me to utilise one pot for two servo's to allow ramp up of one whilst ramp down of the other).

My problem comes when I introduce a second potentiometer to control the Fade.

As you would expect, the code flow will always give priority to the last command. So this translates, for my project into being able to control either the Pan OR the Fade, but not both.

Here is a link to the 123D project - 123D Project

Any help is greatly appreciated.


I strongly suggest that you clean up the schematic. Please check out the links in my signature.

I dont think controlling the volume by using servos to control volume knobs will work very well...

However the problem seems to be that you are moving the servos the entire way at once (and have a delay to wait until they move)

try moving the servo one 'step' at a time (the step size should be small but not so small that it takes forever for the servo to react.

So each time through the loop you: - check to see if servo1 position is where it should be (as defined by the pot) and move it 1 step in the right direction - check to see if servo2 position is where it should be (as defined by the pot) and move it 1 step in the right direction - repeat (with no delays in the loop)

This should allow both servos to 'react' quickly, while still ending up where they should as defined by the pots