1. Home
  2. Docs
  3. Documentation
  4. Integrations
  5. Particle Device

Particle Device

In this article we are connecting a Particle device to Nimbus808 solution platform using MQTT.


Particle Diagram

Particle devices are compact hardware development kits designed for building connected projects. They integrate an ARM microcontroller, a communication module (Wi-Fi, GPRS, or 3G), and access to a web-based IDE with extensive community examples and libraries.

By following this guide, you will be able to publish and subscribe data to and from Nimbus808 using any Particle device module within minutes.


Requirements

  1. Particle Device
  2. Micro USB Cable
  3. Particle SIM card with data plan (if using a Particle Electron)
  4. Nimbus808 Account

Particle Device Configuration

  1. If you are using a Particle Electron, complete the following steps to set up the Particle data plan. Particle Electron steps.
  2. If you are using a Particle Core you have two ways to set it up:
  3. If you are using a Particle Photon you have two ways to set it up:

Particle’s Web IDE

After claiming your Particle Device and setting up your Nimbus808 account, let’s go to Particle’s Web IDE

In the Particle Web IDE, create a new application and assign it a descriptive name.

Particle Web GUI

Navigate to the Library Tab

library callout

In contributed library write MQTT and select the MQTT library.

mqtt list
include in proj

Click on INCLUDE IN PROJECT then return to your programmable project file.


Sending Data between Nimbus808 and a Particle Device

To send and receive data between a particle device and Nimbus808 it requires the Nimbus808’s broker URL. Values will be interpreted through the MQTT library.

// This #include statement was automatically added by the Particle IDE.
#include <MQTT.h>

// Include Particle Device OS APIs
#include "Particle.h"

// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);

// Show system, cloud connectivity, and application logs over USB
// View logs with CLI using 'particle serial monitor --follow'
SerialLogHandler logHandler(LOG_LEVEL_INFO);

MQTTClient client;
unsigned long lastMillis = 0;

void connect() {
  while (!client.connected()) {
    Serial.print(".");
    client.connect("particleClient"); // client ID
    delay(1000);
  }
  Serial.println("\nconnected!");
  client.subscribe("/button_status");
}

void setup() {
  Serial.begin(115200);
  Serial.println("Hello, Particle!");

  client.begin("test.mosquitto.org", 1883); // place your Nimbus808 information here
  connect();
}

void loop() {
  client.loop();
  delay(10);

  if (!client.connected()) {
    connect();
  }

  if (millis() - lastMillis > 1000) {
    lastMillis = millis();
    client.publish("/hello", "world");
  }
}

Have questions? Contact us for help