08-28-2017 06:42 AM
Hello,
I am seeking some help here, because I am totally new to I2C protocol. I read the basics, and I also went through the chip manual of the AD module for the Raspberry PI.
I am planning to use some Raspberry PI3 with the following module for analogue signal measurements (the module is connected to the RPi via its GPIO pins): http://wiki.52pi.com/index.php/RPI-ADS1115-ADC-Module_SKU:EP-0076#How_to_wire_up
I installed the driver for the Raspbian OS, and all the Python examples run fine, I measure what I expect: https://github.com/adafruit/Adafruit_Python_ADS1x15
I would like to use this AD module via the product "LabVIEW for Raspberry PI compatible compiler - Home Edition" (https://www.tsxperts.com/labviewforraspberrypi/ ). I installed the special image for the RPi, and I can deploy and run fine LabVIEW VIs as *.pyzw files from the RPi linux. There is a subpalette for the I2C functions, I try to use the functions here to create communication VIs for my hobby project:
I have attached my VI as a snippet too, plus some more relevant files, like the chip ADS1115 manual (the important pages are 11., 18-19.).
I tried to follow the procedure what is described in the section "Quickstart guide", at page 11. However, I am not really sure whether I write to the device registers in the proper manner. The data what I read out from the conversion register, does not seem to be correct (maybe the LSB and MSB should be swapped?). So I guess I must do something or several things wrong... I hope someone could help me how to make a proper I2C programming in this particular case. Thanks!!
...Some more screenshots below:
08-28-2017 11:43 AM - edited 08-28-2017 11:49 AM
I was playing all the day with this, and no success so far 😞 I tried different combinations of different functions from the toolkit, to mimic the simple example in the ADS1115 manual, but either I read wrong registers/garbage data or I try to parse the results in the wrong way. Clearly, my brute "intuitive guessing method" is not a success for this I2C comm 😄
I might give a try to the LINX option, but I wanted to avoid the limitation namely I cannot use in that case LabVIEW versions above 2014...
edit: there was a slight mistake in the "config Data MSB": I specified the Bits[14:12] as default, but I wired the board for single ended (AI0 and GND), but changing these bits to "100" did not help, still getting garbage. When I use the same multiplexer config with the Python example code, I get exactly the same voltage values what I generate, so the hardware side is OK...
08-28-2017 01:28 PM
Just some additional info. Of course, to calculate the measured voltage, we need to convert the result (MSB+LSB, two bytes) of the AD converter into voltage: Voltage = Result / 2^N * Fullscale(Volts) . For single ended input config, N=15, for differential mode, N=16.
So I was producing different voltages, but the result did not seem to match with the input levels...
08-29-2017 05:56 AM - edited 08-29-2017 06:02 AM
Ok, I might give another try to the TSXperts toolkit later, but now the most simple thing was just use Python code on the Raspberry PI. I made a simple UDP server to broadcast the measurement data, and I listen for the UDP from the LabVIEW client at the PC side (UDP is enough for me, more straightforward then TCP and I do not need lossless comm, just a kind of "tag"-like broadcast, to catch the latest values at the PC side.
I program some simple parsing at the LV side, like using a start and end marker for the UDP datagrams, and also some checking for valid numbers...
edit: so in this way I can make a lightweight headless logger with 4 x 4 (4 I2C addresses for these ADS1115 boards) single ended channels and 15 bits res 🙂 4 x 15 EUR + 35 EUR = approx 100 EUR to get 16 channels, plus some wiring, casing and voltage dividers 🙂
09-19-2017 08:06 PM
Hi Blokk,
I am also interested in running LABVIEW code with ADS1115 on Rasberry Pi 3. Any luck with using the TSXperts toolkit?
09-20-2017 12:09 AM
@pichw wrote:
Hi Blokk,
I am also interested in running LABVIEW code with ADS1115 on Rasberry Pi 3. Any luck with using the TSXperts toolkit?
No, I also wrote to the TSXperts forum, but no reply so far. I imagine I could make it work, but I didn't have time to play with it further. Since I only want to use the RPi as a headless data logger, I just use a tiny Python code to require data at the 4 channels. Because I do not need a lossless data broadcast here, I decided to add an UDP broadcast part to the Python code instead of TCP. The benefit is that, the Python side does not care about whether any client is connected or not, it just send telegrams out every second to the required IP address, thus I did not need to program more in Python to handle TCP timeouts, etc.
On the LabVIEW side is just needed an UDP listener to capture the data. Works nice!