Categories
Community

IoT and MQTT for Software Developers

“Developers who stop learning get left behind. However, the ones that grow and expand with trends always eat well.”

Kudzai Manditereza

The technology landscape is evolving, with the Internet of Things (IoT) leading the charge. IoT is transforming the way we live and work, with billions of devices generating massive amounts of data. As a software developer, it is essential to stay on top of this trend and understand the opportunities and challenges presented by this new technology.

In this three-part series, we will breakdown IoT,  MQTT, which is the defacto standard protocol powering IoT, and wrap the series up with a practical step-by-step demonstration you can follow to try IoT yourself. 

If we do our job right, at the end of this first article you will be inspired to dive deeper into IoT, and see how you can add it to your arsenal of skills. At minimun, you will be able to define IoT fundamentals, understand its components and the impact this has on software development. Additionally, we will explore the potential benefits and the challenges you may face when working with this technology.

Demystifying IoT: A Simple Definition (for Software Developers)

IoT can be a complex and often confusing topic, but it doesn’t have to be. At its core, IoT refers to the network of physical objects that are connected to the internet and can exchange data with one another. These objects, or “things,” can be anything from household appliances and wearables to industrial machinery and smart city infrastructure.

To understand IoT, it’s important to break it down into its components. An IoT system typically consists of three main components: sensors, connectivity, and data analytics. 

Sensors 

Sensors are crucial in IoT systems; they serve as the primary data collection points. They bridge the gap between the physical and digital worlds by converting real-world information such as temperature, humidity, and motion into digital information. Sensors enable IoT systems to monitor, measure, and respond to various parameters by detecting changes in the environment or devices.

Connectivity 

As stated, the primary goal of data collection from sensor devices is to share the data with other devices and data analytics applications in the network. Connectivity is the communication infrastructure that allows these devices and applications to communicate and exchange information, e.g, Wi-Fi or Bluetooth. 

In addition, for devices to make sense of the shared information, they must use a standard communication protocol. Examples of IoT communication protocols include HTTP(S), which most software developers already use, AMQP, CoAP, and MQTT, which has become the defacto IoT standard protocol. We discuss MQTT in detail in Part 2 of this series.

Data analytics 

Data analytics platforms, which are usually cloud-hosted, enable the transformation of typically vast amounts of data collected from sensors/devices into valuable information and actionable insights. The capabilities of Data Analytics platforms range from simple visualization for remote monitoring to identifying patterns, trends, and correlations within the collected data, and advanced machine learning-based use cases. 

Application of Internet of Things (IoT)

To give you a sense of what IoT looks like in the real world, below is a list of the use cases in the Commercial, and Industrial sectors.

  1. Smart Retail: IoT can be used to create personalized shopping experiences through digital signage, targeted promotions, and smart shelves that detect low inventory levels.
  2. Building Automation: IoT can enable commercial buildings to become “smart,” with automated lighting, heating, ventilation, and air conditioning (HVAC) systems that respond to occupancy and environmental conditions, improving occupant comfort and reducing energy costs.
  3. Smart Agriculture: IoT can be used to monitor crop conditions, soil health, and weather data, enabling farmers to make data-driven decisions about irrigation, fertilization, and pest control, ultimately increasing crop yields and reducing resource waste.
  4. Wearable Payments: IoT devices like smartwatches and fitness trackers can be integrated with payment systems, enabling users to make contactless payments without the need for physical cards or cash.
  5. Predictive Maintenance in Manufacturing:  By collecting and analyzing industrial equipment data, potential issues can be detected early, helping to prevent unexpected equipment failure, reduce downtime, and extend the lifespan of machinery.

Hardware Platforms for IoT Application Development

To start building an IoT application, you will need a device that provides a physical interface to sensors, allows you to write and deploy code to acquire data from those sensors, establish connectivity to the internet, and publish the data for analytics in the cloud.

Device platforms commonly used to develop and prototype IoT applications include Raspberry Pi, Arduino, ESP32, BeagleBone, and others. The selection of an IoT device platform is mostly influenced by each platform’s capabilities for prototyping different features or products. For example, some devices only support WiFi connectivity requiring you to plugin additional hardware for cellular connectivity. Some platforms can host a full operation system for executing multiple general-purpose tasks, while others are built to execute one specific task. 

