• A selection of programming languages for IoT. Source: Devopedia.
    image
  • Popular languages for IoT by device types. Source: https://www.slideshare.net/IanSkerrett/iot-developer-survey-2017
    image
  • Popular languages for Edge, Gateway and Cloud . Source: https://www.slideshare.net/IanSkerrett/iot-developer-survey-2017
    image
  • Software Tool Chain: From Host to Microprocessor. Source: https://www.coursera.org/learn/iot/lecture/QRCsQ/lecture-2-2-compilation-and-interpretation
    image
  • IDEs and Tools for IoT. Source: Eclipse, Intel, Arduino, Raspbian, OpenSCADA, PlatformIO
    image

Programming for IoT

Summary

image
A selection of programming languages for IoT. Source: Devopedia.

Programming for IoT is usually a polyglot (multiple languages) effort since the Internet-of-Things (IoT) is a system of inter-related computing devices that are provided with unique identifiers and the ability to transfer data over a network. The choice of programming-language depends on the capability and purpose of the device. IoT encompasses a variety of devices including edge devices, gateways, and cloud servers.

Milestones

Nov
2005

International Telecommunications Union publishes the 7th in its series of reports on the Internet, titled “The Internet of Things.”

Oct
2013

IBM releases version 0.2.0 of Node Red, a visual wiring tool for IoT. In 2016, IBM contributes Node-RED as an open source JS Foundation project.

Nov
2013

Damien George launches MicroPython, a software implementation of the Python 3 programming language, written in C, that's optimized to run on a microcontroller.

Oct
2015

Lars Bak and Kasper Lund of Google announce the Fletch project for the Dart programming language to optimise it for Internet of Things (IoT) devices.

2016

Microsoft open sources P, a language designed for asynchronous event-driven programming, which it considers vital for the cloud, artificial intelligence and IoT.

Mar
2017

Team KinomaJS starts Moddable, a new company building tools for developers to create open IoT products using standard JavaScript on low cost microcontrollers. KinomaJS is a JS application framework optimised for IoT. KinomaJS was previouly supported by Marvell Semiconductor.

May
2017

Google makes Kotlin (JetBrains), a statically typed programmimg language for JVM, a first class language for Android Apps and its Android Things IoT Platform.

Mar
2018

Eclipse announces Mita, a language that aims to remove the entry barrier to embedded IoT development. Mita is transpiled to C code. It combines imperative programming with model-driven configuration.

Mar
2018

The Linux Foundation announces ACRN, an open source reference hypervisor project designed for IoT device development.

