Trevor
0
- Joined
- Jul 17, 2009
- Messages
- 4,386
- Points
- 113
Tutorial: Determine the curve adjustment for your DIY LPM!
Now that OpenLPM has a built-in method of adding a curve adjustment for your chosen sensor, I thought it might be a good idea to publish a tutorial on how to determine what that curve adjustment should be.
The favored "sensor" nowadays is a TEC that is thermal-pasted to a heatsink. Each TEC is different and is going to have a different response curve over the full range of power input. In order to have an accurate LPM, you need to make sure you account for this nonlinearity.
There are two ways to account for nonlinearity. The first method is a stepwise adjustment. It takes only a little bit of processing power, and is thus well-suited to a lightweight platform. Using this method, you would have different linear adjustment for different power ranges. This is a simple method used in the often lauded LaserBee LPM's. Each area of the curve adjustment approximates a polynomial adjustment, and tries to keep the readings within the accuracy rating. The LaserBee does not have an accuracy rating, but users have found it typically within 3%. So a stepwise adjustment obviously works - and it works well!
However, it has one major drawback. There are knees in the response curve. So, as a laser settles onto a particular reading, a stepwise adjustment could lead to a jittering reading if the laser power hovers at one of the knees in the curve. This is not ideal - especially when you wish to use a differentiator to speed up the response time of sensors with large thermal mass. The jitter would cause the differentiator to dramatically alter the readings and lead to massive inaccuracy.
( It's worth noting: If you don't want to use a differentiator, the knees don't matter as much. At most, you'd get a jitter of a few milliwatts if the reading hovered there. For what it's worth, no one has ever (to my knowledge) noticed any LPM with a stepwise adjustment exhibit this behavior. )
This leads me to the second, more robust method of curve adjustment: continuous adjustment. Using this method, you determine the actual equation for the response of the sensor.
What you need:
Once you've gotten to the stage of determining a curve adjustment, you've likely got your LPM very, very close to true readings - except you've noticed that it's off by some nonlinear amount at various power levels.
The first thing you'll do is build an excel sheet that looks something like this:
In the left column, you have the power displayed by your DIY LPM. In the right column, you have the actual laser power as verified by your calibrated LPM. For the sake of this tutorial, these are dummy values.
Once you have values over the whole operating range of your LPM, create a scatter plot. To get it to work properly, copy your "Input Power" column and paste it to the right of the "Output Reading" column. Highlight all three columns, and create a scatter plot (with lines).
For my dummy values, it looks like this:
You can see it' a bit low at low powers, and significantly high at higher powers. Now, highlight just your second two columns ( "Output Reading" and "Input Power" ) and create another scatter plot. This time, the output readings will act as the X-axis. This will allow us to come up with a way to map the output readings to the actual input power. Once you've done that, add a trendline to your graph. You may need to experiment with different types. Make sure you tell Excel to show the equation for the trendline.
For my dataset, a simple second-order polynomial function perfectly described the relationship between the readings the LPM output and the actual power of the laser shone onto the sensor.
Now, you can translate this equation into code and have your LPM firmware correct for the nonlinearity of your sensor. Now you can also create a differentiator for your LPM without fear of inaccurate readings due to stepwise adjustment jitter.
I hope this helps out anyone who's working on bringing a new LPM to market!
Trevor
Now that OpenLPM has a built-in method of adding a curve adjustment for your chosen sensor, I thought it might be a good idea to publish a tutorial on how to determine what that curve adjustment should be.
The favored "sensor" nowadays is a TEC that is thermal-pasted to a heatsink. Each TEC is different and is going to have a different response curve over the full range of power input. In order to have an accurate LPM, you need to make sure you account for this nonlinearity.
There are two ways to account for nonlinearity. The first method is a stepwise adjustment. It takes only a little bit of processing power, and is thus well-suited to a lightweight platform. Using this method, you would have different linear adjustment for different power ranges. This is a simple method used in the often lauded LaserBee LPM's. Each area of the curve adjustment approximates a polynomial adjustment, and tries to keep the readings within the accuracy rating. The LaserBee does not have an accuracy rating, but users have found it typically within 3%. So a stepwise adjustment obviously works - and it works well!
However, it has one major drawback. There are knees in the response curve. So, as a laser settles onto a particular reading, a stepwise adjustment could lead to a jittering reading if the laser power hovers at one of the knees in the curve. This is not ideal - especially when you wish to use a differentiator to speed up the response time of sensors with large thermal mass. The jitter would cause the differentiator to dramatically alter the readings and lead to massive inaccuracy.
( It's worth noting: If you don't want to use a differentiator, the knees don't matter as much. At most, you'd get a jitter of a few milliwatts if the reading hovered there. For what it's worth, no one has ever (to my knowledge) noticed any LPM with a stepwise adjustment exhibit this behavior. )
This leads me to the second, more robust method of curve adjustment: continuous adjustment. Using this method, you determine the actual equation for the response of the sensor.
What you need:
- Known, recently calibrated LPM.
- Lasers to test with over the entire intended range of your DIY LPM.
- Microsoft Excel
Once you've gotten to the stage of determining a curve adjustment, you've likely got your LPM very, very close to true readings - except you've noticed that it's off by some nonlinear amount at various power levels.
The first thing you'll do is build an excel sheet that looks something like this:
Code:
Output Reading Input Power
0.413 10
10.852 20
21.317 30
31.808 40
42.325 50
52.868 60
63.437 70
74.032 80
84.653 90
95.3 100
105.973 110
116.672 120
127.397 130
138.148 140
148.925 150
159.728 160
170.557 170
181.412 180
192.293 190
In the left column, you have the power displayed by your DIY LPM. In the right column, you have the actual laser power as verified by your calibrated LPM. For the sake of this tutorial, these are dummy values.
Once you have values over the whole operating range of your LPM, create a scatter plot. To get it to work properly, copy your "Input Power" column and paste it to the right of the "Output Reading" column. Highlight all three columns, and create a scatter plot (with lines).
For my dummy values, it looks like this:
You can see it' a bit low at low powers, and significantly high at higher powers. Now, highlight just your second two columns ( "Output Reading" and "Input Power" ) and create another scatter plot. This time, the output readings will act as the X-axis. This will allow us to come up with a way to map the output readings to the actual input power. Once you've done that, add a trendline to your graph. You may need to experiment with different types. Make sure you tell Excel to show the equation for the trendline.
For my dataset, a simple second-order polynomial function perfectly described the relationship between the readings the LPM output and the actual power of the laser shone onto the sensor.
Now, you can translate this equation into code and have your LPM firmware correct for the nonlinearity of your sensor. Now you can also create a differentiator for your LPM without fear of inaccurate readings due to stepwise adjustment jitter.
I hope this helps out anyone who's working on bringing a new LPM to market!
Trevor