How can I use mqtt to connect hono to ditto? - arduino

Is it possible to use mqtt to send data from a device (arduino in my case) to hono and then send these data to ditto via mqtt?
in my case I have arduino that send a value via mqtt to hono, but now i need the data to be received by ditto.
For the moment i have only arduino that sends data to hono via mqtt.

Eclipse Ditto can either consume messages directly from an MQTT broker using MQTT 3.1.1 or MQTT 5:
https://www.eclipse.org/ditto/connectivity-protocol-bindings-mqtt.html
https://www.eclipse.org/ditto/connectivity-protocol-bindings-mqtt5.html
Or, utilising Eclipse Hono as device connectivity layer, consume messages via Apache Kafka or AMQP 1.0 (which Hono uses for "northbound" applications ingesting telemetry data).
If you need Eclipse Hono, I suggest to have a look at the "Cloud 2 Edge" package in the Eclipse IoT Packages project which already automatically sets up and configures both Eclipse Hono and Eclipse Ditto to work with each other:
https://www.eclipse.org/packages/packages/cloud2edge/
If you only need to send data via MQTT, I would suggest to use an MQTT broker (like Eclipse Mosquitto) as this simplifies the setup a lot.
If you have requirements towards supporting multiple IoT protocols or massive scalability requirements, Eclipse Hono is a good choice.

Related

ESP32 + Mongoose server + MQTT broker and client

I have a system already working, which consist in a Mongoose web server running in a ESP32. It is also capable of publishing messagges trough MQTT, using Mongoose's mqtt libraries, when connected trugh an external MQTT broker. The idea is that there could be many of those systems, let's say 5 units, connected to the same LAN whith an extra hardware running a mqtt broker.
The broker is the one who manage some features of the individual units.
The thing is, what if the broker goes down? Or, if the broker is not in the LAN but is connected through internet, what if the internet connection goes down?
If that happens, the idea is that one of those units became a mqtt broker, so it can manage its own features and also other unit's.
In that way, I would have one unit working as a broker (only with basic functionalities) but also as a client.
I would like to know if anyone of you have already worked with a similar setup, or what do you think about it.
Any other idea?
I know there are Mongoose libraries to run a MQTT broker in the device, that wouldn't be an issue... the thing is... Isn't it better to setup an HTTP communication between the units, since they are all already web servers?

Why use mqtt server for BLE gateway?

I have a BLE temperature sensor, which should send measurements to an ESP32 via a BLE connection and my plan was that the ESP32 could send the measurements via WiFi to my database (Firebase Realtime Database). However, I have seen from a few tutorials that a mqtt server would be neccesary (see the screenshot below - link to the video: https://www.youtube.com/watch?v=PBYCG-ypvRY). Could someone please explain to me why the mqtt component is neccesary? Currently I am measuring temperatures using my ESP32 (without the BLE temperautre sensors) and sending them directly to the database, so I am confused as to why with BLE I would need a mqtt server.
Thanks for your help in advance!
You don't need MQTT. It's just one of the IoT-friendly protocol alternatives (like HTTPS, AMQP, CoAP, homebrew, etc) available to you for device-to-server communication. There are pros and cons to each one. It's up to you to choose whatever solution is relevant to your system.
If you've already implemented the Firebase HTTPS interface and it does the job, you're done.
If you are having problems, note that the Google IoT Core also prescribes MQTT (or, alternatively HTTPS) as an underlying messaging protocol - used together with the Device SDK for Embedded C. But this is for people who want to have a large-scale authentication and management solution for their devices. By all means, stick to your existing solution if it works.

BLE device not disconnecting

I am working with BLE devices. and using nrf controller with bluez 5.4 code.
I am customizing gatttool source code so that multiple devices can connect and disconnect.
My focus part for now is how to disconnect ble device using gatttool apis.
I had found one solution in code that we can use:
g_io_channel_shutdown();
g_io_channel_unref();
These 2 APIs are use to disconnect ble device.
I am using nrf connect application in my mobile to connect generate dummy ble device so that I can perform operations.
When I use this for disconnecting device any other formalities are needed in between or only these APIs are ok?
I am not able to disconnect using these APIs.Some time it is give effect and some time it is not working.
If any one have idea abut this please respond.
Thanks in advance.
Do you mean Bluez 5.4 or Bluez 5.40? Either way, they are quite old releases.
gatttool is one of the BlueZ tools that has been deprecated in BlueZ.
Ideally you would be using the BlueZ DBus API to interact with BlueZ.
Not sure if you are creating a GATT Server (peripheral device) or GATT client (Central Device) but there are examples of both in the BlueZ source:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-client
These examples are in Python, but most languages have DBus libraries to help access the API which are documented at:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt

Raspberry Pi3 BLE only accepts a single connection

I have created a BLE peripheral that exposes a GATT service. It uses BlueZ 5.50, but it seems that only one device can connect to the GATT service. When the device is connected, then other devices can't see it anymore. It's not showing up in a scan anymore and if it was already scanned, then I can't connect to it anymore.
It seems to be a limitation or configuration issue in BlueZ, because when using the Paypal GATT library it can handle multiple connections. As far as I know, the RPi3 BLE chip should be able to handle up to 10 connections.
Does anyone know if this can be done using BlueZ?
The Paypal GATT library directly connects to the HCI device and bypasses most of the kernel stuff. BlueZ depends on kernel drivers and user-space applications and is capable if the driver reports that the controller allows multiple connections. You need a decent BLE controller and a recent kernel to make it work.
More information can be found in https://github.com/bluez/bluez/issues/12.

web service communication over nRF24L01

I have two peaces of nRFO24L01, one of them is connected to arduino and second one is connected to RPi. For communication between them I used this library https://github.com/tmrh20/RF24 and this communication working very good. Now I want to have web services on RPi which have to be able to communicate with arduino through the nRF24L01. The best option should be some java web services on tomcat server but I can't manage to find some kind of wrapper which will provide me easily connection between c++ code from mentioned library and web services. Is there any solution for this?
For communication between arduino and RPi I used getting started example from mentioned library from github.
See the RF24Ethernet lib from the same guy:
http://tmrh20.github.io/RF24Ethernet/

Resources