Implementing an IoT Network Using Only JavaScript
This article provides briefly explains how embedded software developers can build an Internet of Things (IoT) network using JavaScript on Alibaba Cloud's IoT platform. This tutorial is ideal for developers with front-end experience, who typically prefer JavaScript over C and Java.
Overview
This example uses Developer Kit (with AliOS Things ported) as the development hardware to implement data uploading from a board-mounted temperature sensor to Link Develop, and uses Web App for demonstration.

Development Process
Configuring the Environment
AliOS Things is an IoT-oriented and highly scalable IoT operating system under developed by Alibaba Cloud's IoT team. To meet front-end developers' requirements, AliOS Things integrates BoneEngine, a Java engine that supports JavaScript for IoT development, which was previously only implemented in C and C++. Meanwhile, BoneEngine simplifies the syntax, allowing embedded devices with limited resources to run JavaScript applications as well.
You need to configure the environment before you use BoneEngine to perform device-side development. The configuration steps are shown as follows:
- Install Node.js (version 6.4.0 or later; for front-end development, version 8.9.0 or later is recommended).
- Install the be-cli tool to provide support for updating app.bin via serial port or over the network:
npm i be-cli -g -P. If you are still prompted that the command cannot be found even when you runbeafter the preceding global installation is done, run thenpm prefix -gcommand to get the module installation path of Node.js, and then simply add the global installation path in the output to the "Path" entry of the environment variable. - (For Windows users only) Install Python, Visual Studio, and the AliOS plug-in. Then install Hardware USB driver.
- Install Git and download AliOS Things source code:
git clone git@github.com:alibaba/AliOS-Things.git.
Now that the environment is configured, we are ready to begin development.
Developing on the Cloud
We will be using Link Develop to set up our IoT network on Alibaba Cloud. Choose Create Project (you may name it as you want) > Device Development > Add Product. Select Other for the product type, select WiFi for the communication method, and select Alink for the data format.
Select Add Custom Features in Product Details and add the following features:

Choose Device Development > Add Debugging Devices, and take note of the device triplets.
Developing on the Device
Open the source code directory of AliOS Things in a compiler, open the AliOS-Things/framework/tinyengine/samples/app/lcd_shtc1_mqtt/device.js file, and change Three Device Elements to Device Triplets that you obtained before. Save your changes.
Use the terminal to compile the sample application: be -p samples/app/lcd_shtc1_mqtt.
Connect Developer Kit to a computer and run be connnect.
Burn the compiled bin file to the device: be push app.bin
Restart the device. After restarting, the device automatically loads and runs this file, and simultaneously uploads it to the Link Develop platform.

Developing in Web App
To help you get started quickly, here we use the visual creation feature of Web App integrated in the new version of Link Develop. All we need to do is drag the components of the hygrothermograph and connect to your data.

For experienced front-end developers, you should try using the Bone.js framework to perform hard core programing functionality. Again, it can be implemented using only JavaScript: https://bone.aliyun.com/bone-web/bonewebsdk.html?name=wpgl7p.
Conclusion
The mix of AliOS Things TinyEngine and Link Develop Bone.js allows front-end developers to quickly and seamlessly get started with IoT development, without having to learn other programing languages. This also represents the compatibility and originality of the Alibaba Cloud IoT Platform.
To learn more about Alibaba Cloud IoT Platform, visit www.alibabacloud.com/product/iot
Read previous post:
Read next post:
Comments
Related Products
-
IoT Platform
Provides secure and reliable communication between devices and the IoT Platform which allows you to manage a large number of devices on a single IoT Platform.
Learn More -
IoT Solution
A cloud solution for smart technology providers to quickly build stable, cost-efficient, and reliable ubiquitous platforms
Learn More -
Accelerated Global Networking Solution for Distance Learning
Alibaba Cloud offers an accelerated global networking solution that makes distance learning just the same as in-class teaching.
Learn More -
Global Internet Access Solution
Migrate your Internet Data Center’s (IDC) Internet gateway to the cloud securely through Alibaba Cloud’s high-quality Internet bandwidth and premium Mainland China route.
Learn More
More Posts by GXIC
- Using Service Subscription (HTTP/2) to Retrieve Device Status
- Using HTTPS to Access IoT Platform from a Device
- Usage Tips for the IoT Platform: Retrieving Device Status by Calling API Operations
- IoT Development Practices: Decoding a Cloud Solution
- How to Manage Control Instructions for Offline Devices through Device Shadow
- How to Identify Frequently Dropped and Constant Offline Devices among 50,000 Devices
- How to Analyze the Network Behaviors of IoT-enabled Devices Using Wireshark
- Alibaba Launches AliOS Things 3.0 at Apsara Conference 2019
- Taking a Go at Gateway and Sub-device Development
- Building a Simple Entry-Exit Monitoring System on Alibaba Cloud IoT Platform