Reading Knob Values.

Hello
I am trying to read values off of a knob (i am guessing a potentiometer) but do i really need a fast sampling rate? I mean i will just use it for controlling the volume (for example). I dont need to read the value 200 thousand times per second.

I will need 20 or 25 pots each with a software variable attached to it, . That is my ultimate goal, that these variables represent a value from float 16 or something even less. A resolution of 10 bits is enough (1024 vals possible). My question is how do i acheive that with minimal software load, hardware complexity

take this example,
i have 10 Control Knobs, their values are stored in KB[10] array
i only need an interrupt signal when the knobs really change position (like i wil allow a little bit of error )
and not polling a thousand times a sec.

I am completely noob in terms of hardware, but i can handle software quite nicely. Can you help me here? What hardware should i buy?

I am thinking of buyig ADC (mpc3008) and a buckload of pots... any other ideas? :slight_smile:

Thanks

I will need 20 or 25 pots each with a software variable attached to it,

I don't think they have these at Radio Shock.

How do you intend to read 20 analog devices on an Arduino that has only 6 analog pins? Unless you have a Mega, but even that doesn't have 20+ analog pins.

That is my ultimate goal, that these variables represent a value from float 16 or something even less.

No clue what this means. The analogRead() function is going to return an int in the range 0 to 1023, where 1023 represents the ARef voltage (typically 5.0V) and 0 represents 0.0V. The actual voltage applied to the potentiometer can not exceed ARef.

i only need an interrupt signal when the knobs really change position (like i wil allow a little bit of error )

You're SOL then. You must poll analog pins, and decide for yourself if a (significant) change has occurred.

Two Leonardo Arduinos will give you 12 + 12 =24 Analog channels.
Write the analog routine as a state change machine, that is the previous value is checked against the current value in a tight loop. When a knob is changed, transfer the knob# and the 2 Byte value to a master (third) Arduino to do what you will.

Yes, a lots of H/W. But, the controls will be monitored and you can easily bracket your trigger condition to control sensitivity. Return to the loop() will be very quick. The design is completely simple, even I can understand it. The design is extensible.

32U4 Arduino clones are very inexpensive ...
http://www.ebay.com/itm/5PCS-Leonardo-Pro-Micro-ATmega32U4-Arduino-IDE-Bootloader-replace-Pro-Mini-328P-/200935819252

Ray

I think i get what you mean,

If i get two leonardos i can attache up to 24 analog signals without interfering with my main arduino.
But isn't that a really expensive way to do it? Sure, it does take the load off of my main, but is there a better way?
thank oyou

[u]Here[/u] is an example using a multiplexer chip.

A multiplexer is like a multi-position switch that allows you to select one of many inputs. But typically, you run it very fast so that you can read each input once every so-many milliseconds or microseconds. There are digital control/address lines that determine which input gets selected. These would be connected to output pins on your Arduino.

Your design doesn't have to be quite as complicated as the example. With 3 8-channel multiplexers and 3 inputs, you could read 24 pots.

In fact if you look at the block diagram for the Arduino, you'll see that it actually has only one ADC and in internal multiplexer to get more inputs.

i only need an interrupt signal when the knobs really change position (like i wil allow a little bit of error )
and not polling a thousand times a sec.

But, you will have to read the pots to check for a change. So, you will have to "poll" the pots. The speed at which you can do that depends the speed of the Arduino and whatever else your program is doing. Checking all of the pots several times per second should be no problem and that should be fast enough for something like volume control.

But isn't that a really expensive way to do it?

They are available in 2x with free postage: $11.52 U.S.D.
http://www.ebay.com/itm/2PCS-Leonardo-Pro-Micro-ATmega32U4-Arduino-IDE-Bootloader-replace-Pro-Mini-328P-/200935818980

Nothing wrong with MUX... I just like toys!

Ray