ESP32 Ble Mesh internet gateway

Anoopiot
Posts: 10
Joined: Thu Nov 23, 2023 12:51 pm

ESP32 Ble Mesh internet gateway

Postby Anoopiot » Mon Feb 19, 2024 12:00 pm

Hi Folks, did anyone have worked on ble mesh gateway? that can connect with aws iot core and publish data to cloud if anynode turns on or turns off. I also want to control ble mesh remotely. if anyone have done this task before then please help me out. I am able to create mesh and also able to send data from one node to aws iot core but problem is comming that I want to send data of all node from the node I have connected with aws iot core. I am only able to send and receive data on one node only which is connnected to internet.

thanks in advance.

https://github.com/espressif/esp-idf/tr ... off_server
I have used above link code for ble mesh to control devices.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Ble Mesh internet gateway

Postby chegewara » Mon Feb 26, 2024 10:30 pm

Hi,
first off all thank you for this post. After reading it i decided to play with ble mesh again and i am making C++ library for bluedroid. I have good results for now, including generic onf/off and generic level models.

I found some video from nordic where guy is saying that making a gateway is not easy, but i believe here is good starting point (at least to send commands from web to nodes):

https://github.com/espressif/esp-idf/bl ... _cmd.c#L32

Of cource gateway has to be provisioned in the same ble mesh.

Good luck

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Ble Mesh internet gateway

Postby chegewara » Wed Feb 28, 2024 1:26 pm

Im not saying i am doing it properly, but i can say i have one way ble mesh gateway.
It means i can pass messages from internet to ble mesh and control devices.

I dont know if its possible (probably it is) and how to make it works both ways, yet.
Another question is if its possible with espressif ble mesh stack.


If you want to try to make one way gateway yourself here is the hint:
- grab any client example from esp-idf (on-off client, level client etc)
- add wifi connection and mqtt (easy to start with)
- pass data from mqtt to this structs https://github.com/espressif/esp-idf/bl ... #L178-L191

Anoopiot
Posts: 10
Joined: Thu Nov 23, 2023 12:51 pm

Re: ESP32 Ble Mesh internet gateway

Postby Anoopiot » Thu Feb 29, 2024 6:53 am

Hi @chegewara, Thanks for replying. I will try the way you suggested, hopefully it should work. I need bi-directional communication, like if any node in mesh sets (on or off mode) then it should be able to update on cloud through mqtt. is this possible to get all node status data to a node and that node can send data to cloud through mqtt?

polinkuer12
Posts: 1
Joined: Thu Feb 29, 2024 12:39 pm

Re: ESP32 Ble Mesh internet gateway

Postby polinkuer12 » Thu Feb 29, 2024 12:43 pm

https://github.com/espressif/esp-idf/tr ... off_server
This link code you shared really helped me a lot. Thank you for your active assistance
Last edited by polinkuer12 on Tue Mar 05, 2024 1:42 pm, edited 1 time in total.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Ble Mesh internet gateway

Postby chegewara » Thu Feb 29, 2024 8:58 pm

Hi,
it was few very intense days playing with ble mesh (16+ hours a day) and i just scratched tip of it, but i can say it is possible to make two ways ble mesh gateway.
Its not easy, because it requires very good understanding of ble mesh, espressif stack and design. I had to do a very small change in espressif mesh stack to achieve it.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Ble Mesh internet gateway

Postby chegewara » Sun Mar 03, 2024 4:34 am

Its not advertising, i just want to show there is plenty cheap gateways on the market.
Here is multi protocol gateway, with zegbee, ble mesh, wifi tuya etc
https://blow.pl/produkty/inteligentna-b ... 0--d-3636/


In my case, aside of writing app that can route data between mqtt and ble mesh provisioner, this is the only part of espressif code i had to change:
https://github.com/espressif/esp-idf/bl ... ess.c#L705

Here i have to "intercept" data and pass to my app.
There maybe is better way to do it, but for now i find it useful and efficient.

Anoopiot
Posts: 10
Joined: Thu Nov 23, 2023 12:51 pm

Re: ESP32 Ble Mesh internet gateway

Postby Anoopiot » Mon Mar 04, 2024 4:54 am

chegewara wrote:
Sun Mar 03, 2024 4:34 am
Its not advertising, i just want to show there is plenty cheap gateways on the market.
Here is multi protocol gateway, with zegbee, ble mesh, wifi tuya etc
https://blow.pl/produkty/inteligentna-b ... 0--d-3636/


In my case, aside of writing app that can route data between mqtt and ble mesh provisioner, this is the only part of espressif code i had to change:
https://github.com/espressif/esp-idf/bl ... ess.c#L705

Here i have to "intercept" data and pass to my app.
There maybe is better way to do it, but for now i find it useful and efficient.
Thanks Chegewara, did you ever tested this gateway that you have shared? it working properly or not?
I think this is the better way if it works and become successful to pass data to the app.

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Ble Mesh internet gateway

Postby chegewara » Mon Mar 04, 2024 11:43 am

Its hard to say i tested it.
I am trying to make C++ ble mesh library, which allows to quick and easy build any device solution. In meantime i am also trying to make ble mesh gateway, which may be useful as a product for my company.
Its just beginning of the project, but I already have working (sort of) provisioner, which allows me to find unprovisioned devices, then display them on web UI. From web UI i can start provisioning procedure. Then i can read composition data, assign app keys and bind app keys.
My PoC project can communicate over mqtt or ws so far. As i am building it alone and trying to make web UI interface and whole esp32 library, it takes time, but i can say it possible to do it.

Anoopiot
Posts: 10
Joined: Thu Nov 23, 2023 12:51 pm

Re: ESP32 Ble Mesh internet gateway

Postby Anoopiot » Tue Mar 05, 2024 12:48 pm

chegewara wrote:
Mon Mar 04, 2024 11:43 am
Its hard to say i tested it.
I am trying to make C++ ble mesh library, which allows to quick and easy build any device solution. In meantime i am also trying to make ble mesh gateway, which may be useful as a product for my company.
Its just beginning of the project, but I already have working (sort of) provisioner, which allows me to find unprovisioned devices, then display them on web UI. From web UI i can start provisioning procedure. Then i can read composition data, assign app keys and bind app keys.
My PoC project can communicate over mqtt or ws so far. As i am building it alone and trying to make web UI interface and whole esp32 library, it takes time, but i can say it possible to do it.
Great work chegewara. is the provisoner able to read state of nodes? if it is able to read then its fine. it can be used as gateway.

Who is online

Users browsing this forum: No registered users and 214 guests