Developing Software for IoT Applications

To develop software for IoT devices, you need to have a good understanding of the hardware and networking technologies involved in IoT. As a developer, there is a good chance you are already familiar with programming languages used in IoT development, such as C, Java, and Python. IoT solutions can be programmed using a variety of languages, depending on the specific needs of the project. Programming languages commonly used in IoT development at different levels of the technology stack include C, Python, Java, JavaScript, NodeJs, and C#:

Similar to other projects, developers should choose a language that is suitable for the hardware and software components of the IoT system, as well as the data analysis and visualization requirements.

Using Software Libraries for IoT App Development

As with any software project, leveraging software libraries can make the process significantly easier and efficient. In IoT, libraries can help manage the following:

  • Data gathering from common sensors on the market
  • Controlling common actuators such as motors
  • Communication protocols, 
  • Data processing
  • Security features

To use these libraries, developers need to first identify the appropriate ones for their project requirements, such as the protocol stack (e.g., MQTT, CoAP, Zigbee), device platform (e.g., Arduino, ESP32, Raspberry Pi), and cloud services (e.g., AWS IoT, Azure IoT, Google Cloud IoT).

Here’s an example of code in Python that might be used in an IoT system using a Python library for an MQTT Client. The code shows how to connect an IoT device to an MQTT messaging server and subscribes to receive messages of interest that are being sent to the same server by other IoT devices. 

import paho.mqtt.client as mqtt
# Set up MQTT client
client = mqtt.Client()
client.connect("broker.hivemq.com", 1883, 60)
# Define callback function to handle incoming messages
def on_message(client, userdata, message):
    print("Message received: " + message.payload.decode())
# Subscribe to topic
client.subscribe("iot/devices/sensor1")
# Start the MQTT client loop
client.loop_start()
# Continuously listen for incoming messages
while True:
    pass

As previously mentioned, developers can create IoT applications able to interact with physical devices, gather data from sensors, and even automate tasks. IoT development involves a combination of software development, hardware design, and networking, so developers need to be well-versed in all these areas to create effective IoT applications.

IoT Software Development: Similar But Different

 The software for IoT differs from traditional software in several ways:

  1. Resource constraints: IoT devices often have limited computing power, memory, and storage compared to traditional computing devices. As a result, IoT software must be designed to use resources efficiently and effectively.
  2. Real-time requirements: Many IoT applications have real-time requirements, meaning that data must be processed and analyzed quickly, often in milliseconds or less. This requires a different approach to software design and development.
  3. Distributed nature: IoT systems often involve many interconnected devices that must work together to accomplish a task. This requires a distributed system architecture and a focus on communication and coordination between devices.
  4. Security: IoT devices connect the internet to the physical world, and security breaches can have life-threatening consequences. Therefore, IoT software must be designed with security in mind, including data encryption, access control, and secure communication protocols.
  5. Heterogeneous environment: IoT devices can run on a variety of hardware and software platforms, which can make software development and deployment more complex. Developers must be able to work with a wide range of platforms and technologies.

Understanding these differences, as well as IoT components, allows you to leverage each of their powers and create innovative and impactful applications that improve people’s lives and transform entire industries.

An example of a possible career path in IoT is IoT Engineer.  An IoT engineer is a professional who specializes in designing, developing, and maintaining Internet of Things (IoT) systems. They are responsible for creating the software and hardware components of IoT systems and ensuring that they work together seamlessly to achieve the desired results.

Conclusion

Overall, learning about IoT can be challenging, but it’s also gratifying. By following these steps and staying dedicated to your learning journey, you can develop the skills and knowledge you need to succeed in this exciting field.

We encourage software developers to explore IoT and take advantage of its new opportunities. By collaborating with other experts in the field, leveraging open-source technologies, and continuously learning new skills, you can make a significant impact in the world of IoT and contribute to building a more connected and sustainable future.

So what are you waiting for? Start exploring IoT today and unleash your potential as a software developer! 

Now that you know all about IoT, in part two of this series we are going to introduce you to MQTT, a technology that has become the defacto standard of data movement in IoT with applications spanning from Facebook Messenger, Connected Cars, Connected Factories, Wearables, and Home Automation etc. 

Categories
News and Resources

