Table of Contents

Bonsai

Bonsai is a visual reactive programming language for building interactive experiments and processing data streams in real time. It supports a growing ecosystem of hardware and software packages that are commonly used in neuroscience. This article will cover how to set up the Behavior board in Bonsai.

Tip

More information on Bonsai can be found in the official documentation.

First Steps

We will use a simple example to connect and test the device in Bonsai. This example visualizes the analog input stream that the Behavior board broadcasts at 1 kHz. We revisit this example in more detail in the "Bonsai Workflows" section.

Before beginning:

  • Connect the USB cable to the computer.
  • Launch "Bonsai" from the Windows Start menu.
  • Hover over the workflow cell below, and click on the "Copy" icon on the top right.
  • Paste the workflow into Bonsai.

Behavior First Steps

Tip

The Harp device pattern will initialize the device, log data, and provide hooks to send commands as well as receive messages from the Behavior board using the Harp communication protocol. If your workflow does not look like the one above, make sure that the Harp.Behavior package is installed.

  • Click on the Behavior (Device) operator and set the PortName property to the communications port for the device (e.g. COM8).
  • Click on the BehaviorDataWriter (DeviceDataWriter) operator and set the Path property for the name and location of the save file (e.g. Data\Behavior.harp).
  • Press the "Start" button in Bonsai to run the workflow.

A visualizer will automatically open when the workflow starts, displaying the parsed AnalogData events streaming from the device:

AnalogInput0: 12
Encoder: 0
AnalogInput1: 8

The device is ready to use! If, instead, an error appears in Bonsai, check out the troubleshooting section.

Next, we suggest going through the "Bonsai Workflows" section if you are not familiar with using Harp devices in Bonsai.

Alternatively, if you have experience with Harp devices, you can check the register table in the reference to access the device functionality directly.



Last updated with:
Hardware v2.1
Firmware v3.3
Bonsai Package v0.2