0

Issues with AnalogIn function - possible noise?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Issues with AnalogIn function - possible noise?

by tylerk666666 on Fri Aug 09, 2019 2:56 pm

I've been working on trying to get a voltage reading from an input to the Trinket m0. Was feeding in about .5 V to one of the I/O ports, and was getting a voltage reading of about 40,000 out of the 65535 scale that the device outputs voltages in. Converted voltage reading is about 2V out of 3.3 V device can handle. However, even when disconnecting the voltage input and just reading the voltage of the pin while the device isn't connected to a signal- still getting around this same voltage reading. Is there an issue with noise of the devices? Would assume voltage should be around 0V . Any help on the Analog In function, alternate ways of getting voltage readings, noise troubleshooting, etc. would be helpful.

Thanks

tylerk666666
 
Posts: 3
Joined: Fri Aug 09, 2019 2:52 pm

Re: Issues with AnalogIn function - possible noise?

by franklin97355 on Fri Aug 09, 2019 3:01 pm

Try shorting the pin to ground and see what you get.

franklin97355
 
Posts: 21087
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Issues with AnalogIn function - possible noise?

by tylerk666666 on Fri Aug 09, 2019 6:18 pm

franklin97355 wrote:Try shorting the pin to ground and see what you get.


This is code I'm using:

import board
import analogio
import time

adc0 = analogio.AnalogIn(board.A2)
adc1 = analogio.AnalogIn(board.A0)
adc2 = analogio.AnalogIn(board.A1)

print(adc0.value)
print(adc1.value)
print(adc2.value)


I shorted pin 0 and pin 1~ to ground, no connection to pin 2-

returned voltage values are:

53664
31488
41360

Not sure what else could be wrong- if USB is connected to computer via device can Batt and 3V pins be left be or do they need to be connected?

tylerk666666
 
Posts: 3
Joined: Fri Aug 09, 2019 2:52 pm

Re: Issues with AnalogIn function - possible noise?

by tylerk666666 on Wed Aug 14, 2019 10:11 am

tylerk666666 wrote:
franklin97355 wrote:Try shorting the pin to ground and see what you get.


This is code I'm using:

import board
import analogio
import time

adc0 = analogio.AnalogIn(board.A2)
adc1 = analogio.AnalogIn(board.A0)
adc2 = analogio.AnalogIn(board.A1)

print(adc0.value)
print(adc1.value)
print(adc2.value)


I shorted pin 0 and pin 1~ to ground, no connection to pin 2-

returned voltage values are:

53664
31488
41360

Not sure what else could be wrong- if USB is connected to computer via device can Batt and 3V pins be left be or do they need to be connected?



Any ideas?

tylerk666666
 
Posts: 3
Joined: Fri Aug 09, 2019 2:52 pm

Please be positive and constructive with your questions and comments.