News round up – Razer launches new fund for VR & gaming start-ups

Welcome to DeveloperEconomics’ weekly news roundup. In this edition, Blackstorm raises $33.5m for a ‘post-app store”, Razer launches a new fund for VR and gaming start-ups and Kony releases a new survey on the challenges of wearable development. Read on for the full news rundown.

Blackstorm raises $33.5m for ‘post-app store’ platform

Blackstorm has raised $33.5 million for what it calls a “post app store” solution, letting developers share apps outside of typical store fronts. Blackstorm offers a universal IDE designed to create apps that are shared across different distribution channels, such as messaging apps and mobile browsers. The company says its goal is to power “the infrastructure to trade and distribute software to all the post app-store platforms.”

Aruba announces platform to accelerate enterprise IoT adoption

HP’s Aruba has released the Aruba Mobile First platform, which aims to build a dev eco-system around its ArubaOS operating system. Aruba says the platform, which incorporates ArubaOS 8, lets third party devs quickly improve apps or create new ones based on its wireless networking technologies. The platform also collects data from IoT and mobile devices and customises networking functions dynamically in real time.

Google issues Nougat security update

Google has released a security update for Android Nougat. The update fixed a vulnerability that could enable remote code execution on an affected device. However, Google added that it’s had no reports of active customer exploitation or abuse of the fixed issues.

Korean firms consider legal action over Apple’s API policy

A group of Korean financial tech firms are reportedly launching a complaint to state regulators against Apple’s closed API policy around NFC functions. The companies complain that Apple is blocking providers such as Samsung Card and BC Card from accessing the NFC features. A similar complaint was previously lodged by Australian banks with regulators in the country.

PerfectlySoft releases Perfect 2.0 framework for Swift 3.0

PerfectlySoft has released the latest version of its server-side development framework for Swift 3.0. Perfect 2.0 features support for additional datasources, such as Redis and Filemaker, as well as “significant” performance and scalability enhancements. The company says Swift is “evolving extremely rapidly” and its framework helps developers keep up with the changes.

AWS SDK for C++ now available for production use

Amazon has released version 1.0 of its AWS SDK for C++. The SDK has received a number of improvements following developer feedback, including an improved Transfer Manager and symmetric cryptography support. The SDK also now follows semantic versioning so devs can upgrade within the 1.x series without breaking their build.

InfluxDB version 1.0 releases

InfluxData has released version 1.0 of its InfluxDB open-source time-series database. Influx DB was written in the Go programming language and is already being used by companies to monitor network infrastructure, security, container infrastructure, solar panels, and more. InfluxData says the database has been in development for nearly three years.

Box releases updates to attract more developers

Storage platform Box has released a series of updates aimed at developers. The platform now supports annotations, watermarking and new content types. Devs using the JavaScript SDK can now benefit from HD video, 3D models, VR files and 360-degree content. Box is also releasing a UI Kit that makes it easier to integrate elements into their web apps.

MySQL 8.0.0 Milestone Release is available

MySQL have announced that their 8.0.0 milestone release is now available for download. In their blog post, the engineers have outlined the most significant changes, some of which address problems that have plagued MySQL. The source code is available at GitHub.

Razer launches $30m fund for VR, IoT and gaming start-ups

Gaming hardware company Razer has launched zVentures, a new fund for investing in start-ups focused on gaming, VR, robotics and IoT. Razer is looking to fund early-stage start-ups with investments ranging from $100,000 to $1 million. The fund is based out of San Francisco and Singapore.

Survey highlights top challenges around wearables development

Kony has released a new survey looking at the challenges around developing apps for wearables. According to the survey, wearables will be “commonplace” in the enterprise by 2020 and 78% of devs surveyed said they are working on 2 wearable apps or more. Forty percent said the lack of communication between designers, stakeholders and developers is the biggest challenge for wearable development.

 

Categories
Business

How We Learned to Built Hardware, the Agile way

I ‘m part of a hardware research group at Telefónica Digital called “Physical Internet Lab”. Three years ago we started a small group under the Emerging Technologies area of the company focusing on the Internet of Things. The commitment of the group was (and is), in ambitious terms, “to democratize the Internet of Things” opening it to as many makers, developers and users as possible. Our goal has been not entirely altruistic: Telefónica as a network operator has a lot of value to add in the Internet of Things economy.

