How to Develop an Application connected with BLE 5 Devices on Dusun’s Gateways

2023-11-29 Dusun Blogs

As the Dusun Gateway is running based on the Linux system, how to implement an application over the Bluez stack to ‘talk’ with BLE 5 devices on Dusun BLE gateways 1 will be presented here.


The Linux OpenWrt system is used by Dusun’s gateways. Figure 1 shows how Linux can run the Bluez stack and support the Bluetooth Low Energy protocol. The fundamental Bluetooth protocols and levels are supported by BlueZ. It employs a modular design and is versatile and effective. All essential Bluetooth layers and protocols are now supported by the BlueZ stack. Users can write BLE applications using Bluez APIs to manipulate BLE 5 devices.


Figure 1. Dusun Gateway system architecture

System Configuration

The Dusun gateways are configured through a web service which means the gateways should be connected with a computer first. The Dusun gateway can be connected through wired connection and a WIFI connection.


Gateway connection

Wired connection
The two RJ45 ports gateway includes a WLAN port and LAN ports. The wired connection of this type of gateway is shown below figure 2-A. Users can use the gateway default LAN IP address: 192.168.66.1 to connect it.


Figure 2-A Direct connection


After the above physical connection is completed, please open a web browser on PC, Input Gateway IP Address;Enter the username and Password(default Username: root Password: root),login to the gateway.


Figure 2-B Connection via a router


After the above physical connection is completed, please open a web browser on your PC, Input the Gateway IP Address, Enter the username and Password(default Username: root Password: root), login into the gateway.



WIFI connection
The Dusun gateway supports a WIFI connection to login it, but WIFI is not enabled by default. The WIFI should be enabled first if the user wants to use WIFI to connect a gateway. Users should log in to the gateway through the above-wired connection to enable the WIFI module. After the connection is established, please follow the below steps to enable WIFI:

1. Login to the gateway (see above figure);

2. Select Dusun > Wifi Manage.

3. Enable Device Radio0 and configure Wifi Interface Wlan0(Wifi Mode:ap, Wifi SSID: Input your own; WIFI Encryption: PSK2 or others; WIFI key: your password)

4. Click the Save & Apply button, and wait for the changes to be applied.

5. Then we can connect the WIFI (for this case: Dusun123) and connect the gateway through WIFI.


Gateway Configuration

After the connection between the gateway and the computer is established, the gateway can be configured following these steps:

1. Open a web browser on your PC, input the gateway IP address, enter the username and Password (default username: root password: root), login to the gateway;

2. Make system configuration at the system menu, the timezone, password, and others can be revised here.

3. Configure the network at the network sub-menu.

4. Configure other settings according to users’ needs.


When the configuration is completed please reboot the gateway. Then users can log in to the gateway by inputting the following ssh commands in a terminal, and then input their password. IP_addr is the IP address that which user configured above. The default IP is 192.168.66.1. The below figure shows the login scene.


API for BLE5 software development

Dusun BLE gateway implemented the EFR32BG21 BLE5 chip from the silicon lab. In order to simplify the programming procedures, we provide a detailed API document seen from the attached file for all kinds of implementation, some core function is listed below,


A sample program: read data from an oximeter BLE sensor

We have provided a sample application to get the BLE oximeter sensor data. To be more specific, the function of scan, connect, and read data is called in app.c file. The main function in the main. c is shown below.


The current event is received by the variant evt, according to the different events the function appHandleEvents function would call the corresponding command. The function appHandleEvents is the main framework to schedule different functions, the main part of this function in file app. c is listed below,



With different events reported to this function, it would invoke different functions. For example, if the program gets an event with event id gecko_evt_le_gap_scan_response_id, it would call the SCAN_Process_scan_response function and start the scanning process.

For the complete code, you can be in the attached file named BLE5_oximeter.

If you would prefer the code with uploading data to the mqtt broker function, you can view the code BLE5withpaho.


Run the oximeter sensor sample on the gateway

1) Get the Openwork toolchain and copy it to a Linux PC.

Get the cross-compile OpenWrt-Toolchain from Dusun, whose name is openwrt-sdk-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2. Linux-x86_64.tar.bz2. Decompress the downloaded OpenWrt Toolchain to a local folder (E.g.: home/bc/ OpenWrt-SDKCHAOSCALMER).

