From 4a6360f2afe8380b92174ccb508e4065a7d0c9c7 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 22 Aug 2020 17:01:35 -0400 Subject: [PATCH] adc_temperature: Calculate "PT100 INA826" values from formula Calculate the "PT100 INA826" values instead of using a voltage table. Signed-off-by: Kevin O'Connor --- klippy/extras/adc_temperature.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/klippy/extras/adc_temperature.py b/klippy/extras/adc_temperature.py index 6e02118a..64f58cd1 100644 --- a/klippy/extras/adc_temperature.py +++ b/klippy/extras/adc_temperature.py @@ -261,19 +261,6 @@ AD8497 = [ (1360, 6.671), (1380, 6.754) ] -PT100 = [ - (0, 0.00), (1, 1.11), (10, 1.15), (20, 1.20), (30, 1.24), (40, 1.28), - (50, 1.32), (60, 1.36), (70, 1.40), (80, 1.44), (90, 1.48), (100, 1.52), - (110, 1.56), (120, 1.61), (130, 1.65), (140, 1.68), (150, 1.72), - (160, 1.76), (170, 1.80), (180, 1.84), (190, 1.88), (200, 1.92), - (210, 1.96), (220, 2.00), (230, 2.04), (240, 2.07), (250, 2.11), - (260, 2.15), (270, 2.18), (280, 2.22), (290, 2.26), (300, 2.29), - (310, 2.33), (320, 2.37), (330, 2.41), (340, 2.44), (350, 2.48), - (360, 2.51), (370, 2.55), (380, 2.58), (390, 2.62), (400, 2.66), - (500, 3.00), (600, 3.33), (700, 3.63), (800, 3.93), (900, 4.21), - (1000, 4.48), (1100, 4.73) -] - def calc_pt1000(): # Calc PT1000 temperature/resistance pairs using formula A, B = (3.9083e-3, -5.775e-7) @@ -281,6 +268,13 @@ def calc_pt1000(): PT1000 = calc_pt1000() +def calc_ina826_pt100(): + PT100 = [(t, .1 * r) for t, r in PT1000] + # Standard circuit is 4400ohm pullup with 10x gain to 5V + return [(t, 10. * 5. * r / (4400. + r)) for t, r in PT100] + +PT100 = calc_ina826_pt100() + def load_config(config): # Register default sensors pheaters = config.get_printer().load_object(config, "heaters")