Controlling Eight BLE Peripherals with RedBear Duo

INTRO

This demo demonstrates TCP/IP socket connection with RedBear Duo in BLE Central Role while controlling eight BLE peripherals.

SETUP

8nano

RedBear Duo - RedBear Duo will be setup as BLE Central role, and also running a socket server that will accept connection through Port 8888.

BLE Peripherals - We will use six RedBear Nano and two with our new coming product RedBear Lite. Each one will be wired with a Button(to turn on/off), RGB LED and a battery as a standalone BLE Peripheral.

App - The App will be a basic socket client and UI that specially designed for this demo. User can turn on, turn off, and adjust the colour of RGB LED through the socket connection with RedBear Duo.

Protocol - We introduced a simple protocol for communication between App and RedBear Duo. It is in JSON format:

{
"RGB" :
{
"ID" : 1,
"OpCode" : 1,
"R" : 255,
"G" : 50,
"B" : 100
}
}

  • ID - ID # for the BLE peripheral
  • OpCode - Operation - 1 to Set, 2 to Read
  • R, G, B - Color for Red, Green, Blue
USE

First step, we need to make sure all peripherals are connected to RedBear Duo. We simply indicate in purple LED status when all Peripherals are connected to it. When the purple LED light is on, then we can connect our APP to Duo through Wifi.

Just like many other socket client, we connect the APP to RedBear Duo by entering RedBear Duo's IP address. The IP address is assigned by the local area network, so different network may have different IP address. The APP will select port 8888 and connect to RedBear Duo's IP address. Once successfully connected, the APP will switch to controller mode. There will be eight control sets with different device number.

LED Status on Duo

  • Purple - RedBear Duo and all peripherals are connected
  • Green - When receive command from App
  • Yellow - When receive command from BLE peripherals

RedBear Duo at Kickstarter!
kickstarter.banner