Neercs
Posts: 13
Joined: Mon Oct 05, 2015 1:47 pm

Electrical drawing SPI - ADS1118

Mon Dec 14, 2015 10:01 pm

Hi everybody,

I would like to check with you my electrical drawing as I am not very good with this matter....
In order to convert Analog Data from a plug-in module for pressure gauges (TPG 300 with 2 Pirani and 1 Cold Cathode gauges) into Ditigal Data to be read and used in a program on a Raspberry Pi 2B, I am going to use the SPI interface with an Analog Digital Converter ADS1118 from TI.

Here are the datasheet of these devices.

TPG 300
: http://lmu.web.psi.ch/docu/manuals/bulk ... PG_300.pdf
Pirani and Cold Cathode (outputs signal : page 32/33) : http://lmu.web.psi.ch/docu/manuals/bulk ... plugin.pdf
ADS1118 : http://www.ti.com/lit/ds/symlink/ads1118.pdf

The gauges can deliver in outputs 0 to 10 V and the ADC ADS1118 can receive on the analog inputs VDD + 0.3 V (with VDD ranging from 2V to 5.5V), if I read these datasheets correctly...
I plan to supply the ADC ADS1118 with the 5V pins of the Raspi. So my analog inputs can receive a max value of 5.3 V...
For every analog inputs (3 inputs) I plan to divide the max value that can be delivered by the gauges 10V to 5V for the ADC... So I will need 3*2 resistors (one voltage divider for each inputs) with the same value...

However I do not know which resistor to use (1000 Ohm, 500, 200 ...) ?
Actually, I am concerned about the use of voltage dividers to do what I want as I am not 100% sure that they will not modify the analog signal which is non-linear. Is there any risk to modify the signal ? Is there any other way to connect the gauges to my ADC safetely ?

Thank you in advance for your help.

ghp
Posts: 1498
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Electrical drawing SPI - ADS1118

Tue Dec 15, 2015 7:17 am

Hello,
the TPG 300 provides RS232 output, if there are IF300A or IF300B interface boards available.
A first look to the data sheet shows that on RS232, there are the measurement values available.
If the TPG300-internal data conversion is good enough, I would suggest to use a USB to rs232 converter and connect this device 'digitally'.

For the analog signal outputs, max 2mA are allowed. I would start with a voltage divider with total 10k, which yields to a 1mA current.
Measurement voltage is 0..10V, but somewhere in the data sheet I have seen that error condition are given with voltages >11,5V
If you operate the ADC at 5V, in order to have full resolution you should use 4.096 V range for the PGA, single ended input. Then you may use resistor 10k * 4.096/10 on low side of voltage divider.
This provides also some safety margin if the input is higher than 10V.
Use precision, low temp-coeff resistors.
Proper shielding is necessary for these signals.

Voltage dividers are quite precise, but consider you have somewhere a connection resistor of 100mOhm, this results in an error @1mA which is prox 2 bit.
You could use a preamp stage, high impedance input to avoid these errors, but this adds additional gain- and offset errors.

If operating the ADC at 5V, use level shifters on digital side towards RPI.
Regards,
Gerhard

Neercs
Posts: 13
Joined: Mon Oct 05, 2015 1:47 pm

Re: Electrical drawing SPI - ADS1118

Tue Dec 15, 2015 10:36 am

Hi Gerhard,

Thank you again for your technical and accurate answer.

However, I am not sure to understand everything (especially for the PGA..) so I quickly drew a scheme.
We do not have IF300A or IF300B interface boards on our TPG 300 we juste have a PI3000D and a Cold Cathod board...

Image


Please can you tell me if it is what you mean.

Thanks

ghp
Posts: 1498
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Electrical drawing SPI - ADS1118

Tue Dec 15, 2015 1:20 pm

Hello, here a drawing of how I understood the problem. Digital side not included.
What you see is that the '-'-outputs of the boards get connected. This is possibly a problem, you need to find out if this is allowed.
divider.jpg
divider.jpg (20.57 KiB) Viewed 2497 times
Nice opportunity to ask the manufacturer if this is allowed..

If not allowed, things get slightly more complicated.
Regards,
Gerhard

Neercs
Posts: 13
Joined: Mon Oct 05, 2015 1:47 pm

Re: Electrical drawing SPI - ADS1118

Sun Dec 20, 2015 10:18 am

Hi everybody,

I have connected everything as suggested by ghp. However when I measure the total resistances with a multimeter on each channel I do not have the exact values (+/-5 Ohms)... Anyway I am going to try with this.
Now I would like to test the ADC ADS1118. I found a code on the github page of Adafruit which has been designed for the ADC ADS1115 and working with I2C communication.
https://github.com/adafruit/Adafruit-Ra ... ADS1x15.py
The parameters and configuration of this ADC are very similar to the ADS1118 (SPI communication) I am using.
I am trying to replace the parts of the Adafruit code used to set up the I2C communication with the spidev library : http://raspberrypi-aa.github.io/session3/spi.html. I manage to read values on my 3 channels with the methode xfer2, but I do not know how to do to configure the ADC in the same fashion than the original Adafruit Code (set the gain of the PGA, set the data rate...). Is it possible to do this with spidev ? writebytes ? http://tightdev.net/SpiDev_Doc.pdf

Cheers

ghp
Posts: 1498
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Electrical drawing SPI - ADS1118

Mon Dec 21, 2015 9:28 am

Hello,
these few ohms difference are below a 1/1000 rate. Not so bad.
spidev library can be used to write data to SPI-devices. xfer2 is usually used, as it keeps chip select active during transfer.
Here some line of code out from a sample (not related to ads1118, just demonstrating the basics)

Code: Select all

        spi.max_speed_hz = 800000
        r = spi.xfer2([1, (2+channel)<<6, 0]) 
I usually build the arrays to send from scratch each time. When arrays are reused, I found some problems that the input for xfer2 was overwritten. Then use a list()-function to provide a copy of the data. Bud I did not double check this with current releases.
Regards,
Gerhard

peterjazenga
Posts: 1
Joined: Thu May 05, 2016 10:32 am

Re: Electrical drawing SPI - ADS1118

Thu May 05, 2016 10:41 am

There are a few issues to consider with this proposal
critically important is the voltage when talking to the Pi, connect the ADC to the 3v3 supply or use logic level transition boards or you risk destroying the pi and ADC device
When scaling input voltages on the ADC analog interface you should only use precision resistors and even those will introduce some inaccuracies
The load resistance also affects the input value so keep the resistor values as high as practicable or use buffering OP amps
Depending on your needs, you can choose a simple device like the LM324 quad op amp and accept its limitations or you can opt for very high quality instrumentation amplifiers
If measuring AC signals then you will need a rectifier circuit but for DC a simple resistor divider will suffice

Return to “Interfacing (DSI, CSI, I2C, etc.)”