Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

IoT Project Lifecycle: Efficient prototyping with Snaps and Ubuntu Core [Part I]

Vergil Yotov

on 23 September 2022

This article was last updated 1 year ago.

There is nothing more exciting than creating something new. Whether developing a new idea, coding a new software feature or creating a new product altogether. After a lot of hard work, we can finally see users interacting with the system and sharing their feedback. The quickest way to reach that point in a project is to start prototyping early.

With an abundance of hardware and software available, it has never been easier to create a working prototype. If a picture is worth a thousand words, then a prototype is worth a thousand meetings. Providing an interactive solution to stakeholders and potential users is the easiest and fastest way to convey and validate your ideas.

Being efficient

As far as IoT prototypes are concerned, creating a technical prototype is both overwhelming and fun. There are so many applications, services, software repositories and containers that can be tried and used directly. It is somehow easy to get distracted by all the options. And we haven’t even talked about hardware. The easiest thing to do is pick a few proven or promising solutions, mash them up together and quickly adapt them to suit your needs. With deadlines on your back, getting something done is the main priority.

But how transferable is that to production? It can be tempting not to think about it. Just make it work and worry about it later. With a mindset like that, the first thing to do after playing around with the prototype would be to throw it away and start from scratch. To make this process more efficient you would have to create something closer to the real solution. A better prototype would be something to iterate and build upon.

A good way to do that is to start with a blank sheet. Pick a sturdy software platform that you know is going to be there for decades to come. You can use existing hardware to validate your solution. Packaging your applications in an OS native format gives you the piece of mind that your solution will be directly deployable to production hardware. 

Snaps and Ubuntu Core give you exactly this. Learning how to package applications as snaps is an investment that is well worth it in the long run.

What do you need to get started?

A laptop or desktop of your choice and some free time! Let’s say an IoT developer has created a simple script for sensor acquisition or a more complex application with multiple microservices. It works fine on Ubuntu Desktop or in a VM and you are curious how it would work on an industrial device or a whole fleet of different devices. A manager would ask: how feasible would it be to support that application across a diverse range of platforms and how would it scale to thousands of devices? The answer is simple. Packaged as a snap, an application will run on all supported Ubuntu Flavours and versions. All snaps are distributed through the Snap Store, which can serve regular updates to millions of devices.

To get started you can check out the guide on snap creation. Snaps are packaged using the Snapcraft tool. Once installed, Snapcraft will help you package your application as defined with a YAML file. Development experience is great on Ubuntu Desktop, but snaps can be built on both MacOS and Windows too. If you want to speed up building and iterating snaps, it’s best to build using LXD.

To learn how to manage snaps locally on your system, you can check out the quickstart guide on There are a lot of features to play with and things to learn, but probably the most important concept is Snap confinement

Snap confinement level and permissions define how isolated an application is from the host operating system and the rest of its applications. Thinking early about security can be very helpful in avoiding any challenges further down a project. Knowing what permissions your application needs in advance can be difficult. To get started it’s best to check that your application is working properly and then apply additional security controls to it. The documentation page on debugging snaps can be really helpful. 

It’s amazing how much can be done after spending some quality time developing. However, an IoT prototype would not be complete without actual hardware running your brand new snaps. 

Photo by Tool., Inc on Unsplash

Try your prototype on real hardware

One of the best operating systems for running IoT applications is Ubuntu Core. Ubuntu Core consists entirely of snaps. This is great, because you can get the most out of the snap security and reliability features. A snap or a collection of snaps can be easily deployed to an Ubuntu Core installation, not just in a VM, but also on a range of supported platforms. The getting started documentation of Ubuntu Core is a good place to start. If you want to jump straight to using it, you can grab a Raspberry Pi or an Intel NUC or even an old desktop or a laptop and install Ubuntu Core on it. If you would like to see the whole process this video on getting started with Ubuntu Core on Raspberry Pi shows it all.

Once installed, you can log in to your Ubuntu Core device by using the SSH key associated with your Ubuntu SSO account. Since the operating system comes with a strict security configuration, password access over SSH is disabled by default. After login you can copy your snaps over SSH or install a range of wide available applications directly from the Snap Store.

In the field of IoT, the interaction between devices and the physical world is essential. This could happen through a variety of technologies like sensors, actuators or interfaces that monitor and control industrial machines. It’s a good idea to test such interfaces if they are available and make sure that your snap has permissions to use them. To see a real-life example of how custom hardware interfaces can be used securely,  check out this guide for using Raspberry Pi’s GPIO to control an external fan

Ready for production and scaling up

Prototyping can be hard work. Being able to transfer that to production can greatly speed up your development process. Snaps can be really helpful in that aspect. All effort spent prototyping snaps will be directly applicable to your production system. 

The best way to reach millions of devices with your application is to publish it on the Snap Store. Even a complex system of microservices can run securely on Ubuntu Core. A good example for this is the IoT framework EdgeX. Your applications, packaged as snaps, can be built remotely or as part of a CI/CD pipeline. This can streamline the delivery of new code straight to all devices that need it. 

In situations where you don’t want to expose your application publicly you can use a dedicated IoT Snap Store. The dedicated snap store gives you private software distribution at a global scale. You have the ability to manage the flow of software between your developers, devices, customers and partners. With it you can power a whole ecosystem of applications specifically suited for your needs. Sometimes, software needs to be deployed in challenging or sensitive environments. In such cases global distribution might not be the best solution. With the air gapped mode of the enterprise snap store you can distribute private applications that never leave your perimeter. 

Whatever the use case, snaps make great sense when creating easy to maintain IoT projects. With a strong security posture, wide platform compatibility and an integrated software distribution system, they make delivering IoT projects efficient and scalable. 

Learn more about other phases in the IoT project lifecycle

This blog post is the first in the series of blog posts on IoT lifecycle management. Stay tuned for the next parts to find out how to move to production hardware and beyond. Make sure to check out the guide on IoT lifecycle management

Further reading

Ready to get started with your IoT project and curious to find out what challenges might lie ahead? Read the white paper: Top 5 IoT challenges and how to solve them.

Why is Linux the OS of choice for IoT devices? Find out with the official guide to Linux for embedded applications

Working on a new IoT project, but unsure which OS to pick? Learn about the trade-offs between Yocto and Ubuntu Core.

smart start

IoT as a service

Bring an IoT device to market fast. Focus on your apps, we handle the rest. Canonical offers hardware bring up, app integration, knowledge transfer and engineering support to get your first device to market. App store and security updates guaranteed.

Get your IoT device to market fast ›

smart start logo

IoT app store

Build a platform ecosystem for connected devices to unlock new avenues for revenue generation. Get a secure, hosted and managed multi-tenant app store for your IoT devices.

Build your IoT app ecosystem ›

Newsletter signup

Get the latest Ubuntu news and updates in your inbox.

By submitting this form, I confirm that I have read and agree to Canonical's Privacy Policy.

Related posts

Space pioneers: Lonestar gears up to create a data centre on the Moon

Why establish a data centre on the Moon? Find out in our blog.

A look into Ubuntu Core 24: Your first Linux-powered Matter device

Welcome to this blog series which explores innovative uses of Ubuntu Core. Throughout this series, Canonical’s Engineers will show what you can build with...

A look into Ubuntu Core 24: Robotics telemetry for your fleet

Welcome to this blog series which explores innovative uses of Ubuntu Core. Throughout this series, Canonical’s Engineers will show what you can build with...