Go Down

Topic: Using arduino as a potentiometer. (Read 828 times) previous topic - next topic

packocrayons

I'm making an audio control system (with LCD display) to use with a LM1036, using the arduino and a set of pushbuttons to adjust the volume, bass, and treble inputs on the 1036, instead of the recommended pots biased off of the on board zener voltage. Since analogwrite is a PWM function, I'm assuming it won't work to control the IC. In that case, what would be the correct function to use, or is this even possible?

strykeroz

Hi

The arduino can drive a digital potentiometer if PWM doesn't do what you need.  These are typically interfaced via SPI.  Jeremy Blum has a tutorial on using one here: here.

Cheers!
Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

packocrayons

I could do it with a digipot, but I'd prefer to keep external component count at a minimum, I thought this would have been possible within the arduino.

dhenry

Quote
I'm assuming it won't work to control the IC.


When you pass a pwm signal through a low-pass filter, what do you get?

PeterH

Given that these are controls for an audio system I guess that you will want a nice steady constant value so applying a low pass filter to a PWM stream may not be acceptable.

Depending what sort of resolution you wanted, you might get away with a small R-2R network controlled by the Arduino as a crude low resolution DAC.

I'm not sure what your objection is to using an external DAC, but the Due does have an onboard DAC - is that an option?
I only provide help via the forum - please do not contact me for private consultancy.

Magician

"Four control inputs provide control of the bass, treble, bal-
ance and volume functions through application of DC volt-
ages from a remote control system or, alternatively, from four
potentiometers which may be biased from a zener regulated
supply provided on the circuit. "

Yes, it will work if you apply PWM from arduino pin to associated input. The only things, PWM should be careffuly filtered out, otherwise you will get undesirable amplitude modulation.
Trick is , you can't use default PWM settings, with 500 Hz and filter depth 80 dB it would take  minutes till new settings come through (RC 1-st or 2-nd order). You will have to write directly to TIMER control registers , in order to move PWM freq. at least up to 16 kHz.
I had a project, DIY FM Radio , where I had same issue. Look at the link below, you can download an arduino sketch and copy / pate Timer1 settings (10-bit Fast PWM).

packocrayons

What do you mean by filtering out the PWM?


packocrayons

Thanks, I'll keep a low pass filter in mind next time I order stuff.
In the meantime, I'm going to try it with just the PWM, and see what happens, then try with a capacitor inline, and see if that smooths it out.
If neither of those work I'll just go with pots and read the values off of the pots and display the mapped values.
Thanks for the help guys.

Go Up