Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Please Try Out the MQTT-SN Gateway

So, I've given it a basic trial using an XBee and I'm happy to say it works. My set up was:
- MQTTSNGateway in Ubuntu 16 Server VM using FTDI Serial adapter directly to XBee (coordinator). Only changes were for API mode 1, and Makefile change for XBee sensor network.
- Mosquitto broker in same VM
- Arduino UNO using slightly modded Paho MQTTSN packet lib with an XBee (router) shield, running my own state machine (lightly tested against my own MQTTSN gateway).

All XBees series 2, ZigBee firmware load, API mode 1. See http://knowledge.digi.com/articles/Knowledge_Base_Article/Escaped-Characters-and-API-Mode-2 for Digi recommendation on mode 1.

The Arduino uses SEARCHGW to find the gateway. It then connects, publishes status topic (with retain), and subscribes to two topics. It also publishes a rolling counter on a topic. It flips a couple of pins on the subscriptions. It also uses a Will topic/message on the status topic. 

Everything seemed to work well from an MQTT perspective; I used mosquito_sub/pub to monitor change, plus observed the pins on the XBee. There were some hitches, but not all are reproducible; for example, ^C did not seem to exit the gateway in all states, I observed the CPU pegged at one point, etc., but these are all fairly minor bugs. The makefile could use better dependency setup. It would be nice if a cross platform (at least Linux and OS X and maybe other BSD variants) lib was used for the threading; some recommend an apache lib, but I do not have direct experience with it. 

I hope to deploy it on a pi or in a docker instance soonish and let it soak against my 'house' mosquito broker, which has some activity (though certainly not 'busy'), and maybe have it fire up things on a display or something. Alas, I have family and job so this might take a couple of weeks.

PK

On Tue, 20 Sep 2016 at 19:57 Tomoaki Yamaguchi <tomoaki@xxxxxxxxxxxxx> wrote:
Hi Paul,

Thank you for your good suggestion.


> digi recommends API mode 1 for most uses.
I didn't know that.  

MQTT & MQTT-SN should transport a binary payload.
therefore, I thought simply escape mode is only way out to get the real start byte, not 0x7e in a payload, for a stable communication.
so, I have never tested API mode 1 from the beginning.
I'm expecting your XBee testing of API mode 1.


> This should probably be configurable.
It's easy to change the code for TEST.

Just comment out as follows:
=========================================
void XBee::send(uint8_t c)
{
  // if(c == START_BYTE || c == ESCAPE || c == XON || c == XOFF){
  //    _serialPort->send(ESCAPE);
 //     _serialPort->send(c ^ 0x20);
 // }else{
      _serialPort->send(c);
  //}
}

int XBee::recv(uint8_t* buf)
{
    if (_serialPort->recv(buf) )
    {
       // if ( *buf == ESCAPE)
      //  {
      //      _serialPort->recv(buf);
      //      *buf = 0x20 ^ *buf;
      //  }
        return 0;
    }
    return -1;
}

==========================================
XBee programs as far as I know are just sending with out Frame ID. It's unstable same as QoS0.
In my experience, A point of stable communication of XBee API mode is that  using a Frame ID in Transmit Request and get Transmit Status.

I will change it configurable after my struggling with client certificate required TLS connections.

Thank you for your cooperation.



Tomy Technology

Tomoaki  YAMAGUCHI

2016-09-20 23:09 GMT+09:00 Paul Kierstead <paulkierstead@xxxxxxxxx>:
One hitch in the XBee code is that (as far as I can tell) it assumes API mode 2 (escape mode), which is not the generally recommended mode for XBee; digi recommends API mode 1 for most uses. This should probably be configurable.

Hopefully I'll get some time soon to hack it back to API mode 1 and run a couple of little trials. I have a simple remote power switch I need and was going to do with an ESP8266/MQTT (it is what I have used in the past), but could try it out with an XBee/MQTTSN, as it would be nice if it could run off battery for a while. What I really need is MQTTSN over BLE ... someone needs to write that up!

On Tue, 20 Sep 2016 at 00:47 Tomoaki Yamaguchi <tomoaki@xxxxxxxxxxxxx> wrote:
Ian,

Sorry, I miss understood your intension.
Link is correct.

Tomy Technology

Tomoaki  YAMAGUCHI

2016-09-20 13:39 GMT+09:00 Tomoaki Yamaguchi <tomoaki@xxxxxxxxxxxxx>:
otherwise,  Makefile is missing in github.

Tomy Technology
Tomoaki  YAMAGUCHI

2016-09-20 7:04 GMT+09:00 Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxxx>:
Hello all,

Tomoaki is kindly working on and contributed an MQTT-SN transparent gateway.  You can find it here:

https://github.com/eclipse/paho.mqtt-sn.embedded-c/tree/gateway/MQTTSNGateway

in the gateway branch.  I had been waiting for a few more updates to go in before asking for interested parties to try it out for themselves, but I've not found the time I was hoping for.

The instructions for building and using it are in the Readme. I've been using the MQTTSNPacket client to test it out.  I'm hoping a few more people can use it and open issues for bugs or suggestions.

Thanks!

--
Ian Craggs
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto
 
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

Back to the top