2) Compiled the attached code files.

Copy the above code file to the Linux PC and decompress it to a folder (E.g.: home/bc/BLE5). Open the ./BLE5 folder, and edit the makefile file to revise the CROSSTOOLDIR to the OpenWrt toolchain directory you created above. This is depicted in Figure 3.


Figure 3 changes the CROSSTOODIR path


Then open a terminal on the Linux PC, and type the following commands:

cd BLE5_oximeter ;

make

Finally, the test bin file which can be run in the gateway has been compiled. (Figure 4).

Figure 4. The test application compilation


Copy the compiled test bin file into the gateway and run it.

There are several ways to do it, one of them is introduced below. Under Linux PC, you can use the SCP command (scp local_file remote_username @remote_ip:remote_folder) to do it. Make sure the gateway is connected to the same router as PC, then run the following commands:

scp test root@192.168.0.115:/root


Then remote login to the gateway using SSH commands or SSH client (windows: putty or SecureCrt) and run the copied bin file. The login password can be revised following the configuration steps in the above sections. Finally, we power up the oximeter device and run the test file, we can see the data the oximeter notified to the program as figure 5 shows. The data can be analyzed according to its manual. Figure 6/7 shows the sensor and gateway for testing respectively.

Figure 5

Figure 6 The oximeter device for testing


Figure 7 The Dusun Gateway for testing

授权代理商:世强先进(深圳)科技股份有限公司
技术资料,数据手册,3D模型库,原理图,PCB封装文件,选型指南来源平台:世强硬创平台www.sekorm.com
现货商城,价格查询,交期查询,订货,现货采购,在线购买,样品申请渠道:世强硬创平台电子商城www.sekorm.com/supply/
概念,方案,设计,选型,BOM优化,FAE技术支持,样品,加工定制,测试,量产供应服务提供:世强硬创平台www.sekorm.com
集成电路,电子元件,电子材料,电气自动化,电机,仪器全品类供应:世强硬创平台www.sekorm.com
  • +1 赞 0
  • 收藏
  • 评论 0

本文由PlusLee转载自Dusun Blogs,原文标题为:How to Develop an Application connected with BLE 5 Devices on Dusun’s Gateways,本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。

相关研发服务和供应服务

评论

   |   

提交评论

