Introduction: DragonBoard410c MQTT - Send Data to Cayenne

Picture of DragonBoard410c MQTT - Send Data to Cayenne

Cayenne is the world’s first drag and drop IoT project builder that empowers developers, designers and engineers to quickly prototype and share their connected device projects. Cayenne was designed to help users create Internet of Things prototypes and then bring them to production.

Cayenne uses MQTT protocol to communicate with modules, and in this tutorial you will se how to send and get data from the platform using DragonBoard.

DragonBoard dont have a package designed for itself, like raspberry or arduino, so the code was full made by me.

Step 1: Create Project and Components in Cayenne

Picture of Create Project and Components in Cayenne
  • Create account
  • Add Device
  • Bring your own thing
  • Save all credentials USERNAME, PASSWORD and CLIENT ID

Before add components in your dashboard, you have to connect to Cayenne, go to step 2, run code one time and come back.

  • Click on Add new ... button
  • Device/Widget
  • Custom Widgets
  • Button
  • Set the name and the channel used, you will need channel to get and send data in code
  • Gauge
  • Set the name and the channel used, you will need channel to get and send data in code

Step 2: Run in DragonBoard

First install MQTT Client Library – Paho Python

  • $ sudo pip install paho-mqtt

Download the code and run

You will need to make some modifications in code:

Lines 6, 7 and 8

  • Username = 'USERNAME' #Put your MQTT_USERNAME
  • Password = 'PASSWORD' #Put your MQTT_PASSWORD
  • clientID = 'CLIENT ID' #Put your MQTT_CLIENTID

Line 11

  • Get the Arduino Code saved in DragonBoard/Cayenne/AnalogInput
  • Send it to Arduino 101
  • Connect Arduino 101 to DragonBoard
  • $ dmesg

Catch the port that Arduino is connected and replace at PORT = "/dev/ttyACM2"

Lines 40, 42, 61 and 75:

Catch the channels configured in components in previous step and replace where is writen "channel"

Connect a led to pin 23 of the DragonBoard and control it via button.

The data comming from the uart is sent to the sensor component.

$ sudo python cayenne.py

The Arduino code is saved in DragonBoard/cayenne/AnalogInput

You also can use others sensors if you dont wanna use Arduino connected to the board, just remove fuctions related to serial communication.

Enjoy!

Comments

About This Instructable

124views

1favorite

Bio: Product Development Specialist at Das Coisas
Add instructable to: