Skip to content

Instantly share code, notes, and snippets.

Send data to Ubidots using RN131

Communicate with the RN131 module through the serial port. Plug your device to your computer and open a serial terminal.

The speed must be 9,600 bauds, then enter the following commands in the serial terminal. You should type the string “$$$” before each set of commands to enter the command mode:

Command set #1:

// MPU-6050 Short Example Sketch
// By Arduino User JohnChi
// Modified by Mateo Vélez - Metavix
#include <ubidots_arduinoYUN.h>
#include <Process.h>
#include<Wire.h>
const int MPU=0x68; //dirección I2C del MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
/*
Ejemplo para Dispensador de comidas para mascotas
Este codigo es para controlar el servo
del dispensador de alimentos para mascotas
Arduino pins:
5V --> cable rojo del servo
GND --> cable negro del servo
#include <Wprogram.h>
#include <Wire.h>
#include <WiFiShieldOrPmodWiFi_G.h>
#include <DNETcK.h>
#include <DWIFIcK.h>
#include <LedControl.h>
//------------------------------End Librarys----------------------------------
#define GREEN 0
#define RED 1
// This example allow send data using UDP protocol
#include "Ubidots/Ubidots.h"
#define TOKEN "CCN8FrVulRYGulPTkbxxxxxxxxxxxxx" // Put here your Ubidots TOKEN
#define LED D0
#define VARIABLE_NAME "DUST"
#define DATA_SOURCE_LABEL "waveshare-dust-sensor"
#define DATA_SOURCE_NAME "Waveshare Dust Sensor"
#include <SODAQMdot.h>
// Put here your SSID of lora gateway
#define GATEWAY_SSID "Your_Lora_Gateway_SSID"
// Put here your PASS of lora gateway
#define GATEWAY_PASS "Your_Lora_Gateway_PASS"
// Put here your frequenci sub-band of lora gateway
#define GATEWAY_SUB_BAND "1"
Ubidots loraClient;
@ubi-gists
ubi-gists / Send-data.js
Created June 21, 2016 21:00
How to send data to MultiTech MultiConnect Conduit
// Single value
"Variable_Name:Variable_value"
// Multiple values
"Variable_Name_1:Variable_value_1,Variable_Name_2:Variable_value_2,Variable_Name_3:Variable_value_3"
[{"id":"e7d65ffe.dc95b","type":"tcp out","host":"translate.ubidots.com","port":"9010","beserver":"client","base64":false,"end":true,"name":"","x":692,"y":304,"z":"7ee6d1fa.eba47","wires":[]},{"id":"5373d534.c169dc","type":"debug","name":"","active":true,"console":"false","complete":"true","x":716,"y":213,"z":"7ee6d1fa.eba47","wires":[]},{"id":"5cd55ff8.a58da","type":"function","name":"Function Ubidots","func":"var TOKEN = \"Your_Token_Here\";\nvar USER_AGENT = \"mDot/1.0\";\nvar dsTag = msg.eui.split(\":\");\nvar DATA_SOURCE_TAG = \"\";\nfor (var j = 0; j < dsTag.length; j++) {\n DATA_SOURCE_TAG += dsTag[j];\n}\nvar data = {};\n\n// Header\ndata.payload = USER_AGENT+\"|POST|\"+TOKEN+\"|\"+DATA_SOURCE_TAG+\"=>\";\n\n// Body\ndata.payload = data.payload + msg.payload;\n\n// Footer\ndata.payload = data.payload + \"|end\";\nreturn data;","outputs":1,"noerr":0,"x":448,"y":212,"z":"7ee6d1fa.eba47","wires":[["e7d65ffe.dc95b","5373d534.c169dc"]]},{"id":"276173d.05dd28c","type":"lora in","name":"","datatype":"utf8"
// This #include statement was automatically added by the Particle IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"
// This example is to save multiple variables to the Ubidots API with TCP method
#include "Ubidots/Ubidots.h"
#define TOKEN "xxxxxxxxx" // Put here your Ubidots TOKEN
[{"id":"1dc93aec.27a665","type":"mqtt-broker","z":"5600d8f5.a42228","broker":"things.ubidots.com","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"bf41b1b8.c3d03","type":"mqtt out","z":"5600d8f5.a42228","name":"","topic":"","qos":"1","retain":"","broker":"1dc93aec.27a665","x":524,"y":292,"wires":[]},{"id":"d5607a01.4326a8","type":"bbb-analogue-in","z":"5600d8f5.a42228","pin":"P9_39","topic":"","breakpoints":[{"input":0,"output":0,"mutable":false},{"input":1,"output":1,"mutable":false}],"averaging":false,"name":"Analog Pin 0","x":366,"y":261,"wires":[["f8cbc76e.347e68"]]},{"id":"964042fa.b6bb8","type":"inject","z":"5600d8f5.a42228","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"4","crontab":"","once":true,"x":220,"y":261,"wires":[["d5607a01.4326a8"]]},{"id":"f8cbc76e.347e68","typ