I need to super-sample my returning data.

I am a newbie to Arduino and I am making my way through the "Making Things Talk" exercise book. The fist project is called monkey pong. This project requires two flex resistors. So far I have successfully completed the project but now I want to build a controller for it.

I get good data back from the flex resistor when I wiggle the flex resistor around ranging from 800 to 400 but what if the controler I build is something that flexes the resistors much more subtly like a plastic ruler. My read out then will be something more like 480 to 478 and these min and max numbers are to close together for me to read and use effectively. So is there a way to super sample these numbers, maybe to get float numbers back or change the range so that 450 is 0 and 500 is 100.

Here is the read out I am getting through the serial monitor. 560,576,0,0 559,575,0,0 560,574,0,0

Bellow is my Arduino script that gives me feedback through the serial port.

/* Sensor Reader Lamguage: Wiring/Arduino

Reads two analog inputs and two digital inputs and outputs their values.

Connections: analog sensors on analog input pins 0 and 1 switches on digital i/o pins 2 and 3


int leftSensor = 0; //analog input for the left arm int rightSensor = 1; //analog input fot the right arm int resetButton = 2; //digital input for the reset button int serveButton = 3; //digital input for the serve button

int leftValue = 0; //reading from the left arm int rightValue = 0; //reading from the right arm int reset = 0; //reading from the reset button int serve = 0; //reading form the serve button

void setup() { //configure the serial connection: Serial.begin(9600); //configure the digital inputs: pinMode(resetButton, INPUT); pinMode(serveButton, INPUT); }

void loop(){ //read the analog sensor: leftValue = analogRead(leftSensor); rightValue = analogRead(rightSensor);

//read the digital sensors: reset = digitalRead(resetButton); serve = digitalRead(serveButton);

//print the results: Serial.print(leftValue, DEC); Serial.print(","); Serial.print(rightValue, DEC); Serial.print(","); Serial.print(reset, DEC); Serial.print(","); //"print the last sensor value with a printIn() so that //each set of four readings prints on a line by itselft: Serial.println(serve, DEC); }

/* // print the results: Serial.print(leftValue, BYTE); Serial.print(44, BYTE); Serial.print(rightValue, BYTE); Serial.print(44, BYTE); Serial.print(reset,BYTE); Serial.print(44, BYTE); Serial.print(serve, BYTE); Serial.print(13, BYTE); Serial.print(10, BYTE); } */

Thank you. ps. is "Super-Sample" the correct terminology here, or should I be using another term ?


change the range so that 450 is 0 and 500 is 100


Scaling the value in software isn’t going to help. Using your example (450 to 0; 500 to 100) you’ll end up with even values (0, 2, 4 … 98, 100). You may as well just subract 450 so the value is between 0 and 50. The other example (478 through 480) is always going to result in exactly three values no matter how you tweak the original numbers.

What you need is a way to increase the resolution.

I suspect scaling the voltage from the sensor will be the best strategy but I have not idea how to do that. Hopefully, someone with more hardware experience will step in to help.

  • Brian

We've used wheatstone bridges in our strain gauge setups.


Thank you for your replies on this topic but as a someone new to electronics I am still confused as to how to increase the resolution of my flex resistor output. As I mentioned earlier the output of my flex resistor is very small (478-482) I want to increase the resolution of this out put so I can give my program detailed data to work with.

I have attached a sketch of my circuit. I hope it helps so you can give me a clear direction as to how to do this. http://tinyurl.com/l9c53v

Thank you.

In addition to reading the web page rFree suggested, you might want to spend some time with Google.

This... http://protolab.pbworks.com/TutorialSensors Understanding Voltage Dividers with a Flex Sensor

...was on the very first page from this query... http://www.google.com/search?q=flex+sensor+arduino