text: Q:
  
  Scaling of digital reading of pressure sensor
  
  I have purchased one of these and I've connected it to a pressure sensor.  I now need to convert the digital values to pressure.  However, my maths is all forgotten.  Can anyone help me out?
  The discrete values I get back from the sensor are between 0 to 3750.  750 is equal to 0 bars pressure.  The top pressure the sensor can goto is 250 (which is 3750) and the values are linear.  
  Any help appreciated.  
  
  A:
  
  Linear for the win!
  y = (slope * x) + intercept is the classic linear formula, in your case, x=sensor, y=bars, so the formula becomes
  bars = (slope * sensor) + intercept
  
  ... and you have two data points of this formula, sensor@750, and sensor@3750
  equation 1: 0 = (slope * 750) + intercept
  equation 2: 250 = (slope * 3750) + intercept
  
  ... lets rearrange the 1st equation in terms of the intercept, so
  - (slope*750) = intercept
  
  ... and use this intercept equation in the 2nd equation, so
  250 = (slope * 3750) + (-(slope*750))
  
  ... continue by solving for the slope
  250 = 3750slope - 750slope
  250 = (3750 - 750) slope
  250 = 3000 slope
  250 / 3000 = slope
  1/12 = slope
  
  ... use this in equation 2 to find the intercept
  250 = (1/12 * 3750) + intercept
  250 - 312.5 = intercept
  - 62.5 = intercept
  
  ... and you have your final conversion equation!
  bars = (sensor / 12) - 62.5
  
  Which is valid with the 2 examples you started with.
  
  A:
  
  since a picture is worth a thousand words:
  
  