In this case, the ADC result will be converted to Inches of Mercury (Hg). The pressure sensor provides us with a voltage between .2v and 4.6v. Since this is not the 0v to 5v which represents 0-1023 as ADC output, the actual result will need to be known.
The new ADC range is:
LowEnd = 1024 / ( 5v / lowVoltage)
= 1024 / (5v / .2v)
= 40.96
= 41
HighEnd = 1024 - (1024 / (5v / (5v - highVoltage)))
= 1024 - (1024 / (5v / (5v - 4.6v)))
= 1024 - (1024 / (5v / .4v))
= 1024 - (1024 / 12.5)
= 1024 - 81.92
= 942.08
= 942
The ADC range is 41 - 942, to convert this number to inches of Hg a formula will be created.
The 41 represents the high vacuum and the 942 represents the low or no vacuum. This is why the LCD was showing 942 without any suction. The high vacuum is -115 KPa which is 33.96 inches of Hg.
942 = 0 inches of Hg
41 = 33.96 inches of Hg
The slope intercept formula will be used to determine the conversion:
y = mx + b
m = rise/run = ?y/?x
x values are 942, 41
y values are 0, 33.96
?x = 942-41 = 901
?y = 0-33.96 = -33.96
m = -33.96/901 = -0.0377
So far, we have:
y = -0.0377x + b
To find b, we simple plug in a y and x value from the top:
0 = -0.0377(942) + b
0 = -35.5134 + b
Add 35.5134 to both sides:
(35.5134) + 0 = -35.5134 + (35.5124) + b
35.5134 = b
So the formula is:
y = -0.0377x + 35.5134
inches of HG = -0.0377(ADC_Value) + 35.5134
Comments and Additional Information
Have some code to share? Or additional information? Respond here:
You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.