I want to write a script in python that will do data acquisition with the beaglebone black. However, I'm only getting noise when I read in values.
I have a circuit set up to feed in a signal (I was running about a .1-10 Hz 12v square pulse), the voltage regulator limits the voltage to 5v, and the voltage divider drops it down to a safe voltage (~1v) for the analog pin on the BBB.
Circuit:
Then using a python script I wanted to log the values into an array and plot them once the program finished.
In ipython shell:
In [1]: import Adafruit_BBIO.ADC as adc
In [2]: import time
In [3]: AIN0 = "P9_39"
In [4]: T = 0.1 # or some other value
In [5]: adc.setup()
In [6]: a = []
In [7]: while True:
a.append(adc.read(AIN0)*1800) # pin value times 1.8 ref voltage
time.sleep(T)
After running for a while, I crash the script and write a
to a file to be scp
ed to my desktop. But when I plot it, it's only noise. I've hooked up on o-scope between AIN0
and ground and the wave form is what I expect. I also set up a potentiometer like so:
And I am able to read in the correct values through python. So, I figure it must be something about doing a continuous sampling that's creating problems.
AIN0
andADC_GND
nodes would be at the same potential. – user149341