Vernier Software and Technology
Vernier Software & Technology

Python® and Go Direct® Sensors

Connect Vernier Go Direct sensors to your Python project or create custom data visualizations using our Python library.

Overview

With our godirect module for Python, students can connect to and read measurements from a Go Direct sensor within a Python program. Students can write Python programs to visualize Go Direct sensor data or integrate that data into a larger Python project. The godirect module supports connection to a single Go Direct sensor via USB or Bluetooth® wireless technology.

Requirements

A screenshot of a live free body diagram controlled by a Go Direct Force and Acceleration Sensor
Free body diagram for the ring showing the forces on the ring from the hanging mass (red), Go Direct Force and Acceleration sensor (green), and support string (yellow)

Installation

Use pip (Python package manager) to install the godirect module so that it can work with Go Direct sensors over USB and Bluetooth® wireless technology. Run the following command in your command line terminal:

pip install godirect[USB, BLE]

There is further documentation on the godirect module project page.

Using the godirect Module with Go Direct Sensors

After installing the godirect module, open and run our getting started examples. Under the hood, they all use the the godirect module to communicate with the Go Direct sensors. However, to make getting started easy, we created a layer of functions. That layer is named gdx. You can connect to and collect data from a Go Direct sensor using the commands in the steps below.

  1. Download the gdx examples, which include the gdx functions layer, to your computer.

  2. In each example—and in the programs that you write—import the gdx functions into your program and create a gdx object: from gdx import gdx gdx = gdx.gdx()
  3. Find and connect to a Go Direct sensor, select sensor channels from which to gather data, and start collecting data: gdx.open_usb() or gdx.open_ble() gdx.select_sensors() gdx.start()
  4. Read sensor data, formatted as a list: measurements = gdx.read()
  5. Before ending your program, stop data collection and close the program’s connection to the Go Direct sensor: gdx.stop() gdx.close()

For the getting started examples and other supported commands, see https://vernierst.github.io/godirect-examples/python/

Examples

Go to top