LinkIt Smart 7688 Duo

LinkIt Smart 7688 Duo is an open development board based on MT7688 and ATmega32u4. This board is compatible with YUN sketches, Smart Duo has an OpenWrt Linux distribution. In this tutorial you will learn how to connect a LinkIt Smart 7688 Duo to the Ubidots API cloud.

Requirements

This tutorial is for Windows if you have another distribution please go to this Link

Setup

On Windows

  1. Download and install PuTTY.
  2. Install Bonjour.
  3. Install driver. If you are using a USB cable based on FTDI chip please download and install its driver from here.If you are having problems with the latest driver, try installing an older version here.
  4. Now connect the USB to TTL adapter to the LinkIt Smart:

USB to TTL - LinkIt Smart
RX - 8
TX -  9
GND - GND 

5. After connecting the Serial to USB cable, open the device manager and notice the COM port number. This number may vary on different computers.

6. Launch the PuTTY terminal and enter the COM port number of the USB device found in the device manager, click on the Serial radio button, type 57600 in Speed box and click Open.

7. To exit the system console, click the close icon on top right of the PuTTY windows.

Installing developed board support package

LinkIt Smart 7688 development board is a plug-in to Arduino IDE and you will need to install the board package so that Arduino supports LinkIt board.

Publish variables

Create a file with vim called program.js. Paste the following code to publish. For save the code -> escape, digital “:qw” entrer

Step one: Type this into your terminal to install and update

opkg update
opkg install node
npm install mqtt --save

Step two: Copy the code

setInterval(function() {
var variablesPublish = {"temperature": 10, "humidity": 50};
var json = JSON.stringify(variablesPublish);
client.publish("/v1.6/devices/linkit", json, {'qos': 1, 'retain': false},
   function (error, response) {
       console.log(response);   });
}, 1000);client.on('message', function(topic, message) {
   console.log(message.toString());});

Subscribe to a variable

var mqtt = require('mqtt');var client  = mqtt.connect('mqtt://things.ubidots.com', {username:'CCN8FrVulRYGulPTkbaiR9Myx8qN2o', password:""});client.subscribe({"/v1.6/devices/linkit/temperature/lv": 1}, function(err, granted) {
 console.log(granted);
});
Did this answer your question?