Parse Arduino Uno data directly to IoT - azure

I'm making a temperature, humidity and moisture sensor system where data should be sent over to Iot hub (Cloud) every second. I have used an Arduino and Ethernet shield.
I'm able to create sensor data every second. It sends this data to the IoT hub directly from Arduino without a Raspberry Pi or PC|VS Studio. I have already created a job stream on Azure as well. Is there any mechanism with which I could send this data to Azure IoT hub directly? Thanks in advance.

You can look at the libraries for IoT Hub here:
Azure IOT SDK for C
A Quick search on the Arduino site also contains lots of examples of devices connecting to the IoT hub. I imagine you can use both AMQP and also MQTT protocols for this directly from your Arduino. I'm using MQTT in my ESP8266's without VS involved, all written in the Arduino IDE.

You can also find the Azure IoT Arduino libraries here.
Note that required libs (AzureIoTHub, AzureIoTUtility, AzureIoTProtocol_HTTP and AzureIoTProtocol_MQTT) are all published in the Arduino IDE lib manager, so you can just install them from there (no need to clone the repos).
The docs and the samples are not quite up to date (which we'll fix real soon) but you can find an MQTT sample in the MQTT lib repository.

Related

Send REST API requests through Azure IoT Hub to a Raspberry Pi webserver

I'll start off by apologizing if this has been asked and answered, but I've been researching this for a few days and either I'm not understanding what I'm reading or I'm trying to do something unique or not possible(guessing it's the former).
Currently what I have is a Raspberry Pi that has a webserver running and a web UI for controlling what's connected to it. It has a slew of REST API's that can be accessed to perform various tasks. I have a couple of these setup with static IP addresses and all works great. My problem is scale. The potential exists to have hundreds(to thousands) of these running and need to be controlled by a single mobile app. I don't want to have thousands of static IP's. Though this would be the easiest solution it certainly wouldn't be cost effective and most likely a nightmare to manage.
My desire is to "connect" all of these Raspberry Pi webservers to the Azure IoT hub. The webservers do not need to talk to each other, but the mobile app needs to be able to send REST messages to each server individually.
The coding of the app, the coding on the Pi's and any additional coding is not an issue. I've been an applications developer for over 20 years so coding is not an issue.
So, my questions are:
What is the minimum necessary to be running on the Pi to connect to the Azure IoT Hub?
Do I understand correctly that to do what I've described above, I have to send a message to the Hub and then the Hub sends a message to the device?
Does anything exist to define the Pi as an endpoint and just be able to send the REST messages directly to that?
Any help provided, even links to relevant documents, would be greatly appreciated. Thank you!
Have you checked the official documentation? It contains an example of what you're trying to achieve (send data from device to iot hub / send command from iot hub to device)
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-c2d
All you need is the connection string to the Azure IOT Hub. To register your device, please visit: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-sdks

Connecting Android device sensors with NodeRED

I am new bee to NodeRED. I refer tutorial on NodeRED connecting devices such as raspberry PI. The partial documentation on NodeRED Website is available that states that how developers can reads sensors connected to GPIO pins on Raspberry PI.
Similar way, I would like to know - how can I read sensors (e.g., proximity sensors, GPS, Accelerometer) on Android device with NodeRED? More specifically, I would like to play with Android device sensors with NodeRED? I have tried to google documentations related to it, but did not find it.
You will need to write an Android app to expose the sensors in a way that can be ingested into Node-RED, I would suggest publishing the values to a MQTT broker.
Node-RED can then subscribe to the topics and process the sensor values.
write an android app, that will expose the android sensor.
either push the data from Android to MQTT server (best choice) or use a microservice like AWS lamda or Firebase .
if used pub-sub with MQTT call it on Node-red, or call Lamda function Api endpoint on node-red or call the firebase directly on Node-red,
choose wisely according to your requirements.

Azure Event Hubs C Client

I am trying to send messages to Azure Event Hubs from an Arduino with a Wifi extension. Is there a way to upload the data without using the provided libraries?
You will need some kind of device to act as a gateway. The Adruino board cannot provide this functionality. Most likely, you will need to connect the device to a Raspberry Pi and send the messages using the Pi. Below is directions and code on how to set this up.
https://github.com/MSOpenTech/connectthedots

AllJoyn vs MQTT - what is the difference?

AllJoyn and MQTT are both open source projects for Internet of Things interoperability, both provide an event bus and a router/broker to connect devices. What is the difference? Are they compatible? Which standard should I use to implement my future-proof IoT device?
AllSeen Alliance's AllJoyn project is open source proximal IoT. It is usually a mesh topology.
MQTT is open source cloud IoT that works well on mobile and satellite networks. It is pub/sub with topics.
They are complementary, in fact IBM is working on a MQTT plug-in for AllJoyn's gateway agent.
You can read about that in AllJoyn Adds Human Touch to the Internet of Things. However, it seems that AllJoyn to be younger that MQTT, so for the second protocol is possible to found more documentation and frameworks.

nodejs IoT device to device communication

so im working on a my bachelor thesis and for that i need to implement, in a smarthome, d2d communication between IoT devices. So i want to implement the usuall server work, like noticing if a device connects/ disconnects etc. to the IoT devices, so no server/hub is needed at home.
But I can't find good solutions for it, for websockets i need a server, for mqtt a broker and so on, but all need a server.
I found that d2d is done with "LTE" similar technology but i would like to do it with web-protocols.
So my question:
Is there a way to let IoT devices talk to each other over the network?
My IoT devices (raspberry pis) currently use nodejs with typescript but I'm not starting a server, they only have a mqtt connection to publish there sensor data to the users.
Thanks in advance.
And if im understanding something wrong, please say it. :)

Resources