5

I have a Raspberry Pi running Windows IOT Core and it is running my home automation application. Now I need to set up communication between the RB pie and ESP8266.

I've been considering the MQTT protocol but I don't want to have an external server running the MQTT broker and I can't find a broker for the Win IOT. Does a MQTT broker exist for Windows IOT Core? If not, what communication protocol would you recommend for this purpose?

CodeBreaker
  • 488
  • 9
  • 18
  • Which one did you eventually choose? Is there any more feedback you need? If not I suggest you accept the right answer so that SO can mark this question as closed, http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work. – Marcel Stör Mar 11 '16 at 06:09

4 Answers4

3

Antonio there are a few options available for you on Windows IoT Core

If you're building an application using Node.js there's Mosca (http://www.mosca.io)

If you're building an application using Python, you can check out hbmqtt (https://github.com/beerfactory/hbmqtt)

Of course for .NET applications you can search Nuget. GnattMQ (www.nuget.org/packages/GnatMQ) seems to be pretty popular .NET library

trmck
  • 46
  • 3
  • I've looked into GnatMQ but i can't find any documentation on how to get it up and running. Or am I looking in the wrong places? – CodeBreaker Feb 09 '16 at 23:13
  • 1
    I use GnattMQ, and it seems to be rock solid. For all intents an purposes there is no documentation (the only page in Wiki is.. performance! Really?) However the code is very easy to follow. I have wired an event to fire every time there is a message published, and use that as data input to the rest of my app. There is also a send method in the broker class, which i've made public. I don't know if that is correct, but it does seem to serve me well for months. – Vladimir Akopyan Jul 24 '16 at 07:03
  • @VladimirAkopyan I am trying GnatMQ on Raspberry PI 2 with Win 10 IoT core as os. App/broker starts successfully, but as soon as a client connects, app crashes for no visible reason(debug in VS yielded no results). I have provided all available capabilities to rule out permission issues. Any pointers appreciated. – pushpraj Nov 09 '16 at 06:17
  • 1
    @VladimirAkopyan can you share some code explaining how you use GnatMQ? – Eric Wu Nov 29 '16 at 13:45
  • @VladimirAkopyan +1 for describing your experience with GnattMQ. I ended up using GnattMQ and M2Mqtt at the same time (on the same device that acts as the broker) instead of messing with the GnattMQ broker code. The reason is that **you may break the protocol** if you just intercept the incoming messages in the broker event handler. Messages that should only be received once (QOS_LEVEL_EXACTLY_ONCE) could arrive twice there... so your code does not work as you'd expect of a client. – sjkm Mar 16 '17 at 13:24
2

The is the GnatMQTT which is written in C# so I guess should build on Window IoT

hardillb
  • 54,545
  • 11
  • 67
  • 105
1

Possibly there exist some MQTT lib or another protocol. But I assume the following situation and going to suggest a solution:

Assumptions:

  • Rpi is at the core of the system.
  • ESP is working like satellite, sensor etc.
  • So ESP is reporting data to the Rpi
  • They (Rpi and ESPs) all are in the same subnet.

Solution:

  • On the Rpi side implement a simple UDP bcast listener and listen to some specific port on BROADCAST ip. (ex: 8889)
  • On the ESP side implement a UDP Client to send data to BROADCAST ip and to specific port. (ex: 8889)
  • Implement a message format and make ESP to send it and Rpi to parse it.

Example Message Format:

The message can be a string (ASCII encoded).

ABBBEEECCCDDDD.....DDD
A: Start Header
BBB: Sender ID
EEE: Receiver ID
CCC: Payload Byte Count
D..: Payload

OR

A|BBB|EEE|DDDDD..DDDDDD|F
A: Start Header
|: Seperator
BBB: Sender ID
EEE: Receiver ID
D..: DATA payload
F: End Header.

This config will allow you to use DHCP, not to record any IP address of the clients and it is cheap to implement (according to resources ram,cpu etc). Note: I don't know how MQTT uses resources.

Mert Gülsoy
  • 2,779
  • 1
  • 19
  • 23
-2

There are a ton of MQTT brokers available. ActiveMQ is built with Java and can be installed on any platform that supports Java. Mosquitto and RabbitMQ have installers for Windows.

However, if you want something even more lightweight than MQTT you might also want to look into CoAP.

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • I think they are looking for c# based brokers, so those brokers aren't going to help. CoAP is interesting, but is there a good implementation around? – Vladimir Akopyan Nov 29 '16 at 14:09
  • "they are looking for c# based brokers" - well, how would one know? The question doesn't say so explicitly. Windows IoT can run both Python and Java. Even the accepted answer mentions Node.js and Python brokers. Furthermore, the OP was also asking for alternative protocols why I mentioned CoAP. – Marcel Stör Apr 12 '17 at 20:12