Bluetooth Splitter

User guide

[under construction]

Introduction

Bluetooth Splitter app can connect to multiple Bluetooth devices and act like a communication splitter / multiplexer. Communication received from one device (primary device) is re-transferred / splitted to multiple devices (secondary devices). Also communication from secondary devices is combined to a single data output to a primary device. App can act as an splitter and multiplexer at the same time.

Main features:

  • Splitting and multiplexing of incoming data from connected devices

  • Communication filtering (both ways or one direction transferring)

  • Ability to open Bluetooth serial port (SPP) - app allows incoming connections

  • Simple intuitive user interface

Bluetooth Splitter app supports connection to following types of devices:

  • Classic Bluetooth device ( SPP - serial port profile) - multiple devices can be connected at the same time

  • Bluetooth 4.0 (Bluetooth Low Energy, Bluetooth Smart) - BLE device can be connected only as a primary device

Audio devices, Bluetooth speakers are not supported

Smartphone requirements

  • Android 4.1 and up, for connecting to BLE device Android 4.3 is required (Apple devices are currently not supported)

  • Bluetooth adapter

Permissions

For application to function properly, it needs following permissions:

Location

  • approximate location (network-based)

  • precise location (GPS and network-based)

Reason for this permissions from Google developer guide: LE Beacons are often associated with location. In order to use BluetoothLeScanner, you must request the user's permission by declaring either the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in your app's manifest file. Without these permissions, scans won't return any results.

Other

  • access Bluetooth settings

  • prevent device from sleeping

  • pair with Bluetooth devices

How it works

Bluetooth Splitter app can connect to remote Bluetooth device(s) and split and (or) multiplex incoming data to (from) other Bluetooth device(s). One device is connected as a primary device, multiple devices are connected as secondary devices. Data received from primary device are then send to all secondary devices and data received from all secondary devices are multiplexed to one data stream to primary device.

Primary device:

  • Classic Bluetooth device OR BLE device (Bluetooth 4.0)

Secondary devices:

  • Multiple Classic Bluetooth devices

For app to work, at leas 2 connected devices are required - primary and one secondary device. If only 2 connections are active, splitter will basically only retransmitt data between them. Splitting / multiplexing will be active with at least 1 primary and 2 secondary connections.

Main screen of the app

Examples of use cases

Typical use cases:

  • We have a processor board with sensors and Bluetooth module. This device sends measured values (e.g. temperature and humidity) but we have 3 other devices to which we want to send the data. Solution is to use Bluetooth splitter, connect processor board as a primary device and other 3 devices as secondary devices. Splitter app will distribute received values to all three secondary devices.

  • We have Bluetooth terminal app (running on a PC or smartphone), which we want to use for communication with multiple devices, but this application can only connect to one device. We connect this application to Bluetooth splitter app as a primary device and we connect multiple devices as secondary.

  • We have 2 devices between which we want to establish communication link, unfortunately these devices are not compatible since one is BLE device and one is classic Bluetooth device. We can use Bluetooth splitter app as a mediator between these two devices, since Bluetooth splitter app can connect to both types of connections and mediate the communication.

  • Other example of use might be the situation when we simply need 2 Bluetooth devices to communicate, but they are barely out of range. We can use smartphone with Bluetooth Splitter as simple range extender in between these two devices.

Connecting process

Connection process for each type of device is described in the following sections.

Connecting to Classic Bluetooth device

To connect to a classic Bluetooth device as a:

  • primary device: click "Connect/Listen" button on primary connection panel and select classic Bluetooth device.

  • secondary side: click "Connect to a secondary device"

Rest of the connection process is the same for each side (primary and secondary).

App can also open port and listen for incoming Bluetooth connections. To enable listening for remote connections as a:

  • primary device: long click on "Connect/Listen "button.

  • secondary device: long click on "Connect to a secondary device"

When listening port is active, Bluetooth serial port is opened which allows incoming connections. You can initialise connection from a remote device.

Click to connect a primary device

Click to connect a secondary device

Make sure remote Bluetooth device is paired with your phone, is turned on and is listening for incoming connections. Then select it from the list of all paired devices and the connection should be established. After successful connection of classic Bluetooth device as a

  • primary device, name of the device will be displayed on primary connection panel with status "connected",

  • secondary device, it will be added to the list of connected secondary devices

Connecting to BLE device

BLE device can be connected only as a primary device. Click on "Connect/Listen" button in a primary connection panel and select BLE Device.

  • Make sure your BLE device is turned on and within range

  • Scanning for BLE devices will start and all found devices will be added to the list (name and device MAC address)

  • Click on the device which you want to connect to (scanning is then automatically stopped)

  • In this example, we want to connect to BLE device MLT-BT05. It was successfully found by a scanner, so we just click on it.

After successful connection, all services and characteristics are retrieved from the connected device (see following image). Beside this, device name, MAC address and number of services available is displayed. For communication with BLE device 2 options are available:

  • Single characteristic can be used for data sending and receiving (one RX+TX characteristic).

  • Individual characteristics for data sending and for data receiving can be specified.

List of retrieved services and characteristics

Using single RX + TX characteristic

Use this option for a devices which use single (the same) characteristic for data sending and receiving.

To use single characteristic for sending and receiving data, check the "Use single RX+TX characteristic" checkbox. To select a characteristic simply scroll down to desired service and its characteristic and click on it. App will try to add notification listener for this characteristic.

Note: Not all services and characteristics support notifications. For more information about which characteristic should be used for your device see the specification of your device.