Discussion

  • What are the popular languages for IOT?
    image
    Popular languages for IoT by device types. Source: https://www.slideshare.net/IanSkerrett/iot-developer-survey-2017

    The most popular languages in IoT are Java, C, C++, Python, Javascript, Node.js, Assembler, PHP, C#, Lua, R, Go, Ruby, Swift and Rust in descending order of popularity. This is from a 2017 online survey co-sponsored by Eclipse IoT Working Group, IEEE IoT, AGILE IoT and IoT Council in which 713 individuals participated.

    Other languages include Parasail, Microsoft P, Eclipse Mita, Kotlin, Dart, MicroPython, and B#.

  • Which languages are suitable for edge devices, gateways and cloud computing?
    image
    Popular languages for Edge, Gateway and Cloud . Source: https://www.slideshare.net/IanSkerrett/iot-developer-survey-2017
    • Edge Devices - These are constrained-resource embedded systems. For very small devices (higher constraints), Assembly and C are the languages of choice. A better processor and more computing power on the device enables one to use C, Python, Node.js, Java. The focus is to minimize instruction count, and maximize execution speed and resource management.
    • Gateways - Gateways manage communication and do analysis of data from many devices through several different buses. More languages can be run on these devices because of their increased computing power, including C, C++, Java, Python, and Node.js.
    • Cloud - With the nearly unlimited computing capability that's available, frameworks like Apache Hadoop and HiveQL can compute and process large IOT datasets. Statistical computing and visualization can be done using languages like R or Julia.
  • What are the approaches used in IoT application development?
    • Node-Centric Programming - Every aspect is programmed by the developer like communication between nodes, collection and analysis of sensor data, issuing commands to actuator nodes. Interaction between devices is explicitly encoded.
    • Database approach - Every node is considered part of a database and the developer can issue queries to sensor nodes. Focus is on collection, aggregation and sending of data to the base station.
    • Macro programming - Abstractions are provided to specify high-level communication.
    • Model-driven development - Application development complexity is reduced by increasing the level of abstraction and by describing the system using different system views. The vertical separation of concerns(SOC) reduces app development complexity by separating platform-independent model (PIM) and platform-specific models (PSM). The horizontal separation of concerns separates different aspects of a system.
  • What are the features to consider when evaluating IoT programming frameworks?

    The following features are relevant:

    • Scalability - Programming frameworks that support diverse programming patterns that are able to perform load-balancing dynamically.
    • Concurrency - Real-time communication between millions of devices and applications mean millions of concurrent connections. Thread locking is not efficient in such situations.
    • Coordination - Programming language support for explicitly (control driven) or implicitly (data driven) orchestrating the role of computing elements.
    • Heterogeneity - Programming framework gives guidance on how computations are mapped to the computing elements.
    • Fault tolerance - Applications should be able to gracefully go from online to offline state as networks partition and heal their connections.
    • Light footprint - In terms of runtime overhead and in terms of programming effort the framework should be light.
    • Support for latency and sensitivity - In geographically distributed applications, pushing all computations to the cloud is not ideal. The programming framework has to handle these requirements dynamically.
  • What programming paradigms are suitable for IoT?

    A programming paradigm is a way to classify the programming language based on its execution model. It should be kept in mind that a particular language can below to more than one paradigm. The following programming paradigms are suited for IoT:

    • Functional - Functional programming helps solve the challenges of scalability and concurrency. Its preference for immutability, function composition, avoiding side-effects, less code, etc. avoid several IoT pitfalls.
    • Dataflow - Dataflow programming emphasizes the movement of data. It models programs as a series of connections. Explicitly defined inputs and outputs connect operations. An operation runs as soon as all of its inputs become valid. Dataflow languages are inherently parallel and can work well in large decentralized systems.
    • Event-Driven - Event-driven programming (events triggered by sensors, connectivity, or time) is well suited to IoT where devices spend most of their time in power-saving modes, wake up due to some event, process data, send it out, and go back to sleep.
  • Are there any specific requirements that the languages should satisfy to be used for IoT?
    image
    Software Tool Chain: From Host to Microprocessor. Source: https://www.coursera.org/learn/iot/lecture/QRCsQ/lecture-2-2-compilation-and-interpretation

    Developers can consider the following:

    • Languages that support Functional, Dataflow, or Event-driven programming.
    • Interpreted languages (Python) are slower than compiled ones (C/C++/Rust/Go).
    • Type safety, memory management, no null pointer exceptions. Languages such as C and C++ use explicit pointers to reference memory. Incorrect pointer calculations can lead to buffer overruns and memory access violations.
    • Availability of GPIO libraries.
    • Libraries that support IoT protocols like Advanced Message Queuing Protocol (AMQP), Constrained Application Protocol (CoAP), Extensible Messaging and Presence Protocol (XMPP), OASIS MQTT, or Very Simple Control Protocol (VSCP).
  • Within languages, are there any specific variants, modules or libraries that enables IOT?
    • In Python, "mraa" and "paho-mqtt" are useful for IoT.. MicroPython can be used on constrained devices.
    • Java first appeared in the 1990s for a resource-tight embedded environment, requiring minimum computing power. Many of the Oracle Java ME Embedded APIs are targeted at the needs of embedded systems.
    • Eclipse Mita is a new programming language designed to feel like modern programming languages in the vein of TypeScript, Kotlin, and Go. It helps scale from prototypes to commercial IoT deployments by transpiling to C code.
  • Could you share some best practices for IoT developers?

    Choose a programming framework that promotes design reuse, implementation reuse and validation reuse in order to enhance software extensibility, flexibility and portability. To make distributed IoT microservices resilient, developers should be able to specify precise sequence of execution steps to be taken by compiled code, regardless of the order in which asynchronous event messages are processed.

  • Could you list IDEs, debuggers and tools for IoT programming?
    image
    IDEs and Tools for IoT. Source: Eclipse, Intel, Arduino, Raspbian, OpenSCADA, PlatformIO

    IDEs and tools for IoT are many and we list some of them below:

    • Eclipse IOT project (Kura) - This is a Java-based development framework for IoT applications.
    • Arduino IDE - This IDE includes support for the C and C++ programming languages for programmable microcontrollers. It's a complete package with many examples and pre-loaded libraries.
    • Raspbian - This IDE comes with many packages and examples created specifically for the Raspberry Pi boards.
    • OpenSCADA - This project is a part of Eclipse IOT Industry Working Group along with Eclipse SCADA (Supervisory Control and Data Acquisition). It provides several libraries, interface apps, and configuration tools.
    • PlatformIO - This is a cross-platform IDE that supports over 400 embedded boards, and several development platforms and frameworks.
    • Macchina.io - This is a toolkit for building embedded applications for IoT using POCO C++ libraries and the V8 JavaScript engine. The core is implemented in C++. JavaScript is used for application development. It enables dynamically extensible modular applications using the plug-in and services model similar to OSGi in Java.

