Continuously sending sensor data to SignalR hub - c#

I'm running Windows IoT on a Raspberry Pi.
After I turn on my Raspberry Pi and Windows IoT starts up, I want to automatically begin reading sensor data from a serial port continuously, and also send the data to a SignalR server/hub continuously. I don't need any UI.
I'm new at UWP apps. Is it best practice to use a headless background task for doing it? But how can I make sure, that the data reading and sending interval is not too long (~1-20ms)? Because I want to use a SignalR client to send the data near real-time.

First you should take care of the size of the package.
Maybe you should also think about using Azure IoT Hub. Azure IoT Hub is build exactly for scenerios like yours, receiving extrem high amount of sensor data in near real time from many devices. And it is highly scalable, and can be used from any client platform.
Here you find documentation, backgrounds and samples: https://azure.microsoft.com/en-us/documentation/services/iot-hub/

Related

Azure Iot Logic Component

I have a sensor that collects temperature data and sends it to my Iot Hub. This data must be evaluated. In some cases, the data must be sent to another device. Currently, I have a C# console application that does the job. It subscribes to my Iot Hub and reads the data from my partitions. As far as I understood, there must be an Azure component that should be used instead of a console application. My question is, what component can be used in order to receive data from an IoT device in order to process the data?
Thanks in advance!
Azure Functions is a serverless compute service that enables you to run code on-demand without having to explicitly provision or manage infrastructure. Use Azure Functions to run a script or piece of code in response to a variety of events.
you can utilize it instead of writing in a console app and scheduling it .

Azure IOT Hub - Monitor Device-To-Cloud communication from 1 device

There are x number of devices in system and y numbers of device owners. These devices are actively sending data to Azure IOT Hub - temperature, humidity, voltage, etc.
These devices have RFID chips inside them that store information about device and I'm working with Xamarin.Forms project that would allow android/iOS users to get this information.
Upon retrieving this information about the device, I want users to be able to see and monitor the device-to-cloud Azure IOT communication.
In similar fashion, I'm working on a web dashboard, where user could just select device from dropdown/selection and do the same thing.
I've tried implementing the
Azure Device Explorer approach, however here's the problem; in Azure IOT Hub, one consumer group can only have 5 clients and once, meaning, if 6 people want to monitor the live device-to-cloud communication, only 5 people will be able to do it. Furthermore, what this example does is - get all incoming IOT Hub messages, query and filter only the information that the user wants to see - which would probably put quite of a load on mobile phones.
So the question is: Is there a way to see live device-to-cloud Azure IOT Hub communication from a single device?
I'm open to adding other Azure services.
The Azure IoT Hub telemetry path (hot path) is a data stream of all devices ingested internally into the default built-in Event Hub or externally via the custom endpoint. To see a telemetry data from the single device, it is necessary to capture a telemetry stream and use a filtering technique for a specific data. In other words, the telemetry stream must flow transparently in the stream pipeline without any latency and the capture point will hold a copy of the telemetry window.
This warm path is close to the real-time (hot path) and it can be configured from 1-15 minutes.
The following screen snippet shows an example of the warm path using an Event Hub feature such as Capture. Note, that this feature is not in the Azure IoT Hub, so that's used a custom endpoint with an external Event Hub:
Once we have a telemetry warm path (stored in the Blobs, for example each minute), we can query a device messages, twin changes events and device lifecycle events based on the time, value, etc. by user request, eventing or trigger.
I am working on a similar project, we developed a web app with back end database. this db stores all the iot messages as it comes in, web app send the push notification via azure notification hub to the mobile clients interested about a device. All the business logic and operations is written in the web api project.
Mobiles directly do not communicate with IOT, they communicate via api to get the information from db, and using push notification helps to keep everything real time.
we are using azure functions for reading message from iot as it comes and process.

using arduino input in mobile

I need to know how hard will it be to get input from a heartbeat sensor connected to arduino to a android running a unity made app. Im making for my degree final project a vr system that take a real time heartbeat input to effect the unity game, and i need to decide if i want a simple android vr or oculus (which is less common and more expensive). The plan is to connect the arduino via usb and call the serial port, but i think it may be more complicated then that. Since I have no prior experience in arduino i would love to get your advice in what I will need to do to make it work.
The easiest way is to send the collected data through Bluetooth controller. You can buy an HC-05 Wireless Bluetooth Serial Transceiver Module for 3 US dollars. You can connect the device to Rx and Tx terminals on Arduino. See this link for details on how to use HC-05 with Arduino.
In android device side Install or create an android application which can send data through Bluetooth serial terminal. You can find lot of BT serial port terminal applications in play store. I think some of the applications are open source and you can use their code in your own application.

Communicating with multiple BLE devices using WIndows 10 UWMP

I'm running Windows 10 IoT on Raspberry pi 3 and I have like 10 Arduino based BLE devices with which I need to communicate with.
I need my program to iterate through all the 10 BLE devices, send a command and receive a response.
I have done it on Android, but I'm don't know how to do it on Windows 10. Any help would be great.
Thank you
Not fully sure if you are wanting to plug 10 Arduinos into a Raspberry Pi, or if you want to communicate to 10 BLE enabled Arduinos wirelessly. If it's the latter, I can help. I'm assuming you have an understanding BLE fundamentals.
Overview: Basically you'll want to pair the bluetooth Arduinos with Win IoT, connect to each one of them, send and receive data using GATT Characteristics, then disconnect when finished.
Get a HCI BLE dongle form the list of supported BLE dongles for Win IoT.
You must then pair each BLE Arduino to Win IoT. This will allow the Pi to find the devices through your code.
To send data and receive responses form the wireless BLE devices, a connection must first be established.
I assume you'll have already programmed the Arduinos to have a Characteristic (possibly named "command"), in their GATT database with write access and another (possible named "response") with read access and notifications enabled. Characteristics are like sockets. Make sure your Arduinos have something similar to this set up.
In your Win IoT code, you'll have to discover these GATT Characteristics while connected to the Arduino. After discovery, data can be written to the "command" Characteristic.
Arduino can then respond by triggering the notification that data is waiting on the "response" characteristic. After the Pi has received this notification, it should then proceed to read the "response" Characteristic from the Arduino's GATT database.
Finally disconnect when finished and repeat on the next Arduino.

How does multi player communication work from a client to a poker server?

I just started to work with client-server communication and I created a poker game that works on Android and iPhone and connects with a C# server. Right now I'm using PubNub to send and receive messages but there are either one of two problems with this:
I need to poll the sever and get the table status all the time so there will be a lot of messages which means that the server needs to send more messages (more overload) and a higher cost (as PubNub pays per message)
(or)
The table will not always be 100% updated on the client (Android/iPhone)
So my question is how do bigger poker sites like PokerStars handle the communication? Do they set up sockets and send the information all the time to the connected users to that connected table?
Any information about creating this kind of communication between one server and several mobile devices (and also Windows C# clients) would be highly appreciated.
I cannot give you an answer to your question but my approach would be using a tool like WireShark and try to find it out by analyzing the (amount of) packets that are exchanged.

Categories