Hi!
I've been reading up on lookup tables, but most of the stuff I've read has been to advanced, or a brute force approach which I'm trying to avoid.
Here is my goal:
I have a tempmin and tempmax that I've mapped to a variable with PWM
voltage = map(temp, tempMin, tempMax, 0, 255);
What I am trying to do is display either a percentage or actual voltage based off the PWM. Which is easy right?
voltageDisplay = map(temp, resMin, resMax, 0, 11.8);
lcd.print(F("Voltage: "));
lcd.print(voltageDisplay, 0);
Except it's not linear. I probably need to get more data points, but I took 34 points in testing and came up with a quick chart. There are no test points below 1.5v so it's a straight line to 0, and on the upper end I widened the test points as there was very little voltage change for the larger PWM increases, but you can tell in the chart that there are flat spots.
Can someone explain in layman's terms how to accomplish my goal? I can probably muddle through but I doubt that it would be an efficient solution....
Eventually I would like to base my PWM voltage control off of the temperature and convert it to a linear output (i.e. 1c° increase = 1v increase) As right now my increase for 1c° would be close 5.5v on the bottom end and less than 0.5v on the top end. But hopefully if I can figure out lookup tables for my display voltage, I would be able to in turn use those as a control method based off of percentages. Or at least that's what the hamster wheel in my head is squeaking....