summaryrefslogtreecommitdiff
path: root/dev_scripts/vane_values.py
diff options
context:
space:
mode:
Diffstat (limited to 'dev_scripts/vane_values.py')
-rw-r--r--dev_scripts/vane_values.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/dev_scripts/vane_values.py b/dev_scripts/vane_values.py
new file mode 100644
index 0000000..b6b6803
--- /dev/null
+++ b/dev_scripts/vane_values.py
@@ -0,0 +1,11 @@
+# create voltage divider for use with MCP3008 ADC
+def volt_div(r1, r2, vIn):
+ vOut = (vIn * r2)/(r1 + r2)
+ return round(vOut,3)
+
+# calculate vOut values for each wind direction using known resistances from datasheet, 3.3 V from RPi and 4.7K ohm resistor
+
+resistances = [33000, 6570, 8200, 891, 1000, 688, 2200, 1410, 390, 3140, 16000, 14120, 120000, 42120, 64900, 21880]
+
+for i in range(len(resistances)):
+ print(resistances[i],volt_div(5000, resistances[i], 3.3))