# Variable resistor (pot) - Even results?

I'm building a toy for my little boy with a bunch a blinky lights, buttons and plugs. I'd like to put a Pot on so that it will make a clicking sound when he turns it or change the flashing rate of an LED.

The 500k variable resistor is connected fine and I can Serial.print it's values correctly. The values are logarithmic (i think). Can anyone suggest a way to convert the values so that when the knob is turned the clicking or flashing speed has more of a x=y ratio?

Sounds like you have a pot with an "audio taper". A simple way to correct (without fancy math) is to characterize the pot. Set it to the 0-degree setting (all the way counterclockwise), take a reading, store it in a spreadsheet. Turn the pot to 10 degrees, take a reading, store it in the spreadsheet. Continue all the way around.

Now, turn this spreadsheet around. Store it in an array in your code, then whenever you get a reading, look it up in the table (you'll have to look between two nearest values) and the index into the table is the linearized return value.

-- The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

I see three options

1) Use a lookup table as RC suggests 2) Go out and buy a linear pot 3) Describe logarithmic principles to your lad, this has the added beneficial side affect of giving him a head start in maths :)

Rob

Ha thanks guys. Right now we are working on the Principals of Electrical Theory. I'll going to give the 'array' idea a try. Thanks.

Spark