全部评论(0

暂无评论

相关推荐

【经验】EFR32BG21系列蓝牙BootLoader生成与烧录的操作流程和注意细节

Silicon Labs公司针对蓝牙应用的开发,经常用到的UART BootLoader或者也叫Gecko bootloader。但并不是默认加入到蓝牙工程中的,芯片上电以后应用代码是无法运行的。所以每一个蓝牙的工程都需要烧录一个Gecko bootloader。本文指导一步一步操作生成一份EFR32BG21系列芯片的bootloader工程代码。

2020-02-03 -  设计经验 代理服务 技术支持 批量订货

【经验】Simplicity Studio v5软件创建ZigBee Z3Gateway Host工程的方法

本文主要介绍如何使用Simplicity Studio v5软件创建ZigBee Z3Gateway Host工程的方法,以Silicon Labs的无线SoC芯片EFR32MG21为例。

2022-06-11 -  设计经验 代理服务 技术支持 批量订货

How to Reduce Gateway Energy Consumption in the Smart Home with Low-Power Mesh Technology

This blog describes Silicon Labs’ new patent-pending Low-power Mesh Technology, which can significantly reduce energy consumption on any manufacturer’s CPE while improving the smart home user experience.

2024-10-29 -  设计经验 代理服务 技术支持 批量订货

Silicon Labs EFR32BG21 蓝牙SoC RCP模式测试-扫描设备

本文介绍测试EFR32BG21 蓝牙RCP模式工作在主模式,用于扫描蓝牙从设备,建立蓝牙连接和收发数据。首先需要准备一台电脑并且已经安装好了linux系统。也可以是windows系统下安装的linux虚拟机。并且已经安装好了蓝牙BlueZ协议栈。

2024-03-01 -  设计经验 代理服务 技术支持 批量订货

【经验】如何使用树莓派开发 ZigBee 网关?

在 Zigbee 系统中,网关是一个非常重要的设备,为了能容纳更大的网络及更复杂的应用逻辑,一个强大的主机是不可或缺的,树莓派就是这样一个强大的开发平台,非常适合用来构建 host application,这个文章将描述如何设置树莓派来开发 Silicon Lbas EmberZNet ZigBee Gateway。

2018-10-12 -  设计经验 代理服务 技术支持 批量订货

Z/IP网关拒绝服务漏洞安全公告

描述- 本安全通告针对Silicon Labs的Z/IP网关产品存在的高危拒绝服务漏洞。该漏洞可能导致设备服务暂时中断和网络连接问题。具体包括CVE-2024-3051和CVE-2024-3052两个编号的安全漏洞,分别对应不同的攻击方式。目前,已发布补丁版本以缓解这些问题,用户应升级至相应版本以修复漏洞。同时,建议咨询Z-Wave联盟确认重新认证的要求。

型号- CVE-2024-3051,CVE-2024-3052

2024-APR-25  - SILICON LABS  - 开发环境(软件/固件)  - Rev 1.0 代理服务 技术支持 批量订货

【经验】如何创建 Z3GatewayHost 网关?

EFR32MG多协议SoC芯片是 Silicon Labs 专门针对 IOT 推出的 ZigBee 方案,高达19.5dbm的发射功率,-102.7dbm的接收灵敏度,在业界内拥有最佳的RF射频性能,具有最全的Zigbee网络协议,被广泛应用在智能家居,工业控制等行业。在开发 Zigbee 产品时网关是重要的一个部分,本文详细介绍了创建一个 GatewayHost 的方法。

2019-01-01 -  设计经验 代理服务 技术支持 批量订货

【经验】蓝牙MESH网关程序中的Vendor Model的OpCode的设置

在使用FR32BG21开发蓝牙MESH网关的程序时,我们有时需要使用Vendor Model功能,这时我们需要定义OpCode,在程序中我们可以查到默认定义了两个Opcode:0X00,0X01,这个定义与SIG标准有些冲突,这是什么原因?我们要如何定义OpCode?

2022-03-26 -  设计经验 代理服务 技术支持 批量订货

东胜无线4G IoT Gateway如何连接到AT&T LTE-M网络?

AT&T在美国完成对其4G LTE蜂窝站点的升级后,正式启用了其CatM1和窄带物联网(NB-IoT)网络。东胜物联公司开发了一款4G LTE物联网网关,支持AT&T LTE-M移动网络连接云。本文将讨论什么是LTE-M / NB-IoT以及如何在东胜物联网网关上使用AT&T LTE-M服务。

2024-09-01 -  设计经验 代理服务 技术支持 批量订货

【经验】EFR32BG21蓝牙绑定的操作流程

我们在使用EFR32BG21做产品时,有时会遇到需要配对、绑定的一些操作,做这些操作时要调用哪些API函数去实现呢?本文就用Silicon Labs的两块蓝牙SOC EFR32BG21的开发板测试一下这个功能。

2021-12-29 -  设计经验 代理服务 技术支持 批量订货

Silicon Labs EFR32BG21 蓝牙SoC RCP模式测试-广播设备

本文介绍测试EFR32BG21 蓝牙RCP模式工作在从模式,BG21 RCP会发出蓝牙广播,被手机的蓝牙扫描,连接。首先需要准备一台电脑并且已经安装好了linux系统。也可以是windows系统下安装的linux虚拟机。并且已经安装好了蓝牙BlueZ协议栈。

2024-02-29 -  设计经验 代理服务 技术支持 批量订货
2024/7/17  - SILICON LABS  - 应用笔记或设计指南  - Rev. 0.2 代理服务 技术支持 批量订货 查看更多版本

Dusun IoT’s DSGW-210-HA Home Assistant IoT Gateway Operating System Upgrade to Debian 12

Dusun IoT’s DSGW-210 Home Assistant Zigbee Z-Wave Gateway now fully supports the Debian 12 operating system, enhances developer’s Linux IoT experience with fixed bugs and feature improvements, providing a robust IoT gateway platform and a smoother operation to leverage the capabilities that Home Assistant brings to your service.

2023-12-12 -  产品 代理服务 技术支持 批量订货

【经验】如何在Gateway Soc (internal flash)中实现 Ota Server?

EFR32MG多协议SoC芯片是Silicon Labs专门针对 IOT 推出的ZigBee方案,高达19.5dbm的发射功率,-102.7dbm的接收灵敏度,在业界内拥有最佳的RF射频性能,具有最全的Zigbee网络协议,被广泛应用在智能家居,工业控制等行业。本文介绍在开发 Zigbee Gateway 时如何在Gateway Soc (internal flash)中实现 Ota Server

2019-01-03 -  设计经验 代理服务 技术支持 批量订货
May, 2024  - SILICON LABS  - 产品勘误说明  - Rev. 1.0 代理服务 技术支持 批量订货 查看更多版本
展开更多

电子商城

查看更多

品牌:SILICON LABS

品类:Wireless Gecko SoC

价格:¥15.1445

现货: 13,739

品牌:SILICON LABS

品类:开发工具

价格:

现货: 0

品牌:SILICON LABS

品类:Z-WAVE® MODEM SOC

价格:¥43.3896

现货: 0

品牌:SILICON LABS

品类:Z-WAVE® MODEM SOC

价格:¥43.3896

现货: 0

品牌:SILICON LABS

品类:Demo Board

价格:

现货: 0

品牌:SILICON LABS

品类:8位MCU

价格:¥43.8537

现货: 0

品牌:SILICON LABS

品类:开发工具

价格:¥151.7235

现货: 0

品牌:MELEXIS

品类:LIN-to-LIN Gateway/LIN RGB Controller

价格:¥26.1114

现货: 62

品牌:WAGO

品类:WLAN以太网网关

价格:¥7,899.1520

现货: 6

品牌:MELEXIS

品类:Evaluation PCB

价格:¥1,306.5060

现货: 1

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

现货市场

查看更多

品牌:MICREL

品类:集成电路

价格:¥69.7276

现货:28

品牌:MICREL

品类:集成电路

价格:¥322.3548

现货:11

品牌:SILICON LABS

品类:Switch Hall Effect Magnetic Position Sensor

价格:¥2.2924

现货:126,000

品牌:SILICON LABS

品类:Light Sensor

价格:¥20.3400

现货:28,003

品牌:SILICON LABS

品类:8位MCU

价格:¥4.9000

现货:12,000

品牌:SILICON LABS

品类:Mixed-Signal MCU

价格:¥10.1700

现货:10,000

品牌:SILICON LABS

品类:8 BIT MCU

价格:¥3.7900

现货:3,451

品牌:SILICON LABS

品类:Wireless SoC

价格:¥15.1400

现货:1,455

品牌:SILICON LABS

品类:Mixed-Signal MCU

价格:¥11.1200

现货:1,201

品牌:SILICON LABS

品类:8 BIT MCU

价格:¥16.8500

现货:550

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

品牌:

品类:

价格:

现货:

服务

查看更多

IoT射频性能测试

支持 3Hz ~ 26.5GHz射频信号中心频率测试;9kHz ~ 3GHz频率范围内Wi-SUN、lora、zigbee、ble和Sub-G 灵敏度测量与测试,天线阻抗测量与匹配电路调试服务。支持到场/视频直播测试,资深专家全程指导。

实验室地址: 深圳/苏州 提交需求>

SMT贴片加工/DIP插件加工

可贴片PCB尺寸50*50mm-580*610mm;PCB厚度0.3-8mm;贴装精度CHIP元件+0.03,BGA Pitch 大于0.25mm;元件尺寸0201-74*74BGA;元件高度:30mm。

最小起订量: 1 提交需求>

查看更多

授权代理品牌:接插件及结构件

查看更多

授权代理品牌:部件、组件及配件

查看更多

授权代理品牌:电源及模块

查看更多

授权代理品牌:电子材料

查看更多

授权代理品牌:仪器仪表及测试配组件

查看更多

授权代理品牌:电工工具及材料

查看更多

授权代理品牌:机械电子元件

查看更多

授权代理品牌:加工与定制

世强和原厂的技术专家将在一个工作日内解答,帮助您快速完成研发及采购。
我要提问

954668/400-830-1766(工作日 9:00-18:00)

service@sekorm.com

研发客服
商务客服
服务热线

联系我们

954668/400-830-1766(工作日 9:00-18:00)

service@sekorm.com

投诉与建议

E-mail:claim@sekorm.com

商务合作

E-mail:contact@sekorm.com

收藏
收藏当前页面