Is it possible to connect NodeMCU with Microsoft Azure Event Hub? - arduino

Is it possible to send data from ESP8266 Nodemcu to Microsoft Azure using 'Event Hub'. while searching on the internet i am getting results were they are using Azure Iot Hub. Since my application does not require bi directional communication and also azure iot hub service is very expensive than azure event hub service i would prefer if it is possible to use Azure event hub with esp8266 Nodemcu .
can anybody direct me in the right direction.

You will want to use the Event Hubs REST API for that.
API documentation: https://msdn.microsoft.com/en-US/library/azure/mt652149.aspx
A proof of concept implementation with Arduino: https://www.hackster.io/stepanb/proof-of-concept-nodemcu-arduino-and-azure-event-hub-a33043
Full-blown client implementation for Arduino: https://github.com/gloveboxes/Arduino-ESP8266-Secure-Azure-IoT-Hub-Client

Related

how to read RFID card from Angular

so im doing a side project, and i want to use Angular with asp.net REST api connecting to a mssql server.
the project is basically a site that could be placed in a company/school canteen, with a touch screen, and an rfid scanner for employee cards.
i've got no issues with the angular / api part. but how would i go about reading events from a rfid scanner from angular? is this even possible?
the usecase is that i want to scan the employee card, then in the angular client app, prompt if the user is correct "Welcome, are you "firstname" "Lastname"? (confirmbutton)"
then use the gathered employee informations later in this process when the employee checksout from the canteen.
Scenario 1: Server and RFID reader are on the same device
Example:
You have a Raspberry Pi 4 with Raspberry Pi OS and .NET 5 on it. You buy a RFID reader like this one, and you either find a library for it (like this one) or you start reading the datasheet and write your own library with .NET I2C or SPI APIs. Then your ASP.NET Core website on the Pi will listen for RFID events (maybe with a background worker or maybe another .NET app will notify it with gRPC or API) and notifies the client (Angular in you case) with WebSocket or polling or some other method.
Scenario 2: One server with many web clients on other locations
Example:
You have an ASP.NET Core API that doesn't know anything about RFID and just works with normal data like any Web API. You then tell your clients to buy a USB RFID (like this one) and you use Web USB API inside your Angular app to communicate with the RFID device (I don't know how) and then call necessary APIs on the ASP.NET server. (BBC micro:bit uses this method, they connect to their devices via Web USB)
Example 2 (this is probably the easiest way):
Write an Android app with Ionic that uses the NFC plugin to communicate with NFC tags and call any API you want. You can then run it under kiosk mode. All your clients need then is a cheap android device.
Note: You can combine these scenarios, for example in scenario 1 you can still call a centralized API.

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