I am looking to write out data collected by a thermocouple on a T7 to a flash drive inserted into a Raspberry Pi 3. I am new to both LabJack and Raspberry Pi and am hopeful that someone can offer some tips on what to do next.
I have written a script in Lua that gives me temperature data (in Kipling), but I do not know how to connect the Raspberry Pi to the LabJack. When I tried to connect the two via USB, the LabJack did not respond - I do not think it was receiving power. Can I connect the two via ethernet cable and power each device with their appropriate USB cables? I am unsure of how to physically connect the two devices in order to get them to talk to each other.
Will I be able to write out data from the LabJack in Lua, or do I need to translate the entire program to Python or another language? If I can do so in Lua, what are the appropriate functions to use? I have been unable to find anything helpful online so far.
Or, am I going about this backwards? Do I need to install some sort of library onto the Raspberry Pi that will let me pull data collected from the T7?
Any relevant examples would be incredibly beneficial.
Thanks
You can both power and communicate with the T7 over USB connected to you Raspberry Pi 3. The Raspberry Pi 3 provides a USB host with multiple USB ports. Alternatively you can power the T7 over USB or with our provided power supply (you connect the USB cable to it), and communicate through Ethernet. Regarding the USB connection, the USB cable that came with the T7 will connect your T7 directly to one of the Raspberry Pi's USB host ports. Your Raspberry Pi is basically a mini computer to connect your T7 to.
When connecting your T7, check that the STATUS and COMM lights are on. They will blink initially, stay stay lit. When communications are performed the COMM light will blink. If for some reason the Raspberry Pi 3 is having issues powering the T7, make sure you are powering the Raspberry Pi with a power supply with the recommended current of 2.5 A.
As for getting the thermocouple readings, you will need an application on the Raspberry Pi end to get thermocouple readings from the T7. We provide the LJM library and through its API you can communicate with the T7. The library can be downloaded from here (get the Linux ARMv7 build):
https://labjack.com/support/software/installers
The LJM library and its API documentation can be found here:
https://labjack.com/support/software/api/ljm
We provide various language interface/examples here, including Python:
https://labjack.com/support/software/examples/ljm
Regarding your Lua script, you can write your thermocouple readings to one of the USER_RAM#(0:39)_F32 registers, and your Raspberry side application can read from from that register to get the last reading you set. Refer to the T7's datasheet, section 25 (Lua Scripting), and its "Passing data into/out of Lua" documentation:
https://labjack.com/support/datasheets/t-series/lua-scripting
There is a Lua demonstration of writing to the user ram here:
https://labjack.com/support/software/examples/lua-scripting/ram-io
There is no Python specific example, but basically in Python you connect to your T7 and read from the same register the Lua code wrote the thermocouple reading to.
Alternatively you can rewrite your thermocouple code in Python or other language. There is no specific example on that, but the examples demonstrate general write/reads to registers by address or string name, and the registers to get the thermocouple readings are documented here in this T7 datasheet section (thermocouple analog input extended feature):
https://labjack.com/support/datasheets/t-series/ain/extended-features/th...
Great, thank you for your help.