Bluetooth mesh for Raspberry Pi - bluetooth

Problem
I am currently working on a Bluetooth communication library for Raspberry Pi. It only has to support simple messaging. The main requirement is that is it decentralized
I therefore thought that Bluetooth mesh would be the best solution. I followed this guide for installing the Linux meshctl tool, but I could not find the functionality for sending messages between multiple Raspberry Pi. It seems that the meshctl tool is only for provisioning and configuring Bluetooth mesh networks.
Is this correct? Please correct me if I am wrong, I would love to be wrong.
Solution?
Is Zephyr a viable alternative? It seems that it is currently ahead of Linux when it comes to Bluetooth mesh.
TLDR: Is the meshctl tool for Linux only for provisioning and configuration? Should i use Zephyr instead?

TLDR: Yes, Meshctl is for provisioning only. Better to use Zephyr for regular mesh nodes instead.
Bluetooth Mesh nodes are usually embedded devices and Zephyr is really good alternative for regular node. It is backed by Linux foundation and feature rich implementation. It is also under active development. There are also couple of other open source mesh implementations: Mynewt-nimble and ESP32 but both of them are actually based on Zephyr's mesh stack.
As provisioner you could use meshctl by Bluez or provisioner app on phone (nRF Mesh or Bluetooth Mesh by Silicon Labs).

Zephyr is an excellent choice. The Bluetooth SIG have an educational resource for developers wishing to learn about Bluetooth mesh (includes hands-on project work) and it uses Zephyr. See https://www.bluetooth.com/bluetooth-resources/bluetooth-mesh-developer-study-guide/

You can use the ST BLE Mesh app from STMicroelectronics : https://play.google.com/store/apps/details?id=com.st.bluenrgmesh&hl=en_IN
They have also Mesh fw and Apps SDK which includes (Android library for Mesh and iOS SDK for Mesh).
It not only acts as a provisioner but you can also share the mesh network configuration via email or cloud to another Smartphone.Apart from this they have command set for Many mesh models - GenericOnOff,GenericLevel,Sensor Model, Lighting Model , HSL model and CTL model.
You can drop support questions at : https://community.st.com/s/topic/0TO0X000000BSrIWAW/ble-mesh

Related

Raspberry Pi Camera Module undetectable by common applications

I bought a 5 mp camera module available at Amazon for my raspberry pi 4 2 gb model. Then I configured it for use and tested it with raspistill and raspivid, it is working as expected. But since it is a module connected to the CSI port and not a USB camera its is not detectable by some common applications. For eg.:- OBS(From Pi-Apps), Zoom(From PI-Apps, Pi-Kiss and its web portal).
What I tried ? --
Virtual camera through OBS. I was able to install OBS but I wasn't able to compile
its plugin for virtual camera and camera module. It had numerous errors.
IP camera adapter :- Idea was to stream the camera feed on local web and then convert the feed to a virtual camera. Yes, there are many such applications but all are available only for windows/Mac and not for Linux. Even the few, which are available doesn't support Raspberry pi's architecture.
Is there any workaround or a trick for make the module work like a normal camera ?
P.S.:- If you are wondering why the question is on Stackoverflow,then I feel this is a software related question and Stackoverflow is the best for that ;).
Have you tried looking into libcamera?
https://www.arducam.com/docs/cameras-for-raspberry-pi/raspberry-pi-libcamera-guide/
That might not be the best, straight-forward answer you're looking for, but I recently did some work with a PiCam and found libcamera to work wonders. I used it on a fairly low level and didn't try to point it to additional programs, but perhaps you can find something useful in there! Good luck.

Custom Messages in Bluetooth Mesh

I am using Bluetooth Mesh technology for a project. The Bluetooth mesh works on flooding, and the message types are defined in the profile. However, I could not find whether I can include a custom payload in the messages to be delivered across the network. Is it possible to do this in Bluetooth Mesh? If yes, please suggest any resources that explain the functionality.
First of all you should visit the Bluetooth SIG. They own and publish all Bluetooth standards. They also maintain a comprehensive list of all specifications including those dealing with 'mesh':
https://www.bluetooth.com/specifications/specs/
And Nordic also provides extensive documentation with examples for its nRF5 SDK for Mesh:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_sdk%2Fstruct%2Fsdk_mesh_latest.html
Bluetooth Mesh is based on Model interaction. If your application does not fit into available (defined by SIG) models, you can create your own (Vendor) models. In that case you can define opcodes (which should not interfere with opcodes of other messages) and customize transferred data.
More information on how to create you own model, in case you are using Nordic SDKs you can find here: for nRF Connect SDK or for nRF Mesh SDK.