On day to day basis we build prototypes and products, usually connected objects or components like the Thinking Things building blocks.

Setting up the lab three years ago was no easy task. We wanted to work at the crossroads of the Internet, the Things and the People. But our development skills were almost 100% software related. In the process we built a team skilled on all three sides. And we figured out how to do agile hardware.

agile-hardware

Of Agility and Hardware

We ‘ve come full circle. Telefónica I+D (the Telefonica Digital development branch) was created 25 years ago to produce hardware innovations such as X.25 and ATM switches. We did that in the classical engineering fashion: writing long and rigid lists of requirements, splitting the work across solution providers, integrating and then testing following a waterfall schema.

Over time Telefónica I+D adapted quickly to the technology changes and by the mid-nineties we were developing mostly software. First we followed the same engineering process; then we moved towards more iterative methods. In the last 10 years we have adapted fully to agile methodologies.

As we were building the laboratory we found ourselves getting back to hardware. But the company now could not understand a slow-moving unit. The lab had to be agile. So we had to bring agile methodologies to hardware development.

The first difficulties came with the corporate facilities. Hardware work demands physical proximity and we could not afford to have a distributed team depending on collaboration tools on the Internet. At the same time, soldering fumes or drilling noises were not welcome in our modern, bright, open spaces. So the team had to move to a closed office in an old building in Madrid city center.

Moving to the city center was a boon: in minutes we could reach many shops and services, buying anything from hammers to plastic boxes. Visitors now found it easier to visit us in a centric garage-like office. This was great for our open approach as we wanted to help and interact with other companies and organizations.

Purchasing tools was another problem. The corporate procedures were tuned for large-scale purchases such as server farms or external services. Buying a handful of resistors for 10 euros could take several weeks, creating bottlenecks to our work. Fortunately the purchasing department showed a great deal of sensibility. We worked together to redesign the process. Now we buy any component or tool in a single day while still working by the book.

Putting together the Agile team

Hardware work implies multiple teams across several companies with extremely specialized profiles. When setting up the lab we opted for a small and autonomous team, able to build a hardware prototype with no external dependencies.

A small team allows us to work closely integrated, in the same location, continuously coordinating our work. A small team also means that budgets are smaller and is well suited to experimenting, failing, learning and adapting.

Basic agile methodologies such as Scrum expect some degree of overlap between the specializations of team members, so that different people can execute the same tasks naturally balancing the work load. But hardware work is different. It demands a lot of specialization. In our case most of the tasks can be executed only by one team member. As a result, the Scrum methods and tools have to be modified to reflect this reality.

Our internal workflow follows many steps. The first step is the Industrial Designer, a role which is somewhat of a novelty in the Telefonica Digital payroll. Carlos (that’s his name) starts his work in the CAD station designing the physical product: plastic pieces, metal straps, cloth, magnets. Then he builds the design using the currently available 3D prototyping tools such as the laser cutter, the CNC tool (i.e. a computer controlled drill) and a variety of 3D printers. These tools give much flavor to the lab.

In some cases we start from an existing object that we hack so that we can explain a new concept. Carlos at the same time designs and builds, which is a bit out of his job profile. Software developers are multi-taskers, too – they design and type, while software architects can also code. In the hardware industry this is somewhat unusual and typical engineers expect someone else to physically build what they have created. In the lab we follow the software philosophy. It is leaner, and gives the designer a real feel of the piece or circuit construction. This approach demands some tolerance and patience from engineers who have to get their hands dirty.

The same philosophy applies to the next step in the workflow: the electronics engineering part. The electronics engineer first designs new circuits, then prototypes them. We even design and build the PCBs to check that everything fits in place.

The agile doctrine underlines the importance of early user testing. Early use provides rapid feedback focusing the most important characteristics of the product and showing what isn’t relevant for customers. To shorten the time-to-test we use 3D printing and prototyping technologies.

In electronics engineering we massively use Open Hardware. Open Hardware gives us access to lots of ready-to-use designs that we can employ in product testing. In a sense, Open Hardware behaves now like Linux and Open Software in the mid-nineties. It allows us to focus on the real technical or design challenge rather than reinventing the wheel for every test.

