How to map sensor analog output voltage My sensor output voltage values ranges from 0.6 V - 3 V. How can I convert this voltage values to ppm in the range 0-1000? Upon exposure to CO gas: 0 ppm = 0.6 V , 500 ppm = 1.52 V and 1000 ppm = 3.01 V. Which means that the sensor cannot detect under 214 ppm (approx). Can you please help with mapping the sensor output values as ppm in the serial monitor? thnk u

// the setup routine runs once when you press reset:
    void setup() {
      // initialize serial communication at 9600 bits per second:
      Serial.begin(9600);
    }

    // the loop routine runs over and over again forever:
    void loop() {
      // read the input on analog pin 0:
      int sensorValue = analogRead(A0);
      // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
      float voltage = sensorValue * (5.0 / 1023.0);

      // print out the value you read:
      Serial.println(voltage);

    }
On page 4 of the datasheet,


  Left side value of detection range (zero point) is corresponding to left side value of voltage output range,but right side value of detection(max detection value) is not corresponding to the right side value of voltage output range.


Thus, 0ppm would correspond to 0.6V, for CO. And 1000ppm does not necessarily correspond to 3V.

Assuming that 500ppm = 1.52V was obtained from the "inspection report", you now have two reference points, (0, 0.6) and (500, 1.52).

Further below on the same page, a formula for N is given, which, points towards a linear response of Vo with respect to ppm. Thus, you can use the map() function to do the linear mapping from voltage to ppm.

Note that map() only works with integers, so instead of mapping voltage (0.6 - 1.52) to ppm, you should directly map the analogRead value (123 - 311) to ppm to get better accuracy. Other wise, implement your own mapping using floats.