I have small doubt here. As i know if any sensor as output with 0~5v analog the curve will be linear. So we do simple conversion like
If curve is linear and analog out put is 0-5v.
sensorValue = analogRead(sensorPin);
voltage =5/1023*sensorValue ;
Question1:
Assume that i have sensor which gives me output analog -5v and +5v . The curve is linear. For +5v we can give directly to port . But if there is -ve reading can we give the voltage to analog port directly or not???
if not What i need make it work??
IS any additional circuit i Need build ??
How my Nonlinear equation look like in this situation??
question 2:
I have arduino UNO . it is 10 bit resolution.
Assume I Have analog sensor which is 12bit resolution.
If output of analog sensor is linear, Then which multiplication factor i need to consider in below equation.
sensorValue = analogRead(sensorPin);
voltage =5/1023*sensorValue ;
OR
sensorValue = analogRead(sensorPin);
voltage =5/4096*sensorValue ;
I have no device to connect. But for sake of knowledge i asked,
I am planning purchase one sensor Which has non linear output.I wanted to how to interface it.
It has -5v gives -70 degree , 0v o degree and 5v as 75 degree.
My question how can use this sensor?? What additional circuit i need build. Or i cant use the Sensor itself
It just for understanding. Here i have attached output curve of sensor. I have given example. My sensor gives output curve like this. How can i interface
Actually, those curves look pretty linear, using 3 or 4 ranges. You get some value from the device, and it falls within some range. Test which range it is using compound of statements (if(value >= lowerLimit[0] && value < upperLimit[0]) // value in range 1). Then, in the body of the statement, use map() to get the corresponding output for the linear portion of the curve.