<< Hardware, Touchscreen >> Hardware, Photodiode Tuner ^ Top

# Arduino for Reward

The previous method using Arduino Uno + HC-05 is now deprecated. To upload the custom sketches provided on this page to an Arduino board, you will need the Arduino IDE. The MATLAB Support Package for Arduino Hardware is not necessary.

### 1. Wired Connection (USB)

In this setup, an Arduino board is connected to the NIMH ML computer via a USB cable and sends TTL signals to reward devices through its digital pins.

Steps:

1. Upload the provided sketch (Arduino_via_USB.zip) to your Arduino board.
2. Open the [Other device settings (USB, etc.)] menu and select the COM port assigned to the board under [Arduino for Reward].
3. Connect your reward device(s) to the digital pins D2 to D12 on the Arduino. These pins correspond to JuiceLine 1 to 11 in the goodmonkey function. (Note: Only one digital pin can be triggered at a time.)

### 2. Wireless Connection (BLE)

For a wireless setup, use an Arduino board with Bluetooth Low Energy (BLE), such as the Nano 33 BLE series (Rev1, Rev2, Sense, or Sense Rev2). These boards can be placed away from the NIMH ML computer and receive trigger commands via BLE without a physical connection. The Bluetooth radio on your NIMH ML computer must also support BLE; typically, Bluetooth 4.0 devices include BLE support.

Steps:

1. Upload the provided sketch (Arduino_via_BLE.zip) to your Nano 33 BLE board.
2. In the [Other device settings (USB, etc.)] menu, click the [...] button next to [Arduino for Reward].
3. Click [Search BLE], then select a device from the dropdown menu. If no BLE device appears, increase the timeout duration and try again.
4. The board will automatically connect to NIMH ML when a task starts. A green LED blinks when the board is powered on, then turns solid blue once the connection is established.
5. The digital pins D2 to D12 on the Nano 33 BLE correspond to JuiceLine 1 through 11 of the goodmonkey function. (Note: Only one digital pin can be triggered at a time.)

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.

- Freedom of Information Act
- HHS Vulnerability Disclosure

- National Institute of Mental Health
- National Institutes of Health
- U.S. Department of Health and Human Services
- USA.gov