Pages: [1]   Go Down
Author Topic: Using arduino as a potentiometer.  (Read 713 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1122
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12631
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2590
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"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).
 
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you mean by filtering out the PWM?
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2590
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/
http://arduino.cc/forum/index.php/topic,7051.0.html
https://www.google.com/search?client=opera&q=filter+pwm+to+dc&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: