summaryrefslogtreecommitdiff
path: root/dev_scripts/vane_values.py
blob: b6b680384313233e1ccef172edac715b1630202c (plain)
1
2
3
4
5
6
7
8
9
10
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))