ohahaha

【ART-Pi】Bluetooth gateway

 
Overview

Introduction

This is an ART-Pi expansion board for Bluetooth mesh. Since the AP6212 network adapter on the ART-Pi cannot perform Bluetooth mesh operations, this expansion board contains an nrf52832 module that is connected to the main control chip through the serial port protocol to connect to the mesh device. .

The expansion board is equipped with a LAN8720A chip to connect to Ethernet, and you can also use the motherboard's Wi-Fi module for networking.

In addition, I also added the LD3320 speech recognition module and JR6001 voice broadcast module to achieve voice interaction.

The expansion board leads out all pins exactly according to the ART-Pi pin layout, and the unused pins of the expansion board can continue to be used by other external modules.

Regarding Bluetooth mesh, here are some materials I translated during my study: Introduction to Bluetooth mesh

Features

  • The Bluetooth mesh network supports 32,767 mesh devices in the same network, which means that the Bluetooth gateway can theoretically control up to 32,766 devices in nearby mesh networks.
  • Bluetooth mesh devices can communicate with classic low-power Bluetooth devices, which will help increase the usage time of peripheral devices.
  • Voice broadcast and Bluetooth mesh use modular pluggable design for the following reasons:
    • The voice broadcast function is not the core function of the system, but a way of feedback. The development board can use long-pin female headers to lead out all the core board pins. These pins can be used to continue to connect peripherals such as displays, relays, servos, etc. The expansion performance is stronger.
    • Bluetooth mesh is also provided in module mode. The reason is that Bluetooth mesh is a multi-device network. A universal pluggable Bluetooth module can be used as a network agent, an access point for sensors or controllers, or even a master control. This can facilitate reuse, improve the development efficiency of mesh sensors and controllers, and reduce development difficulty.

use

  1. The IoT gateway allows Bluetooth mesh devices to access the Internet and access Bluetooth mesh devices from the external network.
  2. Voice assistant can realize device control and obtain network information through voice interaction.
  3. nrf52832 not only supports Bluetooth mesh, but also supports protocols such as low-power Bluetooth and NAT. You can DIY it as needed.

programming

Program solution architecture: mesh gateway technology solution.jpg Communication sequence diagram: mesh gateway device timing.jpg

Problems encountered during program development:

  • JR6001 affects LD3320 when playing
    • Solution: Use semaphore mutual exclusion
  • Because the development board uses a 12MHz frequency crystal oscillator, you need to modify the corresponding LD3320_CLK_IN macro in the packages to 12. You can also consider replacing the LD3320 crystal oscillator with a 22MHz one.

Demo video

Note: Use nRF Mesh app for mesh configuration.

WEB interface:

Find Mesh nodes:

POST /cgi-bin/board_control HTTP/1.1
Host: 192.168.1.211
cache-control: no-cache
{
    "opcode": 193
}

Get the node list:

GET /cgi-bin/basic_info HTTP/1.1
Host: 192.168.1.211
cache-control: no-cache

Set up node:

POST /cgi-bin/board_control HTTP/1.1
Host: 192.168.1.211
Content-Type: application/json
cache-control: no-cache
{"address": 79, "opcode": 195, "data":"01"}

Read node data:

POST /cgi-bin/board_control HTTP/1.1
Host: 192.168.1.211
Content-Type: application/json
cache-control: no-cache
{"address": 57, "opcode": 195}

Note:

  • address: device unicast address
  • opcode: operation code
  • data: data (1~8byte)

Software source code

room for improvement

  • The Mesh protocol uses 8 bytes of space to transmit data. In the demo of turning on and off the light, only 1 byte is actually used. You can consider changing it to a dynamic length to save memory and improve transmission efficiency while being compatible with multiple devices.
  • The WebApi part uses an asynchronous method to return data. If necessary, you can use tools such as semaphores and message queues to achieve synchronization.

References

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 06:02:05

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号