TS-7250-V3 ADC

From embeddedTS Manuals
Revision as of 09:53, 8 January 2020 by Mark (talk | contribs)

This board supports a 5 channels of 12-bit ADC using an integrated ADC in the i.MX6UL CPU. These are sampled up to 2MS/s between all enabled channels. All channels can sample 0-10VDC, but channels 0-3 can optionally sample 0-20mA as a current loop.

These ADCs are accessed through the IIO layer in Linux. For slow speed samples the sysfs interface can be used.

cat /sys/bus/iio/devices/iio\:device0/in_voltage{0,1,5,8,9}_raw
ADC Header Pin Schematic Name IIO device IIO name Voltage Current loop
1 AN_CH1 iio:device0 voltage0 0-30VDC 0-20mA
3 AN_CH2 iio:device0 voltage1 0-30VDC 0-20mA
5 AN_CH3 iio:device0 voltage5 0-30VDC 0-20mA
7 AN_CH4 iio:device0 voltage8 0-30VDC N/A
8 AN_CH5 iio:device0 voltage9 0-30VDC N/A

The current loops are enabled/disabled with GPIO:

gpioset 4 7=0 # AN_CH1 voltage
gpioset 4 8=0 # AN_CH2 voltage
gpioset 4 9=0 # AN_CH3 voltage

gpioset 4 7=1 # AN_CH1 current
gpioset 4 8=1 # AN_CH2 current
gpioset 4 9=1 # AN_CH3 current

The libiio library provides simple access to the IO:

#!/usr/bin/env python3

import iio

ctx = iio.Context('local:')
dev = ctx.find_device('2198000.adc')

scan_channels = ["voltage0", "voltage1", "voltage5", "voltage8", "voltage9"]
i = int(0)
for chan_name in scan_channels:
	chn = dev.find_channel(chan_name)
	raw = int(chn.attrs['raw'].value)

	# Scale 0-4095 to 0-2500(mV)
	scaled = raw * (2.5/4095)

	# Scale voltage divider on the pin
	r1 = 330
	r2 = 22
	v = scaled / (r2 / (r1 + r2))

	i += 1
	print('AN_CH{}_V={:.3f}'.format(i, v))