NeuroStimDuino

An open source neurostimulator for students, researchers, and hobbyists interested in neuroscience

Available for pre-order

View Purchasing Options
Apr 28, 2021

Project update 6 of 11

Controlling Multiple NeuroStimDuinos on a Single I²C Bus

by Nikunj Bhagat

Hey folks! Our campaign ended yesterday, and we exceeded our funding goal by a significant margin. We are deeply grateful to Crowd Supply and to all of our backers for making this campaign a great success. Thank you!!

Communicating with Multiple NeuroStimDuinos on a Single I²C Bus

We will end this week’s update by demonstrating how to control two NeuroStimDuino using a single Arduino. The default I²C address for NeuroStimDuino is 26. Using the ADDR command from the NeuroStimDuino library, you can change this address and communicate with multiple devices on the same I²C bus. The syntax for ADDR command is ADDR new_address program/switch_only, where:

Setup for Changing I²C Address & Connecting Multiple NeuroStimDuinos

  1. Connect the first NeuroStimDuino to an Arduino:
  1. Change its I²C address from 26 (default) to any other value (e.g. 30) using the serial terminal:
    ADDR 30 1
    
  2. Now stack the second NeuroStimDuino on top of the first. Use the default I²C address for the second device or change it using the instructions in Step 2:
  1. You are now ready to independently control both NeuroStimDuinos.

  2. Type in the following command using Arduino’s serial terminal to stimulate two Zucchini muscles (video below):

ADDR 30 1     //Change I2C address of 1st NeuroStimDuino and start communicating with it
FREQ 1 15
FREQ 2 15
DURN 1 2000
DURN 2 2000
AMPL 1 100
AMPL 2 100
DELY 1 5
DELY 2 10
ENAB 1 1
ENAB 2 1
STIM 1 0 1
STIM 2 0 1

ADDR 26 0     // Connect 2nd NeuroStimDuino and start communicating with it. Address will not be changed
FREQ 1 5
FREQ 2 5
DURN 1 2000
DURN 2 2000
AMPL 1 100
AMPL 2 100
DELY 1 5
DELY 2 10
ENAB 1 1
ENAB 2 1
STIM 1 0 1
STIM 2 0 1

// At the end of the experiment stop stimulation on both boards
STOP 1
STOP 2
ADDR 30 0  //Switch communication to 1st device
STOP 1
STOP 2

Sign up to receive future updates for NeuroStimDuino.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects