Reference   Language | Libraries | Comparison | Changes


XMPP connector


This Connector allows to communicate using XMPP in an Arduino sketch. Below the steps that you should follow to use the XMPP connector:

  • setup Shell connector;
  • enable the connector;
  • write a simple sketch;
  • upload the sketch and enjoy.

Setup connector

You can find XMPP configuration file at the following path: /usr/lib/python2.7/ciao/connectors/xmpp/xmpp.json.conf

 "name" : "xmpp",
 "description" : "XMPP connector for the Ciao Core",
 "version" : "0.0.1",
 "ciao": {
 "host" : "",
 "port" : 8900
 "params" : {
 "domain" : "ACCOUNT_DOMAIN",
 "port" : 5222,
 "username" : "USERNAME",
 "password" : "PASSWORD",
 "tls" : false,
 "ssl" : false

The parameters at the beginning are for internal use, do NOT edit them (name, description, version, ciao) unless you know exactly what you are doing.

The configurable part is the one identified by "params" key:

  • host (required): the IP or the hostname of the XMPP server you want to use (must be a string)
  • domain: specifies the domain for the user you want the board to use, really useful if you are using an XMPP server that support multiple domains (must be a string)
  • port (required): specifies the port your XMPP server is listening to (must be an integer)
  • username and password (both required): provide username - without domain - to use on the board and its password (must be string)
  • tls: establishes if TLS must be used (boolean)
  • ssl: establishes if SSL must be used (boolean)

Enable connector

Each Ciao connector must have a configuration file for the Ciao Core, this simple file is mandatory to enable the connector.

To enable XMPP connector please edit the file at the following path: /usr/lib/python2.7/ciao/conf/xmpp.ciao.json.conf

 "name" : "xmpp",
 "enabled": true,
 "type" : "managed",

The key enabled must be set to true (boolean value).

This is the only parameter you are required to edit in order to enable the XMPP connector. Once done your LininoOS will be ready and configured to use Ciao Core and XMPP connector.


  Arduino Ciao example

  This sketch uses ciao xmpp connector. It sends back “hello world” message to the xmpp client when receives “ciao” from it.

  Be sure to set the xmpp client in the "USER" field used to receive the response by MCU.

  Possible commands to send from the xmpp client:
   "ciao" -> random answers in 5 different languages

#include <Ciao.h>

#define LED 13
String USER = "user@domain";;

void setup() {
  pinMode(LED, OUTPUT);

void loop() {

  CiaoData data ="xmpp");

  if (!data.isEmpty() && !data.isError()) {

    String id = data.get(0);
    String sender = data.get(1);
    String message = data.get(2);


    if (message == "ciao" )
      Ciao.write("xmpp", USER, "Hello, i'm Arduino :-) ");
    else if ( message == "led on") {
      digitalWrite(LED, HIGH);
      Ciao.writeResponse("xmpp", id, "LED ON");
    else if ( message == "led off") {
      digitalWrite(LED, LOW);
      Ciao.writeResponse("xmpp", id, "LED OFF");
      Ciao.write("xmpp", USER, "Sorry i don't understand :-( ");
Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.