Electronics and physical design teams work side by side, so they can verify in real time how components fit in the same object. Our objects become more than simple plastic boxes, as they are tightly coupled with the internal electronics.

Electronics engineers work also with the firmware developers. The firmware developers write the code for the embedded microprocessors. They also have to deal with connectivity issues and power management.

In our Physical Internet Lab, electronics and firmware engineers work side by side. In most situations knowing what will firmware do simplifies hardware design. Similarly, software developers can ask for fine changes in the hardware designs nearly in real time.

On the other side of firmware sits backend development. In our typical systems architecture, distributed devices communicate with a backend service in the cloud. We push as much intelligence as possible to the backend service, so our designs can evolve without touching the deployed hardware or executing firmware updates. We like to think that the back-end gives every object nearly infinite computing power and knowledge, as it can interact with any other Internet service.

Again back-end and firmware developers work side by side. This tight collaboration resolves any integration problems before they appear, and encourages electronics and firmware developers to take issues to the more powerful (and more agile) back-end platforms.

The final technical step is the front-end development, usually based on web and native apps. Again we do a lot of work locally in the lab, well integrated across the team.
The frontend is also tested in complete end-to-end scenarios. Automatic testing tools execute scripts that run against the firmware and the frontend.

And of course, there is a Quality Assurance side. We are extending continuous integration, test driven development and automatic testing to the embedded firmware. At the same time we have to handle more hardware specific tasks such as sensor calibration, assuring robustness and strength.

Physical Interaction Design

The web/application interface and physical design are the two endpoints of the “development chain” of our group. They form the two interfaces exposed to the final user. At the final part of our workflow, the physical interaction designer, works with both web / app and physical design.

The physical interaction designer is responsible for the design of the connected object as a whole. He takes care of building a single object with a coherent interaction model in the physical world and in the Internet.

Without the physical interaction designer we would have to separately design the physical object and the application or web interface. The result would be a split-personality product, usually an amalgamation of data stuck on top of a square box. The physical interaction designer combines the capabilities of the physical object and the Internet interface in a coherent manner.

Physical interaction design, bringing together the Internet and physical objects is a completely new field. There are a handful of specialized schools in the world, and we are working too with UX designers with strong industrial design background.

Everyday physical objects have usually long stories and designs optimized through centuries of use. We still have a lot to learn on how to take the Internet beyond of the smartphone/tablet/PC onto this physical object world. Customers will not adopt Internet of Things devices if they are a step behind of the design standards they have become accustomed in software interfaces.

Agility plays a role here, once again. Developing and prototyping quickly we can try interaction designs with users, test our assumptions and build a sizeable bunch of knowledge around user interaction with connected objects.

External providers

Of course we have to work with external providers, especially when dealing with complex technologies or industrialization. For development we often use online services for as PCB manufacturing or 3D printing. They are extremely easy to use, robust, fast, and offer a direct web interface instead of long negotiations with a salesperson.

For the final manufacturing we interact with real, serious manufacturers. Agile, as a software development doctrine has no solutions to this task. But Agile can be seen as a spin-off of Lean philosophy, which was created to deal specifically with manufacturing issues.

One of the main lessons from the Lean methods is that service providers have to be tightly integrated in the business process. We have found this is very important also for us. The lab has spent considerable efforts building trust relationships with service providers and manufacturers, integrating their teams with the lab. Schedules and plans are shared under an openness philosophy. We have established even real time communication so their teams get continuous feedback from the engineers in the lab.

The future of agile hardware

We have yet a long way to create a truly Agile Hardware lab. Physical work is sometimes slower than software development. Some other times (especially when prototyping on Open Hardware designs) they are blindingly fast and have to pause and wait for software components. Speed differences keep the group working on different “user stories” at the same time.

External dependences are many, and the lab will never be, in that sense, completely autonomous. But we can find yet faster service providers and build leaner and more integrated workflows with them.

Regarding Quality Assurance we have to handle correctly the physical device characterization and fit the expensive and slow certifications in the product workflow.
The bright side is that Agile methodologies provide and require continuous improvement. Every sprint or work cycle forces us to learn and adapt our methodology and organization, looking for a better process. Perhaps in a couple of years we’ll have a completely different process in a completely different lab, and it will be all right.