ADC tests - 20180103a test of acquisition with a AD08200 ADC pHAT

Testing Felix file with AD08200

import matplotlib.pyplot as plt
import numpy as np

def GetSeries(Volts):

    Map = np.zeros((len(Volts)-1,34), dtype=np.int)
    for i in range(len(Volts)-1):
        val = Volts[i]
        for k in range(34):
            Map[i][k] = (val & 2**k)/2**k

    return Map

Opening file

Bytes = np.fromfile("felix.data", dtype = '<i4')
n = len(Bytes)
print n
Map = GetSeries(Bytes)
Duration = Bytes[n-1]
Fech = n*1.0/(Duration*1e-9)/1e6
10001
print "It took "+str(Duration)+ "ns to record "+ str(n-1)+" samples."
print "Sampling freq is "+str(Fech)+" Msps."
It took 843992ns to record 10000 samples.
Sampling freq is 11.8496383852 Msps.
im = plt.imshow(Map, cmap='hot', aspect="auto")
#plt.colorbar(im, orientation='horizontal')
plt.show()

png

plt.plot(np.var(Map,0))
plt.show()

png

for m in range(32):
    if (np.var(Map,0)[m] > 0.0003) :
        print str(m)+" - "+str(np.var(Map,0)[m])
4 - 0.24966876
7 - 0.24990199
8 - 0.23792199
9 - 0.077775
10 - 0.00803439
11 - 0.002991

Bits on the AD08200

Clock: close to 0.25

  • D0: 26 - GPIO7
  • D1: 24 - GPIO8
  • D2: 21 - GPIO9
  • D3: 19 - GPI10
  • D4: 23 - GPI11
  • D5: 16 - GPI23
  • D6: 18 - GPI24
  • D7: 22 - GPI25
ADC2_GPIO = [7, 8,9,10,11,23,24,25]
ADC2len = len( ADC2_GPIO)
def GetV2(Volts):
    Signal = []
    Map = np.zeros((len(Volts),ADC2len), dtype=np.int)
    for i in range(len(Volts)):
        val = Volts[i]
        SignalZero = 0
        for k in range(ADC2len):
            Map[i][k] = (val & 2**k)/2**k
        for k in range(ADC2len):
            SignalZero += 2**k*((val & 2**ADC2_GPIO[k])/2**ADC2_GPIO[k])
        Signal.append(SignalZero)


    return Signal,Map
t = range(n)
for k in range(n):
    t[k] = 1.0*t[k]/Fech
M = GetV2(Bytes)[0]
plt.plot(t,M[0:n])
plt.xlabel('t in us')
plt.show()

png

plt.plot(t[9000:10000],M[9000:10000])
plt.xlabel('t in us')
plt.show()

png



results matching ""

    No results matching ""