BlueHub

The BlueHub is an Arduino-based control unit designed to enable closed-loop optogenetic stimulation in freely moving mice. At its core is an Arduino UNO Rev4, connected to four BNC input channels for receiving external triggers, an OLED screen for a graphical user interface (GUI), and a rotary encoder for menu navigation. Through the on-board GUI, users can assign each BNC input channel to a specific BlueBerry device and define its stimulation protocol (e.g., frequency, pulse width). Once configured, the BlueHub automatically manages Bluetooth Low Energy (BLE) communication, triggering the assigned optogenetic parameters whenever an input is activated. In addition, the BlueHub features three BlueBerry stations—two dedicated to charging devices post-experiment, and one that supports both charging and uploading the base program onto the BlueBerry devices (refer to the BlueBerry software documentation for further details). Because it uses off-the-shelf components and offers a user-friendly GUI to flexibly map BNC inputs for external digital interfaces, the BlueHub is straightforward to build and easily integrates into existing behavioral frameworks. The following sections describe the hardware assembly process and BlueHub software configuration.

BlueHub controlling unit principles Simplified schematic of BlueHub controlling unit to communicate with multiple BlueBerry devices and adjust optogenetic stimulation protocols

Hardware assembly

This guide walks you through the hardware assembly of the BlueHub device, covering solder paste application, surface-mount and through-hole component placement, and final assembly with the OLED screen and Arduino module. Before you begin, ensure you have access to the following equipment and tools:

  • A reflow oven for soldering surface-mounted components.
  • A basic soldering station for through-hole elements.
  • Standard lab tools such as a microscope for inspection, tweezers, and solder paste.

To build the BlueHub, you will need a custom PCB and various electronic components. The PCB production file can be downloaded from the download page, and we recommend ordering from PCB GoGo, although other manufacturers can also be used. Follow these steps:

  1. Create an account on the PCB manufacturer’s website (e.g., PCB GoGo).
  2. Follow the manufacturer’s specifications for PCB material, thickness, and copper weight (oz) as outlined in the PCB_Order_Guide.png file in the BlueHub Hardware package. Afterwards (when clicked on "calculate" button) you will be redirected to a new page and asked to upload the PCB Gerber file. Upload the BlueHub_Production.zip file to complete your order (as indicated in PCB_UploadProduction.png).
  3. Use the link below to order all required electronic components from recommended suppliers (This order list is for making only one BlueHub device).

Once you have obtained all materials, you can proceed with the assembly process.

Step 1: Prepare and Gather Materials

Before proceeding, make sure you have:

  • One BlueHub PCB.
  • Tweezers.
  • Solder paste.
  • Small petri dish
  • Q-tips

Lay them out as shown in the reference image to streamline the assembly process.

Equipment for assembling a BlueHub unit

Step 2: Solder Paste Application

  1. Place a small amount of solder paste in a petri dish for easy access. Cut a Q-tip in half to create a smooth, sharp edge, which will help in accurately applying solder paste.
  2. Using the modified Q-tip, apply solder paste to all surface-mount (SMD) pads on the BlueHub PCB.
  3. When applying solder paste to very small pads, use a microscope to avoid short circuits by preventing excess paste from bridging adjacent pads.

Step 3: Surface-Mount Component Placement

  1. Refer to the component placement table below to identify where each surface mount component goes. Check the color-coded markings on the PCB, which match the table to simplify component positioning (ICs, resistors, LEDs, etc.).
  2. Using tweezers, carefully place each surface-mount component onto its corresponding solder-pasted pad.
  3. For components such as LEDs and optocouplers, double-check orientation to ensure correct placement before proceeding to reflow soldering.
  4. Once the placement is completed, transfer the PCB to the reflow oven. Bake according to your oven’s reflow profile. Allow it to cool, then verify that all components are correctly soldered.

Step 4: Through-Hole Component Placement

  1. Insert all through-hole components into the PCB according to the component placement table. As with surface-mount components, check the color codes to identify the correct placement of each component type.
  2. After insertion of each component, turn the PCB over and use a standard soldering iron to secure the leads on the opposite side.

Step 5: Connecting the OLED Screen, Arduino, and Elevating the BlueHub PCB

  1. Before attaching the screen, short-circuit two resistors on its back to enable I²C communication, as shown in the reference image.
  2. Attach the OLED screen and Arduino module to the BlueHub PCB via their designated connectors.
  3. Elevate the BlueHub PCB using four 18 mm spacers to lift the BlueHub and secure them using M3 screws. For the OLED screen, use two 11 mm spacers, secured with M2.5 screws to hold it in place.
  4. Once these steps are completed, the BlueHub hardware assembly is finished, and you can proceed with software configuration.
Final assembly step for BlueHub control unit

BlueHub Software

Below is a step-by-step guide for uploading the BlueHub program onto the device. This process will allow you to configure and control optogenetic stimulations in multiple BlueBerry devices. It is important to note that this guide is specifically for programming the BlueHub itself, not for using the BlueHub to program BlueBerry devices. If you are looking for instructions on programming BlueBerry devices via the BlueHub, please refer to the BlueBerry Software section of the documentation.

These instructions cover programming the Arduino UNO Rev4, which serves as the core of the BlueHub. Before you begin, ensure that:

  • You have the Arduino IDE installed and have basic familiarity with its use.
  • You have downloaded the BlueHub Software package for controlling BlueBerry devices.
  • Your PC is connected to the USB-C port of the Arduino UNO Rev4.

Step 1: Installing Boards and Libraries

  1. Open Arduino IDE and navigate to Sketch → Include Library → Manage Libraries. In the search bar, type "U8g2", select U8g2, and install it. This library enables communication with the OLED screen.
  2. Again, in the Library Manager, search for "BLE", select ArduinoBLE, and install it. This library enables Bluetooth Low Energy (BLE) communication for the Arduino UNO Rev4.
  3. Finally, navigate to Tools → Board → Board Manager. In the search bar, type "uno r4", select Arduino UNO R4 Boards, and install it.

Step 2: Uploading the BlueHub Program

  1. Connect your Arduino UNO Rev4 to your PC via USB-C. Ensure that the slide switch below the Arduino is set in the correct direction (slid toward the power cord of the Arduino). This switch should remain in this position both during upload and when using the BlueHub to control BlueBerry devices. The switch is only toggled when programming BlueBerry devices, as detailed in the BlueBerry Software section of the documentation.
  2. Locate the downloaded BlueHub Software package and unzip it into your Arduino code directory (or any preferred location).Ensure that all files, including .ino, source files, and header files, remain in the same folder without renaming it.Open the .ino file in Arduino IDE. This should automatically load the associated header and source files. In Tools → Board, select Arduino UNO R4 and verify that the correct port is chosen. Refer to the reference image below for proper settings. Click Upload to flash the BlueHub program onto the Arduino.
  3. If the upload is successful, the BlueBerry logo will appear on the OLED screen for a few seconds before transitioning to the main menu of the BlueHub program. At this point, your BlueHub is successfully programmed and ready for use in controlling BlueBerry devices.
Uploading BlueHub program for real-time management of multiple BlueBerry devices