If the characteristic that you selected does not support notification (listening for incoming data cannot be executed on that characteristic) app will show an error message. Try to select another characteristics. After you select correct characteristic (listening for incoming data will be initialised successfully) app will switch back to main page with a message "Service and characteristic set". Incoming data from the device will from now be shown in the log.

However you still might encounter following error when you try to send data to your device: "Sending data to BLE device failed". This means that the characteristic you specified cannot be used for sending data to that device. This most likely means that your device requires separate characteristic for sending and for receiving (see next section).

  • In this example we know, our device uses singe characteristic for sending and receiving, so we left "Use single RX+TX characteristic" checkbox checked. Our BLE device uses service 0000ffe0-0000-1000-8000-00805f9b34fb and characteristic 0000ffe1-0000-1000-8000-00805f9b34fb for both sending and receiving, so we click on the respective characteristic.

  • You can change icon of the BLE device by clicking on icon image. This icon will be used to identify BLE device in the main screen (it can be also changed later)

To use singe RX+TX characteristic let the checkbox checked (top) and click on characteristic item (bottom)

Using separate RX and TX characteristic

Use this option for a devices which requires different characteristics for data sending and receiving.

To specify separate characteristics for sending and receiving data, uncheck the "Use single RX+TX characteristic" checkbox. New panel with empty text boxes will show up. To specify RX and TX characteristics individually, click on the characteristic from the list and specify RX or TX attribute.

  • RX: app will listen for incoming data for this characteristic (app will add notification listener for this characteristic)

  • TX: app will use this characteristic to send data to remote BLE device

Note: For more information about which characteristic should be used for data sending and receiving for your device see the specification of your device.

Regarding the RX characteristic, situation is the same as in previous section: if the RX characteristic that you selected does not support notification (listening for incoming data cannot be executed on that characteristic) app will show an error message. Try to select another RX characteristics. After you select correct RX characteristic (listening for incoming data will be initialised successfully) app will switch back to main page with a message "Service and characteristic set". Incoming data from the device will from now be shown in the log.

Regarding the TX characteristic: app will allow you to select any characteristic as TX, but this does not mean that your BLE device listens on this characteristics or that this characteristics supports notification on the side of remote BLE device. If you see an error "Sending data to BLE device failed" while sending data to your device, it means your device does allow notification on this characteristic. If you see no error, but your BLE device does not receive any data, it most likely means, that your device listens on other characteristic.

  • In this example we know, our device uses separate characteristics for sending and receiving, so we uncheck "Use single RX+TX characteristic" checkbox. We know that our device uses characteristic 0000ffe1-0000-1000-8000-00805f9b34fb for data sending, which is RX (receiving) on the app side, so we click on this characteristic and select attribute RX (see following screenshot).

  • For listening our device uses characteristic 0000ffe2-0000-1000-8000-00805f9b34fb, which is TX (transmitting) on the app side, so we click on this characteristic and select TX.

  • When both characteristics has been selected, click "OK".

To use separate RX+TX characteristic uncheck the checkbox (top), click on characteristic item and select attribute RX or TX

After successful setting of Rx+Tx characteristic (single or separate), BLE device name will be displayed on primary connection panel and status will be set to "Connected"

  • In our example device MLT-BT05 has been connected and added to the connection panel.

BLE device MLT-BT05 connected

Retransmission

When primary connection and at least one secondary connection is established, app starts to retransmit data between connected devices. This is indicated by a status "Active".

When primary and multiple secondary devices are connected and Retransmission is set to "Both ways", app acts as an splitter / multiplexer device. All received data from primary device are automatically send to all connected secondary devices and vice versa.

If needed, this behaviour can be changed to multiplexer or splitter only. If you want to send only data from primary device to all secondary devices and ignore incoming data from secondary devices, select "Primary->Secondary" from drop-down menu Retransmission. This is splitter mode.

If you want to send data only from all secondary devices to primary device and ignore incoming data from primary device, select "Secondary->Primary". With this setting app is in a multiplexer mode.

If needed, retransmission can also be (temporarily) disabled by selecting option "disabled".

Splitter (this device) shows the name of the smartphone with its MAC address.

Note: On some devices MAC address might not be accessible.

Retransmission code runs as a service, therefore it remains active even if the app is minimised, or when the screen is off. However if you want to use this app mostly in a background it is recommended to add it to the list of protected devices (usually under battery settings) so Android system wont end the process spontaneously.

Managing connected devices

Secondary devices are ordered in list. If you click on a specific secondary device in this list, you can change its icon. To disconnect a device, click "Remove". Device will be disconnected and removed from the list. All other devices in the list (before and after) stays connected.

To disconnect a primary device simply click on "Disconnect" button.

All connected devices can be disconnected at once in settings -> Reset all connections.

If you want to select different characteristic for connected BLE device, you need to disconnect it, connect again and specify new characteristic(s).

Click on a secondary device to show additional options

List of secondary devices with customised icons

Settings

To access the app settings click on the 3 lines symbol in the top right corner in the main screen.

  • In Screen setting you can set if you want your phone screen to stay always on (with full brightness or dimmed) or if you want it to be turned off (turn off timeout for screen can be changed in Android settings, usually under Display/Sleep options)

  • Reset all connections disconnects all remote devices

  • How it works - shot instructions, with a link to full user guide.

  • About section contains additional information about Bluetooth Splitter app

To exit settings, click on the back button. All changes are saved automatically.