Hi Speedy !
speedy wrote:You gave this example based on a 270 degree pot. ... adjustments also are made by degrees ... [lower limit 45 + working aria 180 + 45 upper limit = 270 degree ] ... 45+180=210 +45=270 degree ...
No, my friend, it is not so. Firmware does not know anything about pots degrees. Only voltage on ADC and AREF inputs. And calculation should be next:
Example for 5V on AREF for 270 degrees potentiometer. - Output diapason (0..5V from potentiometer) = 270 degrees. It's mean that one degrees = 5V/270 =
18.5 mV.
- Input voltage (diapason 0..5V AREF) ADC converts to digit value (one byte 0..255). It' mean that ADC digit value for 1V = 256/5V =
51.2- For Working area (180 degrees) you should to set low threshold = (270-180)/2 = 45 degrees.
In voltages 45 deg *
18.5 mV = 0.8325 V.
In ADC value 0.8325V *
51.2 =
43. - Summary for 5V AREF and 270 deg pots for setting 180 deg working area you should to set
SensLo = 43 and
SensHi =212 (255-43).
It's mean that my default values in FW reduces working area to 176 degrees (instead 180)
Example for 5V on AREF for 10 turns potentiometer. - Output diapason (0..5V from potentiometer) = 10 turns. It's mean that one turn = 5V/10 =
500 mV.
- Input voltage (diapason 0..5V AREF) ADC converts to digit value (one byte 0..255). It' mean that ADC digit value for 1V = 256/5V =
51.2- For Working area (3 turns) you should to set low threshold = (10 - 3)/2 = 3.5 turns.
In voltages 3.5 turns *
500 mV = 1.75 V.
In ADC value 1.75 V *
51.2 =
90,
- Summary for 5V AREF and 10 turns pots for setting 3 turns working area (in the center) you should to set
SensLo = 90 and
SensHi =165 (255-90).
This is in theory. BUT IN THIS CASE YOU REDUCE FEEDBACKS ACCURACY, because you will use only 3/10 of ADC diapason.
There are two ways to solve this problem. Increase voltage on potentiometer or decrease voltage on AREF pin. First way is dangerous.
For better accuracy I recommend to you next way: reduse AREF voltage to 2.0V. And use as wirking area of potentiometer turns 0.5..3.5. If AREF = 2V max voltage for ADC will be reached at the
end of the fourth turn. we can consider the pot as 4 turns
Example for 2.0V on AREF for 10 turns potentiometer.(use 0.5..3.5 turns as working area) - Output diapason (0..5V from potentiometer) = 10 turns. It's mean that one turn = 5V/10 =
500 mV.
- Input voltage (diapason 0..2V AREF) ADC converts to digit value (one byte 0..255). It' mean that ADC digit value for 1V = 256/2V =
128- For Working area (3 turns) you should to set low threshold = (4
(used only 4 turns) - 3)/2 = 0.5 turn.
In voltages 0.5 turn *
500 mV = 0.25 V.
In ADC value 0.25 V *
128 =
32,
- Summary for 2.0V AREF and 10 turns pots for setting 3 turns working area (0.5-3.5 turns) you should to set
SensLo = 32 and
SensHi =223 (255-32).
Ooph...
Best regards,
Ale