Unstable value when use analog imput on pyboard v 1.1
Posted: Wed Jul 20, 2016 2:50 pm
HI,
I use an analog input. I use with a bridge voltage divider
Theorical :
Vin max = 15v R1 = 68KΩ
Vout max = 2,711 R2 = 15KΩ (i use an electrodoid to get the value)
For testing:
Vin = 8,61 R1 = 67900Ω (measured with a multimeter)
R2 = 15050KΩ (measured with a multimeter)
Code used boot.py and test.py:
######### boot.py #########
import machine
import pyb
REPL=pyb.UART(1,115200)
pyb.repl_uart(REPL)
pyb.main('test.py')
############ test.py ########
import pyb
# Turn blue LED on
blueled=pyb.LED(4)
blueled.on()
#first port test
#adc = pyb.ADC('X11')
#second port test
adc = pyb.ADC('X19')
def readADC():
print('Raw value on X19')
print(adc.read())
vout = adc.read() * (3.3 / 4096)
print('vout')
print(vout)
vin = vout * ((15050 + 67900) / 15050 )
print("vin")
print(vin)
while(1):
readADC()
pyb.delay(1000)
The analog value readed oscillate between 1877 and 2011, that’s really unstable.
When i test the code on a pyboard V 1.0, all measures are stable and exact.
Why ?
Do you have an idea ?
Does the problem come from a voltage regulator ?
Does the MCP1802 (pyboard 1.0) is better than the MCP1703 (pyboard 1.1) ?
Does the high-speed cristal clock (16Mhz) on pybord 1.1 can be the cause of the unstable measurement ?
How can i stabilise stabilize these values ?
i have reading the post http://forum.micropython.org/viewtopic. ... alog#p2321
the post don't resolve my problem
Thanks a lot.
I use an analog input. I use with a bridge voltage divider
Theorical :
Vin max = 15v R1 = 68KΩ
Vout max = 2,711 R2 = 15KΩ (i use an electrodoid to get the value)
For testing:
Vin = 8,61 R1 = 67900Ω (measured with a multimeter)
R2 = 15050KΩ (measured with a multimeter)
Code used boot.py and test.py:
######### boot.py #########
import machine
import pyb
REPL=pyb.UART(1,115200)
pyb.repl_uart(REPL)
pyb.main('test.py')
############ test.py ########
import pyb
# Turn blue LED on
blueled=pyb.LED(4)
blueled.on()
#first port test
#adc = pyb.ADC('X11')
#second port test
adc = pyb.ADC('X19')
def readADC():
print('Raw value on X19')
print(adc.read())
vout = adc.read() * (3.3 / 4096)
print('vout')
print(vout)
vin = vout * ((15050 + 67900) / 15050 )
print("vin")
print(vin)
while(1):
readADC()
pyb.delay(1000)
The analog value readed oscillate between 1877 and 2011, that’s really unstable.
When i test the code on a pyboard V 1.0, all measures are stable and exact.
Why ?
Do you have an idea ?
Does the problem come from a voltage regulator ?
Does the MCP1802 (pyboard 1.0) is better than the MCP1703 (pyboard 1.1) ?
Does the high-speed cristal clock (16Mhz) on pybord 1.1 can be the cause of the unstable measurement ?
How can i stabilise stabilize these values ?
i have reading the post http://forum.micropython.org/viewtopic. ... alog#p2321
the post don't resolve my problem
Thanks a lot.