FiPy + Expansion Board 3.1 - Analog input calibration



  • So I wrote the code looking at the examples. My analog output from the sensor connected to P18 of the Expansion Board 3.1 (I did upgraded its firmware before that).

    history = array.array('I')
    adc = ADC(bits=12)
    print("adc: {}".format(adc))
    
    # CALIBRATION
    
    # Output Vref of P22
    adc.vref_to_pin('P22')
    print("set vref to pin 22")
    
    adc.vref(1310)#1100)
    print("set adc ref value to 1310")
    
    # ADC.ATTN_11DB — the full range voltage: 3.3V
    
    adc_c = adc.channel(pin='P18', attn=ADC.ATTN_11DB) 
    print("got adc channel on P18")
    
    while True:
        v = adc_c.voltage()
        history.append(v)
        print("Voltage: {}".format(v))
    

    So when I plug FiPy and measure P22 of the Expansion Board 3.1 I get values 1310 on average...When I run this with device connected I get values like that while sensor is not measuring anything (but this is ECG sensor so is it that noisy/sensitive?)

    At any rate I do not understand all these values and have no idea if they are correct. I am also confused about calibration despite reading all available posts on this forum. Is P22 has 1.1V by default? What else do I need to do besides what I did in my code... I really do not care in what units the results are displayed - I just need them to be accurate relatively to each other so I can get accurate EKG graph...

    Voltage: 2270
    Voltage: 2174
    Voltage: 1601
    Voltage: 1118
    Voltage: 1115
    Voltage: 1484
    Voltage: 2094
    Voltage: 2302
    Voltage: 2044
    Voltage: 1436
    Voltage: 1065
    Voltage: 1175
    Voltage: 1636
    Voltage: 2188
    Voltage: 2261
    Voltage: 1930
    Voltage: 1320
    Voltage: 1052
    

    Also just want to verify that I used voltmeter correctly - touch the ground pin on Expansion Board with black wire from voltmeter and P22 on Expansion Board with red wire from voltmeter. I could not touch the pin directly - the holes on Expansion Board are too small (ok, don't lough), so I used extra wires and sometimes headers to touch them and was getting most of the time reading of 315 mV (using wires). And then with a header and pins got 1310 mV...
    Any ideas?


Log in to reply
 

Pycom on Twitter