WHITEPAPERS
The Essential Guide to IoT Development Frameworks & Best Practices
In this guide, discover everything you need to know to make your IoT product vision a reality.
Author: Jeff McGehee
As Very’s Director of Engineering, Jeff leverages his broad technical expertise to architect systems that involve intelligent machines within client projects.
Why IoT Matters
The Internet of Things (IoT) represents both a massive challenge and a massive opportunity. IoT devices and revenues are projected to double over the next few years. This means that companies who develop IoT products are poised to benefit in a big way.
However, IoT isn’t a gold rush or a “get rich quick” scheme. Diving head-first into IoT development without knowing the best practices is an easy recipe for failed projects.
The good news is that by preparing and educating yourself and your team, you’ll be much more likely to succeed. In this Guide to IoT Development Frameworks & Best Practices, discover everything you need to know to make your product vision a reality. You’ll find:
- Best practices
- Development paradigms
- IoT development frameworks
- Potential use cases
What Is the Internet of Things?
The Internet of Things (IoT) is one of the hottest buzzwords in technology – but what exactly is it? How does it relate to other big buzzwords like machine learning and artificial intelligence (AI)?
IoT refers to the vast network of devices that connect to the Internet to exchange information in real time. IoT includes “traditional” computing devices such as laptops and smartphones. However, the term is more frequently applied to hardware that has been enhanced with Internet connectivity.
This includes cardiac monitors and biochips, industrial sensors, security cameras, TVs and other smart home devices, and even self-driving cars. In general, any device that has an IP address to send and receive data over a network is considered part of IoT.
IoT, artificial intelligence, and machine learning are deeply connected and influence each other. IoT gathers data through smart applications connected to physical assets, which machine learning uses to create better AI. As AI improves, IoT improves, too, because the devices can use enhanced AI to accomplish more advanced tasks.
By enhancing formerly “dumb” devices with Internet connectivity, IoT aims to make your life simpler, easier, and more efficient. Here are just a few examples of how IoT can impact the way we work, play, and live:
- Smart home devices, like light bulbs and thermostats, can be programmed to turn on and off automatically. For example, you can turn off your thermostat during the day to save energy and money. Then, turn it back on soon before you arrive home from work.
- Tiny monitors and sensors attached to manufacturing equipment can detect warning signs and declines in performance before humans even notice them. This helps you prevent unscheduled downtime, plan maintenance work in advance, and make the manufacturing process more efficient.
- IoT healthcare devices can give physicians real-time updates on patients’ vital signs. Examples include glucose meters and blood pressure cuffs.
Regardless of how you use it, one thing is clear: IoT is growing incredibly fast. According to Gartner, the planet had more IoT devices (8.4 billion) than human beings in 2017. What’s more, Gartner predicts that this number will skyrocket to 20.4 billion by 2020.
Meanwhile, management consulting firm Bain & Company predicts that the global IoT market will more than double in just 4 years. The market reached $235 billion in 2017 and is expected to reach $520 billion in 2021.
Developing IoT Products
IoT products have the potential to transform every aspect of your business, from operations and processes to customers and outcomes.
Let’s say that you’re looking to improve your customer experience. IoT devices can help in many different ways:
- Personalized attention in the form of actions and messages, which can help customers feel happier and more included. For example, the coffee machine at your favorite cafe can prepare your usual order as soon as you approach the shop.
- Taking care of the tedium in customers’ lives, such as regularly reordering groceries when supplies are running low.
- Reducing time spent on customer support. For example, if a “smart car” detects a problem with its engine, the car can contact a mechanic.
Even industries not typically recognized as “innovative,” like agriculture and construction, are seeing the benefits of IoT. For example, IoT enabled tractors can receive location data from all vehicles in the fleet. This ensures that the tractors don’t overlap when seeding or fertilizing the soil.
Without a surplus of IoT products on the market, now is the perfect time to get into IoT development.
Before you get started, however, we want to note a few important concerns:
1. Failure is routine.
According to a 2017 Cisco report, only 26 percent of companies said that at least one of their IoT initiatives was a “complete success.” What’s more, 60 percent of failed IoT projects stalled very early on, during the proof of concept. If you want to build a successful IoT product, you must observe IoT development best practices.
2. Security is paramount.
IoT devices range from those that are inconsequential (smart light bulbs) to those that are life-or-death (medical devices). Connecting an IoT product to the Internet potentially exposes your users to hundreds or thousands of security risks. Your IoT device must be developed according to standards for IoT security and web development. You’ll also need to account for privacy laws and regulations around sensitive personal information, like GDPR.
3. Solving the right problem is crucial.
Far too many IoT projects fail because they’re poorly defined or don’t solve an existing business problem. Before you begin, make sure that you know how you’ll measure the product’s success with specific KPIs.
You’ll also need to select the right technologies for the job. Could your project benefit from integrating Bluetooth and iOS, or perhaps creating a digital twin? (Read: what is a digital twin in IoT?)
The Benefits of Agile IoT Development
There are two main software development approaches – Agile and Waterfall. The Waterfall method takes a linear approach to software development. Developers follow a sequence of events for each distinct stage of the development process.
The Agile method was created as a direct response to critics of Waterfall. The critics felt that there was too much room for problems to remain unnoticed until a project neared completion. With Agile development, teams break each feature into the smallest discernible chunk of work and produce incremental value over time.
The Waterfall Development Model
For decades, software and hardware was mainly developed according to the Waterfall model of product development.
In this paradigm, development proceeds sequentially from one stage to the next. It’s like a waterfall cascading over a series of steep drops. The project moves to the next stage only when the current stage is correct and complete. This means that you can never return to a previous stage.
The stages of the traditional Waterfall model include:
- Requirements gathering
- Analysis and planning
- Design
- Development
- Testing
- Deployment
With the Waterfall model, the end goal is defined early and the entire process is laid out from beginning to end. On the surface, this makes the project appear more clear and organized.
However, it’s not hard to see the flaws with the Waterfall model. For one, its structure is highly inflexible. If you encounter a major issue or decide to expand the project’s scope, you might have to start over. It also has no room for making updates or revisions based on feedback from clients and users.
In addition, testing is only performed once the project is nearing completion. Project members can’t be sure that they have a viable working product until very late in the life cycle. This makes the Waterfall model highly risky.
The main problem with the Waterfall model of development? It doesn’t reflect how most people complete their work in reality. By discouraging exploration, experimentation, and iteration, the Waterfall model reveals itself to be highly flawed.
While the Waterfall method might work well for physical engineering, fabrication, and manufacturing, software development is different. It’s easier to completely break down and rebuild parts of a software product than a physical product. Because the engineering team owns the code base, they can easily make sweeping changes to the product.
Most stakeholders have a hard time grasping this reality. To them, it seems similar to a car manufacturer swapping out the engines of cars currently on the road.
However, the best way to build a software system is very different from the best way to construct a physical system. Software can adapt as needs change and challenges arise if you follow the right process.
The Agile Development Model
Partly in protest against the rigidity of the waterfall model, 17 software developers published an “Agile manifesto” in 2001. The document provided a set of values and principles that the authors wanted to emphasize for product development. In particular, the manifesto’s authors expressed their preferences for:
- People and interactions over processes and tools
- Working software over comprehensive documentation
- Working with customers instead of arguing over contracts
- Responding to change over following a plan
These ideas became the foundation for the Agile development method, which we’ve adopted here at Very. “Agile” (as its practitioners call it) prioritizes flexibility, speed, working with cross-functional teams, and continual improvement through iterative development.
Agile separates the development process into discrete time periods called sprints, which typically last between 1 and 4 weeks. Each team member has a set of tasks that must be completed during the sprint. These tasks are delegated during a planning meeting at the beginning of the sprint. In addition, team members hold daily “stand-up meetings” to discuss their progress and brainstorm solutions to any problems they encounter.
These changes in how product development is practiced have a radical effect on the final results. Unlike Waterfall, Agile development is built to withstand change and even embraces it. Agile produces a working product as quickly as possible, and places a heavy emphasis on user testing and feedback.
Why Agile and IoT are Perfect Together
Agile, rather than Waterfall, is the clear choice for developing IoT products. In particular, Agile is the preferred development model when building a minimum viable product (MVP). The MVP is an initial proof of concept that demonstrates the viability of your idea. It provides a sounding board for user and client feedback.
Returning to a previous analogy, suppose that you want to design and manufacture a car from scratch. Traditional models of development would have you design and build components such as the engine and chassis in parallel. However, this method wouldn’t deliver a working product until very late in the process.
Instead, think about why you’re actually building the car: to have a means of transport from place to place.
You’d start by creating an MVP with the ability to transport users (e.g. an electric skateboard). Then, you’d add more features, building intermediate products along the way (e.g. scooters and motorcycles). Though this seems expensive and time-consuming with physical products, it’s the most efficient way to build an IoT solution.
Yes, IoT solutions do involve physical products. However, a proper IoT solution is agnostic to any specific hardware. For that reason, IoT operates more like a software system.
When planning an IoT solution, look at your problem from the broadest possible perspective. Most likely, you will realize that simple, commodity hardware will solve your immediate need. Keep in mind that this will only work if the software performs properly and provides the ideal user experience.
Once the proper software infrastructure is in place, swapping in new hardware designs will be simple. This allows for faster product release cycles.
One drawback of agile development is that it’s difficult to implement correctly – but the effort is well worth the cost. Below, we’ll go over the 10 key steps of an Agile IoT release:
1. Validations and Constraints
Validate your assumptions about the project and go over any constraints that you will face (budget, timeline, staff, etc.).
2. Product Development Roadmap
Construct a plan from the ground up. The end result should be a plan that captures both immediate needs, and a long term vision for the IoT product.
3. Hardware De-Risking
This step is when true development begins. The goal is to eliminate unknowns around the hardware design. Answer questions like:
- Is it possible to measure/control X with an acceptable level of accuracy?
- Is it possible to receive wireless communication in the expected operating environment?
- Is the expected BOM cost feasible from a budgetary perspective?
4. Imitation
The name of this stage has a double meaning.
For hardware, you should have a rough hardware prototype that can reliably imitate the way you want your end product to work. Think jumper wires and development board. When choosing your development board, choose the CPU/MCU that will be used in your production product. Otherwise, make sure you’re capable of porting your firmware across different chipsets.
For (web and/or mobile) software, you should begin building the critical components around device provisioning, authentication, firmware updates (necessary for IoT firmware security), and basic message passing between the web backend and the device. Your software team should “imitate” the interactions with the device within their software testing tools. This will allow them to proceed without a physical device.
5. Full Prototype
The goal of this step is to have your prototype fully connected to the web. You should be able to send data to and receive data from your device, including IoT firmware security updates. Your firmware and software should be ready for production (but probably not feature-complete) at this stage.
6. Micro-Facturing Run
In this step, you’ll create custom printed circuit boards, and 3D printed mechanical enclosures/components. You can then distribute these to your less hardware-savvy software team, to enable testing with actual hardware. However, don’t allow the software team to abandon the idea of proper hardware mocking for automated tests. Once you feel comfortable with giving the device to beta testers, you’re ready to move on.
7. First Manufacturing Run
This initial manufacturing run will create roughly 100 devices that you can distribute to a pilot group of testers. During this stage, you should receive feedback that you can use to make iterative improvements. If you need to make hardware changes at this stage, you can pause the software team. Alternatively, you could ask them to continue working on more advanced (non-MVP) software features.
8. Real Manufacturing Run
This stage will produce 1,000 or more devices. The software team should have completed any custom provisioning or calibration software needed by the manufacturer. With a healthy group of early adopters, you can get feedback on the user training and onboarding process.
9. Go-to-Market Manufacturing Run
This is it-you’ve finished your first IoT product release! The more products you manufacture, the more you can benefit from economies of scale. Your software is bulletproof, and your hardware has struck the proper balance between cost and functionality.
While your company profits on sales from your first batch of devices, you can begin developing new hardware products. These products will easily plug into your IoT system.
10. Simulation with Digital Twin Technology
What is a digital twin in IoT?
“Digital twins” are virtual reproductions of a physical object that you can use for testing and experimentation. Creating a digital twin can help you collect more accurate product feedback. It can also reduce the lifetime cost of owning and supporting a device. If your IoT products are more complex than a light switch or a simple sensor, consider researching digital twin offerings.
Using Elixir and Nerves in IoT Development
You may have a vision in mind for your IoT product development, but how exactly will you get it done? With so many possible languages, IoT frameworks, and libraries available, the hardest problem of all might be knowing where to begin.
IoT devices and ecosystems require a vast range of knowledge in hardware, IoT firmware security, mobile development, and web development. Specialists in one field rarely have deep experience with another field.
In addition, embedded software technologies still lag far behind web-based software technologies. Trying to make embedded C code work for web development is like putting a square peg in a round hole.
For these reasons, the IoT landscape is fraught with half-baked products. They have good ideas and good intentions, but no execution to back them up. Many current IoT offerings are difficult to use or stricken with IoT security flaws.
With all these problems in mind, what can a fledgling IoT developer do? Allow us to make a suggestion that we’ve tested through experience: Elixir and Nerves.
The Elixir Programming Language
Even though it’s less than a decade old, Elixir has a lot to offer. Elixir’s creators describe it as “a dynamic, functional programming language designed for building scalable and maintainable applications.”
The Elixir language uses Erlang, another functional programming language that’s been around since 1987, as its foundation. As a result, Elixir developers can use any Erlang library, which gives you a lot more flexibility despite the relative newness of the language.
Erlang gives Elixir the hardware-centric features that make it perfect for robust embedded firmware. Originally designed for low-level, remote hardware applications, Erlang has the reputation of being fault-tolerant and highly available. It also supports “hot swapping,” which is the ability to add and change program code while the program is running.
Besides its Erlang foundation, there are many benefits to using Elixir, including:
- Data immutability. As a functional programming language, Elixir cannot use mutable data. Variables in one part of the code can’t be changed in another part. This helps you avoid bugs and unexpected behavior.
- Concise, testable code. Elixir encourages functions that are small, clear, and easily testable, which is another consequence of being a functional programming language.
- Process-based. Thanks to its Erlang foundation, Elixir can easily parallelize workloads and use multiple processes at the same time. This adds a significant boost to performance.
- Fault tolerant. If an Elixir process fails, the failure is contained to that process and that process only. The entire system won’t go down if one user experiences a problem.
Thanks to these traits, Elixir is well-suited for systems that have large amounts of traffic and many different connections. Of course, this makes it ideal for IoT development.
The Nerves IoT Development Framework for Embedded Software
If the benefits listed above aren’t enough to seal the deal for Elixir, Nerves is yet another selling point.
Nerves is an IoT development framework for building embedded software in Elixir. It uses the principles of web development, including tools for secure communication with web servers and tools for continuous delivery. One feature that makes Nerves an especially good fit for IoT development is NervesHub. It’s an extensible web service for managing wireless IoT firmware security updates of devices in the field.
Nerves is made up of three main components:
- A Linux platform that boots directly to the BEAM virtual machine for Erlang.
- A plug-and-play library of Elixir modules for fast and easy development.
- A set of command-line tools for managing builds, updating firmware, configuring devices, and other functionality.
Here at Very, we’re eager to capitalize on the many advantages of using Elixir and Nerves. That’s why it’s our go-to solution for firmware that has multiple or complex responsibilities.
For example, we recently used Elixir and Nerves to build a self-service IoT beer kiosk. The kiosk uses facial recognition technology to confirm that a buyer is of legal age. Once customers are manually verified by an on-site “bartender,” they can return to the kiosk to order more beer. This way, they don’t have to flash their IDs every time.
The system included features such as:
- Credit card payments
- iPad app
- Accurate beer flow measurement
- Inventory tracking
- User management
As a full-stack firmware solution, Nerves was able to take a great deal of work off our hands, from firmware updates to packaging the application code.
AWS IoT Core with Elixir and Nerves:
AWS IoT Core is an IoT platform that makes it possible to manage devices, send and receive secure messages, and take action based on messages sent. Using AWS IoT Core along with Elixir and Nerves allows for the productive development of robust and scalable IoT software.
With AWS IoT Core, you can scale to billions of devices and trillions of messages effortlessly through the MQTT IoT protocol.
MQTT is a lightweight messaging protocol that was developed by IBM and first released in 1999. MQTT protocol uses the pub/sub pattern and translates messages between devices, servers, and applications.
MQTT client tools connect to an MQTT broker. The MQTT broker dispatches all messages between the senders and the correct receivers. MQTT IoT protocol is preferred because it has a low bandwidth overhead, small code footprint on clients, and topic-based messaging.
3 Examples of IoT Transforming Markets
The self-service beer kiosk is just one idea for an IoT product that can transform its industry. In this section, we’ll discuss a few more ingenious IoT use cases.
1. Consumer IoT
Very recently partnered with Koller Products to build the world’s first Internet-connected desktop aquarium. Using a mobile app, pet fish owners can remotely check the tank’s temperature, adjust the color of the aquarium lights, change the daily lighting schedule, and more.
To build the Smart Tank for Koller, the team at Very had to unify their knowledge of hardware, firmware, and software. Koller and Very conducted a series of sprints and daily meetings at the beginning of the project. This helped them develop a strong product roadmap. Very’s developers used their talents in C++, React Native, and iOS/Android development to deliver a mobile app that met the client’s needs, desires, and objectives.
2. Industrial IoT (IIoT)
IoT is projected to have a major impact on people’s homes and workplaces. It’s also expected to shake up the manufacturing sector as we move toward industry 4.0.
Industry 4.0 refers to the “smart factory” concept. IoT systems monitor physical processes, create virtual replicas of the physical world, and make decentralized decisions. The use of IoT in manufacturing and industry is called Industrial IoT (IIoT).
For example, IIoT devices facilitate the use of digital twin technology. They do this by making it easier to collect and curate information about a device’s current status and performance.
GE’s Predix platform has been used to deploy nearly 1 million digital twins for everything from jet engines to power turbines. With 24 sensors tracking thousands of parameters on each engine, companies can build intricate virtual replicas of a single engine. This makes it easier to predict its behavior and schedule preventive maintenance.
IIoT devices also help improve workers’ efficiency, safety, and productivity by monitoring their behavior while on the job. For example, Australian construction firm Laing O’Rourke has introduced IoT smart helmets. The helmets monitor body temperature, heart rate, and weather conditions to alert employees when they’re at risk of heatstroke.
3. IoT and Customer Experience
IoT products can improve the lives of not only your employees, but your customers as well. By gathering data from a variety of smart devices, you can provide an excellent real-world experience.
Businesses can deploy IoT devices to create personalized options for customers. For example, regular customers at a local café might receive a text from the “smart” coffee machine. The coffee machine asks if they’d like their usual order ready for them tomorrow morning.
Consumer IoT products promise to remove much of the tedium of daily life. Smart fridges and pet food dispensers might contain sensors that automatically reorder your favorite brands when you’re running low. Meanwhile, smart cars can detect potential part failures before they actually occur. Then, they can contact a mechanic to set up a service appointment.
Working with an IoT Development Company
Without the technical chops to make your concept a reality, your IoT product idea will remain just that-an idea.
The good news? You can still deploy an IoT product by partnering with an IoT development firm with the right knowledge and experience.
However, there are a lot of IoT partners offering their services, which may be of highly variable quality. To ensure your IoT product rollout is successful, look at these traits when choosing an IoT partner.
- Technical skills. Obviously, the right technical skills should be your foremost priority when on the hunt for an IoT solutions provider. The firm you choose should have experience in software development, web development, IoT security, and electrical or mechanical engineering.
- Communication styles. Some IoT development firms prefer a more hands-off approach, while others are happy to check in with you every day. Whatever your optimal communication style, make sure that you select an IoT partner who can match it.
- Working patterns. As mentioned above, the Agile method is highly preferred when developing IoT products. If you’re a stickler for tradition, however, you may prefer a partner who uses the Waterfall model.
- Culture of testing. IoT devices are highly complex, requiring both good hardware and software development practices. Testing – especially an automated testing suite – is essential to ensure that the product remains high-quality throughout the process.
- Flexibility. Another consequence of this complexity is that requirements and features are likely to change more than once during the project. The IoT provider you choose should be open to potential changes throughout the development cycle. They shouldn’t be wedded to any particular tool or technology.
The world of IoT development holds enormous promise for companies that are willing to take risks and get wet. But with IoT products failing left and right, it’s crucial to select the right partner for your vision.