Sample Code

  • /* Source : https://www.elprocus.com/basics-and-structure-of-embedded-c-program-with-examples-for-beginners/ */
    /* A program to toggle P1.5 of 8051 microcontroller */
    #include<reg51.h>
     
    sbit a=p1^5;
     
    void main()
    {
      unsigned int k;
      a = 0x00;
      while(1)
      {
        a=0xff;
        for(i=0;i<255;i++);
        a=0x00;
        for(i=0;i<255;i++);
      }
    }

References

  1. Carle, Andy. 2015. "Language Matters: JavaScript, from IoT Product Concept to Production." Things Conference. December 9. Accessed 2018-06-12.
  2. Cleary, Corey. 2016. "Functional Programming as the Paradigm for IOT." June 12. Accessed 2018-06-11.
  3. Delgado, Rick. 2017. "Why Java is the Language of Choice for the Internet of Things (IoT)." KD Nuggets. May 1. Accessed 2018-06-10.
  4. GOTO. 2011. "Dart, a new programming language for structured web programming." GOTO Århus conference. October 10. Accessed 2018-06-11.
  5. GOTO. 2015. "GOTO 2015 - Internet of Programmable Things - Kasper Lund." Goto Conferences. October 21. Accessed 2018-06-11.
  6. Gaurav, Kumar. 2017. "Programming Internet of Things using Contiki and Cooja." Open Source For You. June 17. Accessed 2018-06-15
  7. George, Damien. 2013. "Micro Python: Python for microcontrollers." Kickstarter. November 13. Accessed 2018-06-11.
  8. Harris, Ian. 2017. “Lecture 2.2: Compilation and Interpretation”. Introduction to the Internet of Things and Embedded Systems. Accessed 2018-06-12.
  9. Hoddie, Peter. 2018. "Moddable." GitHub. March 23. Accessed 2018-06-12.
  10. Intel. 2017. "Selecting Programming Languages for the IoT." Intel. March 20. Accessed 2018-06-10.
  11. Intersog. 2017. "12 Popular Programming Languages For IoT Development In 2017." February 22. Accessed 2018-06-06.
  12. Kobielus, James. 2017. "How to write event-driven IoT microservices that don’t break." Infoworld. June 30. Accessed 2018-06-10.
  13. Krill, Paul. 2017. "Microsoft's P language is aimed at where cloud, AI, and IoT meet." Infoworld. May 23. Accessed 2018-06-10.
  14. Krishnamurthy. 2016. "Chapter 5 Programming Frameworks for Internet of Things." Internet of Things: Principles and Paradigms by Elsevier Page 91-98. Accessed 2018-06-11.
  15. Lardinois, Frederic. 2017. "Google makes Kotlin a first-class language for writing Android apps." TechCrunch. May 18. Accessed 2018-06-11.
  16. Linux, Foundation. 2018. "The Linux Foundation Announces an Open Source Reference Hypervisor Project Designed for IoT Device Development." The Linux Foundation. March 13. Accessed 2018-06-10.
  17. NI. 2007. "Why Dataflow Programming Languages are Ideal for Programming Parallel Hardware." Multicore Programming Fundamentals Whitepaper Series. National Instruments Corporation. November 1. Accessed 2018-06-11.
  18. O'Leary, Nick. 2013. "Version 0.2.0 released." Node Red. October 16. Accessed 2018-06-10.
  19. Patel, Pankesh. 2015. "Towards Application Development for Internet of Things." ABB Corporate Research, India. Slide 10 - 15. August 10. Accessed 2018-06-15.
  20. Press, Gil. 2014. "A Very Short History Of The Internet Of Things." Forbes. June 18. Accessed 2018-06-10.
  21. Ritter, Simon. 2013. "Top Ten reasons for using Java in Embeded Apps." Java Magazine. January 1. Accessed 2018-06-10.
  22. Saket. 2018. "5 Best Development Software(IDE) for Internet of Things (IOT) in 2018." January 14. Accessed 2018-06-13.
  23. Sharma, Archana. 2016. "The Most Popular IoT Programming Languages Today." January 22. Accessed 2018-06-10.
  24. Simone, Sergio De. 2016. "Microsoft Open-Sources P Language for Safe Async Event-Driven Programming." InfoQ. October 1. Accessed 2018-06-10.
  25. Skerrett, Ian. 2017. "IoT Developer Survey 2017." Eclipse Foundation. April 18. Accessed 2018-06-11.
  26. Slant. 2018. "What are the best programming languages for IoT (Internet of Things)?" Accesed 2018-06-10.
  27. Sola, Rajesh. 2017. "Open Source Software You can use for IoT Development." Open Source For You. September 20. Accessed 2018-06-15.
  28. Vrat, Satya. 2017. "IoT with Python : Essential Packages." February 12. Accessed 2018-06-10.
  29. Weichel, Christian. 2018. "Introducing Eclipse Mita - A Language for Embedded IoT." Eclipse Newsletter. March 1. Accessed 2018-06-10.