What language/libraries best for BLE connectivity?

Operating system: MacOS
Just for some context on what I am trying to do, I have an Ikea standing desk which has bluetooth. I am able to control the desk with a built in app. I want to create a server running on a raspberry pi that connects to desk and controls it, I then want to create an Alexa skill which will control the desk by calling the server endpoints.
What's the best language/library you would suggest I use? Ideally something that would run on MacOS and Ubuntu.
I don't know anything about BLE yet which is why it is hard for me to find a good answer. If you have resources, books or tutorials that will help me get running with BLE please recommend them.
My use case:
Get desk to go up
Get desk to go down
Get current position of desk
If you want to write one app that works for both MacOS and Ubuntu then as ukBaz said, python and Bleak are your best options. If you want to use the native way of writing BLE apps for each OS, then you can use CoreBluetooth on MacOS and BlueZ on Ubuntu. The advantage of the former is that you can get an application up and running quickly, and the advantage of the latter is that you will find a lot more resources and advanced functionality.
Below are some resources that can help you in your development:-
Theoretical Bluetooth:
Bluetooth Low Energy: A Primer
Getting Started with Bluetooth Low Energy
Ellisys Bluetooth Series
CoreBluetooth
Getting Started with CoreBluetooth
Ultimate Guide to Apple's CoreBluetooth
iOS App Full Example
BlueZ
Configuring Bluetooth devices with bluetoothctl
Ubuntu: Accessing GATT services
Python
Ikea IDÅSEN desk API and CLI
Idasen controller example
Using Python for Bluetooth

Bluetooth mesh simulator

I am working on a project that involves Bluetooth Mesh Network (based on BLE) that was standardized with Bluetooth version 5.0. I am searching for a suitable simulator for at least some of the following solutions.
Mesh message delivery (Flooding)
Ability to simulate an environment (Path loss, multipath fading)
Can someone help me find a simulator as the one explained above?
Probably the best easy and cheap option is the nRF Mesh app for Android/iOS devices. It might not be advanced to do full simulation but you'll find most of what you need to get started and then you can tweak things or expand from there manually.
More information is available here:-
nRF Mesh app features
The ultimate Bluetooth mesh tutorial (Part 5)
A developer's guide for proving mesh interoperability

How exactly does the new Bluetooth Mesh network handle provisioning?

I have read in a couple of places (but nowhere official) that you need to use a smartphone to setup and add devices to a mesh. Is that true? Can you not do it with IR or a NFC? What are my options?
Bluetooth Mesh defines the Provisioner as the device that is able to create a mesh network and add (provision) new nodes into the network.
A Provisioner does not necessarily have to be a smartphone, although that will generally be the case. Provisioning is performed over Bluetooth channels - either over advertising channels (using a new protocol defined by Bluetooth Mesh), or over GATT (to support legacy smartphones that cannot advertise custom AD types).
To provision nodes over the advertising channels (the so-called PB-ADV bearer), the smartphone OS needs to be updated to allow developers to implement the PB-ADV protocol. That is not likely to happen soon enough.
Therefore the best option will be to provision nodes over GATT. The unprovisioned node (e.g., the sensor) will have to include the Mesh Provisioning Service in its GATT Database. The smartphone (as GATT Client) will connect and discover this service, and use its characteristics to exchange Mesh Provisioning PDUs.
You can wait until some companies will develop these smartphone apps, or, if you are in a hurry, you can grab the Mesh specification available on the Bluetooth website and develop a provisioning app yourself. The current smartphones' OS allows you to develop a GATT Provisioner (both on Android and iOS).
In general, a phone/tablet class device is needed for provisioning. IR or NFC can be used for OOB authentication, but the full Bluetooth mesh stack is required to initiate and complete the provisioning process.
A good reference as an introduction to Bluetooth mesh can be downloaded from the bluetooth.com web site Bluetooth mesh Introduction for Developers.
At the moment, the best place to start is the Nordic Mesh SDK that uses the Bluetooth SIG mesh. This has an example (for lighting) where a Bluetooth device itself does the provisioning. There's also a 'Serial' example where, again, a Bluetooth device does the provisioning connected via UART to USB that can be controlled via a desktop/laptop. You could extend the examples so that the provisioning BT device has extra GATT services that open up the provisioning to smartphones.

Resources