DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. Big Data
  4. Dos and Don'ts for IoT Development

Dos and Don'ts for IoT Development

Want to learn more about the dos and don'ts for IoT development? Check out this post where we specifically explore REST APIs and connected IoT devices.

Alexandra Bowen user avatar by
Alexandra Bowen
·
Sep. 27, 18 · Presentation
Like (4)
Save
Tweet
Share
5.69K Views

Join the DZone community and get the full member experience.

Join For Free

I wear API colored glasses. Internet of Things (IoT) is more than a buzzword. The convergence of devices, cloud, and analytics is creating a perfect storm for the developers. APIs make it easy for developers and partners to securely access devices and build ecosystems around them. Web APIs, or more specifically REST APIs, are key for connecting devices to the Internet.

Cheaper sensors, affordable prototyping platforms, like the Arduino, Raspberry Pi, and BeagleBone, make it easy for the developers to get started with IoT. But sensors are only the tip of the iceberg.

Developers need to deal with a variety of data sources, such as object storage, semi-structured NoSQL databases, and RDBMS, to store and process sensor data.

Building Blocks of IoT Development:

  • Devices, endpoints
  • Device management — collecting information, storing it, and extracting it
  • Filtering — information filtered out, event handling, and notifications
  • User management — permissions, users, access, roles

Dos and Don'ts for Developing

Hold Your data in Unstructured Schemas

Choose a device-agnostic platform. Don’t model for a certain kind of device. Don’t worry about a structured schema that is a closed fit, rather choose flexible schema. A relational database is constrained, rigid, and doesn’t allow for all changes you want. Therefore, you need to gear up your platform for multiple devices.

Interoperability

Interoperability = Interconnectedness

Aggregation is not done in a silo. Be open. Share data between the device and the people interacting with it. People find creative ways to interact with devices and data.

For example, think about if every manufacturer had a different electrical outlet in the wall. IoT is similar in that we are going to collect a lot of unique IoT things, and if everyone builds their own “world,” it won’t work together, or well. This is where standards also come into play.

Optimize for Small Packets in High Volumes

You may have constrained networks and resources. You must offer ways to pass in information in a structured and minimalist way. Volume becomes important when connecting a lot of devices.

Handle Failure Conditions

Have solid reporting, handling of errors, and a user interface — did it fail or did it just go offline? Make sure you have strong testing and error handling methods. Then, you need to communicate the status code breaking changes on endpoints and manage change and errors. Not only that, you need to make sure you have in-depth logging. This will be invaluable and make sure devs can identify failures.

Documentation

Don’t neglect documentation!

Start Small

Reduce TTFHW (time to first "hello world"). When developing for the IoT connect device, plan for growth and change. Don’t rush. Think about all aspects of it, from its payload size, messaging, and frameworks, to the device capabilities.

Security Matters

I’m going to keep this one brief, even though it’s a juicy one, because I have written entire blog posts about it and just scratched the surface.

It’s a simple idea, but if the device is secure, you should trust your device. Some security best practices: provide transport layer encryption, provide a permissions model for you to secure access, and allow you to encrypt messages with public-private keys.

Standards

Standards folks and open-source folks don’t usually get along. But, standards are a necessary evil.

We can’t all go out there and start building our own unique vertical solution and put a wall around it. But, we can build our vertical solution on top of open-source horizontal standards. Standards and collaboration are required to enable this massively smart and interconnected world.

Each day, more and more devices are coming online, adding to the ever-growing Internet of Things (IoT). Analysts agree the IoT will grow to many billions of devices over the next decade. The challenge for the IoT ecosystem is to ensure these emerging IoT devices can connect securely and reliably to the Internet and to each other. That’s why the work that folks, like the Open Connectivity Foundation, are doing is very important.

There are a lot of emerging standards out there, but I would like to briefly highlight the Open Connectivity Foundation (OCF). OFC is a group of industry leaders who will be developing a standard specification and certification program to address these challenges.

(OCF) Standards will unlock the massive opportunity in the IoT market, accelerate industry innovation, and help developers and companies create solutions that map to a single open specification. OCF will help ensure secure interoperability for consumers, business, and industry.

Billions of connected devices (devices, phones, computers, and sensors) should be able to communicate with one another — regardless of manufacturer, operating system, chipset, or physical transport.

The IoTivity project is sponsored by the Open Connectivity Foundation (OCF). The IoTivity project was created to bring together the open-source community to accelerate the development of the framework and services required to connect these billions of devices. IoTivity is an open-source software framework, enabling seamless device-to-device connectivity to address the emerging needs of the Internet of Things.

What Will it Look Like?

  • Open
  • Royalty-free
  • Seamless
  • Technology agnostic
  • Fair and accessible
  • Cross-industry
  • More secure
  • Structured

Standards and Collaboration Drive Adoption

  • Wi-Fi: $90 B in annual economic value in the US
  • OSS 31 billion lines of code: 3.8 million OS contributors
  • Mobile 2015 4 billion unique subs — Contributing $3.7 to global GOP
  • Web: 1995 <1% of the world connected: 2016 — over 40 percent connected

Context Matters

Gone are the days where you say, "Here's a REST client with basic Auth."

Don’t think that only one person or device will be consuming. A lot of times, it's two machines speaking without human intervention. Keep in mind computational power. Understand common interfaces across protocols, and design your API knowing what will matter.

Ask yourself: who is consuming your APIs and your IoT device? Keep in mind that not every device will communicate over REST; devices have different form factors and computational power. Devices also may communicate over multiple protocols (3G, 4G, CoAP, MQTT).

State Matters

  • Provide ability to push state (webhooks, event streams)
  • Provide ability to pull, or polling, state (REST)

Not all devices communicate over REST. State matters —and REST is the most common pull state, even though REST is stateless. Decide whether a Pull or Push state makes more sense for your project.

So, why Pull vs. Push? For self-driving cars, you’d need automatic responses, meaning you have high-time sensitivity. Push (regular API) is best in high-time sensitivity. REST is not literally instantaneous and response time is based on many factors, such as network, latency, size of call. But, REST works for most developers, and if you have low(er) time sensitivity, keep in mind, it can be as low as milliseconds. 90 percent of IoT devs are going to be OK with REST.

But, devs can get into trouble with polling when they want really fresh data. How frequently are you going to check for updates? Once per second? Ten times per second? On an API with lots of resources and thousands of clients, this can quickly become a scaling problem for back-end servers, not to mention the wasted data transfer. In fact, our friends at Zapier found that:

98.5% of all polling seen through their system amounts to wasted traffic
IoT Open source dev REST Web Protocols

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Documentation 101: How to Properly Document Your Cloud Infrastructure Project
  • 10 Most Popular Frameworks for Building RESTful APIs
  • Use AWS Controllers for Kubernetes To Deploy a Serverless Data Processing Solution With SQS, Lambda, and DynamoDB
  • Java Concurrency: LockSupport

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: