Introduction: Build a Remote Control Tank on Cloud Using LinkIt 7688

Hello everyone!

Have you ever wanted to build and drive around a tank that built by your self? I bet yes.

Without a lot of skill and equipement required, let's start to build one today and connect it to the cloud and control it from anywhere.

Step 1: Items Needed

a. A LinkIt Smart 7688 Duo development board

b. a RC car (Yup! we made a 3D printing Minions to ride on the car!)

c. a L289 driver

Step 2: Hands on to Build the RC Car and Connect It With LinkIt 7688 DUO

Now, let's follow the manul to build up the RC car and connec the driver and LinkIt 7688 on it.

Here is what I connect the LinkIt Smart 7688 DUO and the driver, the four pins on L298N should be connected to the D2, D3, D4, D5 pints on LinkIt Smart 7688 Duo.

Step 3: Create a Prototype for RC Tank on MCS Cloud

I believe some of you already know the convinience the MCS free cloud provided.

Login to your MCS account.

Click Development on the top menu bar, and click Prototype. Enter the prototype information as you wished and Save.

Step 4: Add a Gamepad Data Channel

After the prototype is created, add a gamepad data channel.

Click Add, and select Controller.

Enter the information for the video stream data channel. Please make sure the data channel ID is Gamepad which we will need it later when compiling the Node.js code. (You can change the data channel ID as you wish, but you will need to replace the ID in the sample Node.js code I will provide later in Step 6.)

Select the data type as Gamepad. And Save.

Step 5: Create a Test Device

After adding the data channel, now create a test device. This test device is just like your development board. When your development board is connected to MCS, you can received data from your development board and also give command to your device as well.

Here you need to keep the deviceId and deviceKey which is unique for each device. You will need them when calling MCS RESTful APIs in the code on your development board later in Step 6.

Step 6: Prepare the LinkIt Smart 7688 Development Board

a. Make sure the 7688 development board has been switched to station mode and connect to the same network as your computer successfully.

b. Connect to the console of 7688 development board through ssh command on your computer.

ssh root@mylinkit.local

c. Create a folder using the following command:

mkdir app && cd app && npm init

d. Install Node.js package on the 7688 development board.

npm install mcsjs

e. Create a file called app.js using an editor, vi is used in this example:

vim app.js

f. Type i and copy/paste the following code in the editor. Please remember to replace the deviceId, deviceKey and dataChnId to the real values.

<p> var mcs = require('mcsjs');<br>
  // regist your device to mcs.
  var myApp = mcs.register({
  deviceId: 'Input your deviceId',   // Input your deviceId.
     deviceKey: 'Input your deviceKey', // Input your deviceKey.
  });</p><p>  var SerialPort = require("serialport").SerialPort;
  var serialPort = new SerialPort("/dev/ttyS0", {
      baudrate: 57600
  });</p><p>  // communicate with Arduino chip (32U4).
  serialPort.on("open", function () {
      // listen the mcs command.
      myApp.on('gamepad', function(data, time) { // gamepad is your datachannel.
          serialPort.write(data); // send message to Arduino chip.

g. Type :wq to save and exit.

Step 7: Run Your Application Drive the RC Tank Around.

You are now ready to execute the Node.js program. In the system console, type the following command:

node app.js

Go back to MCS console, click Development on top menu bar, and click test device.

Go to the test device you just created.

You will see the gamepad data channel which is the control pad for you! Use your android mobile to download the MCS app, then your phone is now the control pad which is very simple and convinient. With the gamepad data channel, you can build RC tank, robot, control cam, and many more!

That is all for today, I will see you next time =)