Milestones

Nov
2005

International Telecommunications Union publishes the 7th in its series of reports on the Internet, titled “The Internet of Things.”

Oct
2013

IBM releases version 0.2.0 of Node Red, a visual wiring tool for IoT. In 2016, IBM contributes Node-RED as an open source JS Foundation project.

Nov
2013

Damien George launches MicroPython, a software implementation of the Python 3 programming language, written in C, that's optimized to run on a microcontroller.

Oct
2015

Lars Bak and Kasper Lund of Google announce the Fletch project for the Dart programming language to optimise it for Internet of Things (IoT) devices.

2016

Microsoft open sources P, a language designed for asynchronous event-driven programming, which it considers vital for the cloud, artificial intelligence and IoT.

Mar
2017

Team KinomaJS starts Moddable, a new company building tools for developers to create open IoT products using standard JavaScript on low cost microcontrollers. KinomaJS is a JS application framework optimised for IoT. KinomaJS was previouly supported by Marvell Semiconductor.

May
2017

Google makes Kotlin (JetBrains), a statically typed programmimg language for JVM, a first class language for Android Apps and its Android Things IoT Platform.

Mar
2018

Eclipse announces Mita, a language that aims to remove the entry barrier to embedded IoT development. Mita is transpiled to C code. It combines imperative programming with model-driven configuration.

Mar
2018

The Linux Foundation announces ACRN, an open source reference hypervisor project designed for IoT device development.

Tags

See Also

Further Reading

  1. Buyya, Rajkumar. 2016. Internet of Things: Principles and Paradigms. Morgan Kaufmann (Elsevier).
  2. Soldatos, John. 2016. Building Blocks for IoT Analytics. River Publishers.
  3. Beal, Jacob. 2015. Aggregate Programming for the Internet of Things. Computer.org

Top Contributors

Last update: 2018-06-20 10:22:46 by arvindpdmn
Creation: 2018-06-13 04:09:02 by arjun

Article Stats

1467
Words
0
Chats
2
Authors
10
Edits
3
Likes
1926
Hits

Cite As

Devopedia. 2018. "Programming for IoT." Version 10, June 20. Accessed 2018-11-14. https://devopedia.org/programming-for-iot
BETA V0.17.1