ADC FiPy difficulty
-
I'm having difficulty getting meaningful ADC values with my FiPy and Expansion board 3. I have a 10k pot connected to ground and 3.3v. The wiper I have tried connecting to many different ADC pins such as P12, P,13, P14, P17, P16.
The values are pretty static regardless of what the position of the wiper is. Even if I short the input pin directly to the 3.3v there seems to be no change. Here's what I'm using:
from machine import ADC adc = ADC(0) adc_c = adc.channel(pin='P13', attn=ADC.ATTN_11DB) print(adc_c.voltage())Am I doing something silly here?
The expansion board firmware(3.1) is up to date. I haven't looked into upgrading the FiPy yet.
-
@peter_ I Cannot confirm your observation. I extended your little test code as follows (no pot), with a connection between P22 and P13:
from machine import ADC, DAC from time import sleep adc = ADC(0) adc_c = adc.channel(pin='P13', attn=ADC.ATTN_11DB) dac = DAC('P22') # create a DAC object for _ in range( 100): dac.write(_ / 100) print(adc_c.voltage()) sleep(0.1)Not that adc.voltage() requires a calibration for better values, and that the input of the ADC should be low impedance. If you pot has a high impedance, connect a small capacitor (~10 nF) between ADC input and GND,
-
Thanks, I didn't realize the pinout on the expansion board was different from the FiPy. PRINT TOO SMALL :-P
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login