Potentiometer Value Reader Help

if the value less than say 100, call it 100 and don't offer any more resolution in that direction. And if it's greater than 900 call it 900

That would be "constrain", wouldn't it?

I've been trying to follow along.

As far as I can recall, most pots are worse than 1% accurate, they don't give the same value for the same physical position from one hour to the next, so discussing accuracy may be a red herring.

So, I can understand why map() is useful to make the usable part of a damaged pot more useful. That doesn't increase the accuracy. Multiplying an inaccurate value by 10 doesn't make it less inaccurate.
I can understand why constrain() is useful to ensure code can rely on a limited range of values.

So the gizmo sounds like it might be equivalent to:
an Arduino sketch which lets you wiggle the pot, and maybe has a couple of buttons for other input.
You wiggle the pot, maybe saying where LOWER and UPPER points are using the buttons, and it then prints the
LOWER and UPPER values it reads, and the appropriate
map(..., LOWER, UPPER, 0, 1023) and
constrain(..., LOWER, UPPER) on the serial monitor (instead of the 4 digit display)?

Is that it?

wierdo557 understands my concept. and most pots do have a defect. And for the rest of you, stop calling me stupid, because you just dont understand it.

I apologise if you thought I called you stupid.
I definitely did not, and did not mean to convey that.
I genuinely struggle to understand the idea, and that is rare.
I thought my equivalent program was close. Apparently not.

Or a scale/offset function can be performed with an op-amp between the pot slider and the Arduino analog input.

That's a nifty approach, I like it. Especially as an op amp and a few resistors are much cheaper than a reasonable quality pot.

let me try and start over. Two different braods of pot have different caluse on them. Not all pots range 0 to 1023. In fact, most pots vary from that slightly. What I am trying to do is find the exact numbers so i can map them. Step one is how to read the vaoue of a pot, and step two is hwo to display that number on a 4 digit, 7 segment display.

Perhaps people are having difficulty following this thread because its hard to see why you would want to build a 7 segment device.

If you want to see the analogRead values at the extremes of pot movement, what not use a simple sketch to print the readings to the serial port.

const int analogInPin = 0;  // Analog input pin that the potentiometer is attached to

void setup() {
  Serial.begin(9600); 
}

void loop() {
  Serial.print("Pot= " );                       
  Serial.print( analogRead(analogInPin));          
  delay(50);                     
}

Or if you wanted something more sophisticated you could use some of the ideas in the calibration example sketch to print the min and max values for the pot under test. (see: examples/analog/Calibration)

I would be interested in knowing why you think a dedicated device using 7 segment displays would be of any more use for calibrating pots than a simple serial test sketch.

I dont really understand this... What i need is to read the pot calue. then i need that value displayed on the 4 digit display... first I need to read the pot. then the arduino has to process that into the proper leds in the display.

What i need is to read the pot calue. then i need that value displayed on the 4 digit display

Some of us are wondering why you want to do that

does it matter why i want to do it? and anyways, i am doing it so i know the pot value. the reason for the display and processing it on the arduino is because it is a stand alone kit. it is ment to be independent.

ok. well you need to find a display.

like this

or this

or any other. you just need to pick one that suits your skill level i.e. built in controller is easier, but d.i.y. is cheaper.

Yepp, I'm using basically the second one, but in red; this one: http://www.sparkfun.com/commerce/product_info.php?products_id=9483

I know how to do the wiring, but I dont know how to write the code... I an a hardware person, and plus I am only 11, so I am not good at code.

Jeremy you need to clean up your text and spell check it so it can be understood.

I'm unsure why the acrimony over your question. Several people are not being helpful and give every appearance of being trolls. I've been away from this forum for a time and that's a poor trend.

Potentiometers can be any range of values. You are correct in stating that if you try to set them at a certain place each time two different potentiometers can have different readings. There are potentiometers that are linear which means they change like a water valve evenly from 0 to max. There are several other types that do not change evenly, logarithmic, audio taper and others. Make sure what you're using is a linear potentiometer.

I believe you want to set the pot to the same number value each time and to do so in a self contained unit using the arduino and 4 digit seven segment display.

You can do this and you can take the 0 - 1023 number from the ADC and output it to the seven segment display.

This is probably the easiest display to work with but it's 40+S&H has nice features. Since it uses I2C and there is code examples it should be easy to use.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234334259

The reason I say that is it gets complex really fast with a lot of LEDs
http://www.arduino.cc/playground/Main/MAX72XXHardware

The first thing you must do is get the potentiometer hooked up and be able to read it's position from 0 - 1023 using the serial console built into the arduino IDE. Once you've done that then you can go farther.

does it matter why i want to do it?

Questioning the purpose of the project is not intended to be acrimonious. There are usually many different approaches to solve a technical problem and without understanding the project goals, it's difficult to provide relevant advice.

For example, you may just want to learn how to use the map function (and a project to measure and display the range of a pot on a 7 segment display is a fun way to do that). Or the goal may be to have a device that can be used to select or calibrate a number of pots to aid in manufacturing a product.

The nature of the advice could be quite different depending on the relevant project goal.

It's quite common that people new to Arduino do not yet have the experience to know what question to ask. For example, questions like ”how can I get this interrupt handler to control ?” come up quite often when the users actual problem may be more effectively solved by using another (usually simpler) approach. Of course, if the goal is to learn about interrupts that's a different matter. But without knowing the context, it's really hard to give the best advice.

So requests for clarification on the purpose of a project are usually intended to clarify the context of a technical question.

I find it easier to answer questions in the forum when considering how I would solve the problem the poster is facing. That's hard to do when a poster does not make clear what he wants to achieve.

Providing context in a post is a good way to encourage involvement from the experienced people here that are well placed to help.

Have fun!

You can do this and you can take the 0 - 1023 number from the ADC and output it to the seven segment display.

That's my general idea... You plug a pot into power, ground, ana analog in. The arduino reads the pot, and comes up with a number between 0 and 1023. The arduino then processes this into a light sequence for the display. The whole system would update every 50ms.

This is the display i plan to use:

woah... this went dead...

ok... you know in the exampled book?

file > examples > analog > AnalogInSerial

that prints the value of your pot... i want to do that, but display it on a 4 digit 7 segment display... so basically analog read a pot, and then display it on a display... and it all needs to be processed by the arduino.

it's the ones you get from sparkfun;

i am driving only the digits, not the dots...

the pin useage doesnt matter... its a kit, not a shield...

check out the cooking timer example on the sparkfun page.

this guy shows how to wire it up. he's even got some code made for displaying numbers!

any help guys?