Skip to content

Out Of The Box: What Stimulations are available?

Schwarz Lab edited this page Sep 22, 2020 · 2 revisions

This section will explain to you how to use our currently available out-of-the-box Stimulation modules. Note, that the stimulation is a hardware output and will rely on your system. We are happy to help you but this part will be trickier if you don`t have a clear idea of your setup or closed-system-solutions.

Using a NI DAQ Board

As we are mainly using a National Instruments DAQ-board, that is connected to our DLStream computer via USB, we can utilize the board to send digital ON/OFF signals (TTL) to a variety of devices. NI also offers a handy Python library to directly communicate with the board. The function from DAQ_output.py disentangle some of the more tricky parts of the NI library and put them into simple-to-use functions.

Using a Raspberry Pi for remote GPIO control

First, you need to prepare your Raspberry Pi for GPIO remote control: Follow this tutorial!

Afterwards, you can use the DigitalPiDevice module in gpio_control.py to remote control devices that are digitally triggered (TTL HIGH/LOW) through the GPIO pins on your Raspberry Pi.

If you already created a base experiment with design_experiment using the BaseStimulation module, you can alter the config file to automatically use your Raspberry Pi connected via network or USB. The same logic applies to the RewardDispenser.

Using an Arduino board for remote GPIO control

First, you need to prepare your Arduino board for GPIO remote control: Follow this tutorial for an example!

The tutorial above is controlling the internal LED of the board, but the same logic applies to GPIO outputs, just use the correct pins. Note, that the input for triggering the TTL signal through the Arduino board is "H" for HIGH and "L" for LOW. Make sure that your Arduino code matches that input.

Afterwards, you can use the DigitalArduinoDevice module in gpio_control.py to remote control devices that are digitally triggered (TTL HIGH/LOW) through the GPIO pins on your Arduino.

If you already created a base experiment with design_experiment using the BaseStimulation module, you can alter the config file to automatically use your Arduino connected via USB. The same logic applies to the RewardDispenser.

Otherwise, you can use design_experiment to incorporate them into your new experiment.

[BaseStimulation]
; can be NI, RASPBERRY or RASP_NETWORK or ARDUINO
TYPE = RASPBERRY ;(or RASP_NETWORK)
;only used in RASP_NETWORK
IP = None ;(e.g. 10.25.62.192)
;PORT parameter is used for all (Port from DAQ, PIN from Raspberry, or serial port from Arduino)
PORT = 1
...

BaseStimulation

If you have a device connected to such a board and know the port, you can use the BaseStimulation module to turn it ON/OFF in our BaseExperiments. The stimulation time is used to automatically turn the stimulation off in stimulation mode (e.g. a timed reward delivery). In most cases you will not use it. The stimulation mode is defined in the BasePrototoclProcess as either switch, supply or trial. switch and trial use the basic ON/OFF functionality, while supply uses a timed stimulation and is usually paired with the RewardDispenser.

[BaseStimulation]
TYPE = NI
PORT = Dev1/PFI6
STIM_TIME = 3.5

RewardDispenser

The RewardDispenser is a combination of two ports controlled by DLStream. One digital signal will be send to activate the delivery (with a distinct STIM_TIME), while the other is activating its withdrawel (with a distinct REMOVAL_TIME). We utilized a similar module to control our custom build reward delivery system.

[RewardDispenser]
TYPE = NI
STIM_PORT = Dev1/PFI6
REMOVAL_PORT = Dev1/PFI5
STIM_TIME = 3.5
REMOVAL_TIME = 3.5

ScreenStimulation

Another type of stimulus is the ScreenStimulation. It utilizes OpenCV to show a video/image as a stimulus. It does not require any extra control board, but of course a screen that is in the proximity to the animal. We used this stimulation for our conditioning experiment.

TYPE is either image or video. BACKGROUND_PATH is the path to the image/video that is shown during non-stimulation episodes. STIM_PATH is the path to the image/video.

[ScreenStimulation]
TYPE = image
STIM_PATH = PATH_TO_IMAGE
BACKGROUND_PATH = PATH_TO_BACKGROUND

Other types of stimulation

If you are interested in providing code that helps the community, please reach out. We are constantly looking to improve DLStream. A general guide to setting up your own stimulation:

If you can use it with python, it probably works with DLStream.