Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Bluetooth - Ethernet Gateway

Technology badge License badge SDK badge Required board Build badge Flash badge RAM badge

Type badge Type badge Type badge Type badge Type badge Type badge

Overview

This project aims to implement a simple Bluetooth-Ethernet Thin Gateway, the sensor measures and collects data from the device's environment and the gateway requests the results via BLE.

When the device is connected to a sensor peripheral the gateway reads the BLE characteristics to retrieve the measured temperature and humidity. The measurement results are uploaded to dweet.io via the Ethernet Click board.

The block diagram of this application is shown in the image below:

overview

More detailed information can be found in the section How it works.

This code example referred to the following code example. More detailed information can be found here:


Table Of Contents


SDK version


Software Required


Hardware Required


Connections Required

The hardware connection is shown in the image below:

hardware connection

  • The ETH WIZ Click can be plugged into the BGM220 Bluetooth Module Explorer Kit via the mikroBus socket

Setup

To test this application, you can either create a project based on an example project or start with a "Bluetooth - SoC Empty" project based on your hardware.

Note

Based on an example project

  1. From the Launcher Home, add your hardware to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by "ethernet".

  2. Click Create button on Bluetooth - Ethernet Gateway examples. Example project creation dialog pops up -> click Create and Finish and Project should be generated. create_project

  3. Build and flash this example to the board.

Start with a "Bluetooth - SoC Empty" project

  1. Create a Bluetooth - SoC Empty project for your hardware using Simplicity Studio 5.

  2. Copy all attached files in the inc and src folders into the project root folder (overwriting existing).

  3. Open the .slcp file. Select the SOFTWARE COMPONENTS tab and install the software components:

    • [Services] → [IO Stream] → [IO Stream: USART] → default instance name: vcom
    • [Application] → [Utility] → [Log]
    • [Platform] → [Driver] → [SPI] → [SPIDRV] → default instance name: mikroe → Set "SPI master chip select (CS) control scheme" to "spidrvCsControlApplication"
    • [Platform] → [Driver] → [LED] → [Simple LED] → default instance name: led0
    • [Third Party Hardware Drivers] → [Interface] → [W5500 - ETH WIZ Click (Mikroe)]
  4. Build and flash this example to the board.

  5. From the Simplicity Studio 5 launcher, run the Bluetooth - SoC Thunderboard EFR32BG22 (BRD4184A) demo on the Thunderboard EFR32BG22 board

    Thunderboard

  6. Enable floating-point support for printf

    • Right clicking on your project in the [Project Explorer] window and select properties and then select [C/C++ Build] > [Settings], then under [GNU ARM C Linker] > [General], check the [Printf float] checkbox

      Project properties Enable printf floating point

Note

A bootloader needs to be flashed to your board if the project starts from the "Bluetooth - SoC Empty" project, see Bootloader for more information.


How It Works

Application Overview

Application overview

Gateway Implementation

Application initialization

Application init

Sensor connect & upload sensor data to cloud service

Sensor connect

Application Workflows

  1. Initialize the peripherals and the Bluetooth stack.

  2. Initialize the ethernet module.

  3. Initialize the DHCP client on the ethernet module.

  4. Get the gateway IP, subnet mask, and local IP from the DHCP server.

  5. Setting DNS server.

  6. Get the IP of the remote server: dweet.io.

  7. Start scanning for thunderboard sense device filter the result by name: Thunderboard.

  8. Connect to the device with the highest RSSI

    • If the BLE connection is established:
      • Discover environment sensing service and temperature & humidity characteristic.
      • Start a timer with period 3s to check the connection is timed out.
    • If failed to connect to the device then restart the scanning process.
  9. When discovering service and characteristic is finished

    • If the temperature & humidity characteristic are found then start a periodic timer to collect sensor data
    • If no service and characteristic are found within 3s then restart the scanning process.
  10. In periodic timer handler, collect sensor data and send them to the remote server by using HTTP GET request.

LED

  • Indicate the Thunderboard Sense device is connected

Dweet cloud monitoring interfaces


Report Bugs & Get Support

To report bugs in the Application Examples projects, please create a new "Issue" in the "Issues" section of bluetooth_applications repo. Please reference the board, project, and source files associated with the bug, and reference line numbers. If you are proposing a fix, also include information on the proposed fix. Since these examples are provided as-is, there is no guarantee that these examples will be updated to fix these issues.

Questions and comments related to these examples should be made by creating a new "Issue" in the "Issues" section of bluetooth_applications repo.