Skip to main content
Skip table of contents

Standalone Data Logging System with LabJack T4 and Raspberry Pi (App Note)

This is a simple application note explaining how to start logging data from a Labjack T4 onto a Raspberry Pi. We often have customers ask us how to perform simple standalone data logging and while you can do this using the Lua scripting features of the T-Series devices(T8, T7, T4); LabJack devices are the most powerful and deliver the best user experience when connected to a computer. Typically a customer interested in standalone data logging wants to reduce their cost, footprint but maintain reliability. This option does not add much to your costs but will greatly improve your reliability and simplify logging data without the risk of batteries going dead or a remote node losing its connection. To keep things as simple and straightforward as possible, this data logging system will be using Python.

Prior Knowledge

  1. A Raspberry Pi 3 or newer that has Raspbian installed. The Pi Foundation has a guide titled Installing Raspbian with Noobs that is easy to follow.

  2. Basic command line/Linux terminal skills:

    1. Raspberry Pi Linux Commands

    2. Raspberry Pi Terminal

  3. Basic computer skills (connecting keyboard, mouse, turning on Raspberry Pi)

Recommended Hardware

  1. LabJack T4 or LabJack T7

  2. Raspberry Pi 3 or newer

  3. Display for Raspberry Pi

  4. Keyboard and mouse to connect to Raspberry Pi

  5. An analog sensor of your choosing


  1. Measure and record data using a Raspberry Pi and a LabJack device

  2. Create a virtual environment

  3. Install LabJack LJM Driver

  4. Install and Run LJM Python Examples

  5. Read voltage from Analog input

  6. Log readings to separate file

Update Raspberry Pi (suggested but not required)

It is always good to keep your system up to date. Updating your system ensures that you are using the newest version of Raspberry Pi’s software and avoids any compatibility issues when running programs on the Raspberry Pi. Updating can sometimes break things, so only do this if you aren't on a mission critical system.

sudo apt-get update && sudo apt-get upgrade

Create a Virtual Environment (Optional)

It is often beneficial to use a Python virtual environment to keep Python packages you use for a particular application from affecting your system Python packages and vise-versa. A virtual environment can be created using the commands below.  If you are unfamiliar with virtual environments, check out Python Virtual Environment for more information.

python3 -m venv myenv #make a venv source myenv/bin/activate # activate the venv

Install the latest LJM Library

Before installing LJM, we recommend checking which architecture your device uses. Most older Raspberry Pis use the 32-bit ARM architecture (ARMv7) but newer Raspberry Pis also support 64-bit ARM (sometimes called ARMv8 or Aarch64). You can easily check your computer architecture with the following command:

uname -m

This should output something like ARMv7, ARMv8, or Aarch64. From there, navigate to the LJM Downloads page to download and install the appropriate ARM Linux driver. Expand Details toward the right of the installer download link for installation instructions.

Install labjack-ljm Python package

To run LJM using Python, both the LJM library and the labjack-ljm Python package must be installed. We recommend using pip to install labjack-ljm as shown in the following command:

pip install labjack-ljm

For more details and troubleshooting tips, check see our Python for LJM documentation.

Running Examples

With the LJM library installed and a virtual environment created, you should be ready to run some examples. Our newest Python examples can be downloaded from our labjack-ljm-python GitHub repository.

Standalone Data Logging

Your Raspberry Pi is now ready to begin logging data. There are many different ways you could record data however, one of the simplest ways is to write analog input data to a .csv file. This .csv file can then be accessed in the Raspberry Pi’s file directory and/or an external USB flash drive. An example python script for this is provided:

Going Deeper: JEDI One by Machinechat

If you would like to go further than just logging data and want to monitor in real time, JEDI One is a perfect tool that is affordable and easy to run on a Raspberry Pi. JEDI One by Machinechat offers powerful yet lightweight software (less than 30MB) that can be used with LabJack UD and T-Series hardware.  Pairing a Labjack with the JEDI One software from Machinechat, you can create rules, alerts and actions, email and text notifications, beautiful dashboards, and network monitoring, among other things. Best of all, this can all be set up in about 15 minutes.

If you are interested in using JEDI One with your Labjack device, check out Supercharging your LabJack for instructions and more.


  1. Raspberry Pi, 6/6/2022: Installing Raspbian with Noobs

  2. Raspberry Pi, 6/6/2022: Raspbian

  3. Machinechat, 6/6/2022: JEDI One by Machinechat

  4. Machinechat, 6/6/2022: Supercharging your LabJack

  5. GeeksforGeeks, 6/14/2022: Python Virtual Environment

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.