IoT solutions don’t need to be complicated and can be developed quickly

Von Marc Jäckle @marcjaeckle auf Twitter
29. April 2021

For our customer Green City Solutions we have implemented an IoT platform on a lightweight technological basis in just 4 months. This involved connecting moss trees, so-called CityTrees, to the Internet to control and monitor them. In this article you will find out what our solution looks like and whether this lightweight approach could also be suitable for your project. IoT projects don’t have to be complicated.

Digital control of living moss

Air pollution control is a challenge in our cities today. The space we inhabit, work and learn in is heavily polluted by toxic emissions from traffic and industry. Combating this presents a mammoth task for cities and companies. Our customer Green City Solutions has taken on this task and developed the CityTree, which combines the natural abilities of mosses with intelligent IoT technology to reduce air pollution.

The secret behind it comes from nature itself: CityTrees make use of the ability of various moss species to bind environmental toxins such as particulate matter, while at the same time producing oxygen and cooling the air. Combined with the latest IoT technology, CityTrees provide comprehensive performance and status information as well as environmental data from the surrounding environment of the CityTree in real time. Additionally, the actuators in a CityTree that provide life-support for the moss, such as water supply and ventilation, can be controlled and managed through a management dashboard. Based on algorithms CityTrees can also run completely autonomous without human interaction.

The challenges

IoT solutions often bring along significant challenges. These include the authentication of the devices in the backend, securing data transmission, remote software updates, high data volumes as well as extensive requirements regarding the scalability of the system. Beyond these common challenges the project had some specific ones:

  • Development speed: A first usable version was required in just 2 months. As a part of an already existing interim-solution was going to be turned off, the product engineering team which is developing the CityTrees needed a new solution to be able to control, monitor and analyze the CityTrees during product development. The new solution had to be usable in production as quickly as possible as the existing interim-solution was buggy and was missing some important features that were required by the engineering team. Also together with our customer, we wanted to make sure that we got feedback from users right from the beginning.
  • Transition to Green City Solutions: As the IoT solution is an integral part of the product, the customer wanted to build up their own small software development team that was going to take over development later on. Therefore the solution needed to be simple enough so it could be taken over and operated by a small development team. Our talent acquisition department also supported Green City Solutions in finding developers and assisting with job interviews.
  • Define hardware solution with easy deployments for Green City Solutions engineers: The future hardware and software solution for the device side (the moss trees) needed to be defined together with the hardware supplier. The general solution needed to be finalized in the first month so the hardware provider could improve the existing hardware and implement necessary changes to the embedded software in time. Also the Green City Solutions team wanted to be able to develop and deploy software to the CityTrees themselves without needing someone else to write embedded software for them first.

Optimizing towards speed in development

In order to deliver the solution's first part in less than two months, we build a highly efficient team, decided on short sprints and made sure that the team could deploy to a production environment after just 2 weeks:

The right team saves time

Based on the required functionality and time frame, we decided to set up a five-person Scrum team. In order to ramp-up development as quickly as possible, two things were vital to enable a five-person-team to be productive from the beginning:

  1. We staffed the team with sufficient knowledge and experience in building IoT systems. With the knowledge of typical IoT business requirements and use cases, a deep understanding of the different user and usage types of IoT systems as well as a technical expertise in building IoT systems, it was possible to quickly start the implementation. In a first step we drew up a rough roadmap for the first project phase based on a story mapping and defined the initial software architecture of the system. To do this, we took a closer look at the domain - which actors and functions are required in the system? What are our use cases that we have to map? What data flows exist within the system? How do we want to communicate within the system? Which bounded contexts do we have and how do we map them to backend services?
  2. Two experts in building and automating infrastructure as well as CI/CD pipelines made sure that there was a production-ready platform, based on Google Cloud IoT Core, GKE, Prometheus, Grafana, Elastic Cloud and GitLab Cloud, available to deploy to in about two weeks. This was crucial to enable the development team to deploy working software right away. By using managed services wherever possible as well as Terraform, Helm and GitLab CI, we were able to easily manage cloud resources and install the necessary infrastructure in such a short period of time. Using the managed services also saved costs by keeping operating expenses and complexity as low as possible. The team implementing the software consisted of one business analyst, one frontend developer and three backend developers. The customer provided the product owner.

Agile development process with one-week sprints

For the success of the project it was crucial to stick to a lightweight and agile approach to quickly develop a viable solution. To do justice to the "start-up spirit" at Green City Solutions and to be able to react as quickly as possible to new requirements or technical difficulties, the development team decided on using Scrum with one-week sprints.

Have a production environment available quickly and deploy to production early on

For the services and data analytics functionality we decided early on to use Kubernetes, as it provided many advantages from easy deployments to a huge ecosystem. Also it gave us a certain cloud provider independence. As we wanted to have a production environment ready as soon as possible and because we didn’t want to spend much time on infrastructure and keep the system easy to operate, we decided to use Google Cloud GKE. When the project started, GKE was clearly the most mature managed Kubernetes cloud service which made it easy to have a production ready environment in just one and a half weeks. Also, contrary to other offerings it was fully managed and not „shared responsibility“. To quickly connect the devices in a safe way, we chose Google Cloud IoT Core over a custom built solution as it saved us time and effort in the beginning. Also the hardware supplier favored Google Cloud IoT core as he already had positive experience with IoT Core. The main drawback of using IoT Core was that Google currently does not have a datacenter in China. This is problematic since China is an important future market for a clean air product. Still the advantages of being fast and of saving effort in the beginning overweighted this drawback. We tried to limit the dependencies on IoT Core to reduce the effort it would take to replace it with a different solution in case Google still won’t offer a Chinese Google Cloud region by the time the CityTree are being sold in China.

Reducing complexity to ease transition back to the customer

Both cost efficiency and a high initial development speed were very important for our project to reach the first two-month milestone. At the same time, the solution needed to be lightweight, so we could fulfill our customers’ goal to be able to take over development and operations of the solution.

While asynchronous solutions can drive down infrastructure resource costs due to higher efficiency, they come with a much higher complexity which often means that they are slower to develop and more difficult to operate and maintain. This added complexity was a no-go regarding our customers' project goal to develop and operate the software in their development team. Therefore we decided to implement lean, stateless and highly available services that communicated synchronously with each other. This solution promised to be simple so our customer could eventually take over responsibility. Also, we kept the number of microservices small to reduce infrastructure costs and complexity. As technological base we decided to use Spring Boot and Java instead of Kotlin or microservice-focused frameworks like Quarkus or Micronaut. The two main reasons for this decision were that Spring Boot is very mature and due to its commonness it would make it easier for our customer to find their own developers with the required knowledge. Subsequently the microservice architecture has proven itself. It allows a high development speed, is easy to expand and maintain and is very lean from a cost perspective.

Also, we decided to use as many managed solutions as possible. This proved to be a good decision because it freed development resources and sped up the initial setup considerably. In addition, it helps saving operations costs and it eased the process of transitioning the platform to Green City Solutions’ internal development team.

Hardware solution with easy deployments for Green City Solutions engineers

When we started the project, the final hardware and software design for the devices still needed to be specified. The final solution should be built upon what had already been developed and allow the CityTree engineers to deploy their own software onto the CityTrees without having to write embedded code or hire someone else to write it for them. One reason for this requirement was that the engineers were familiar with technologies commonly found in the backend and not with embedded programming. Also the new software development team would most likely be familiar with non-embedded technologies only. Another reason was that contracting someone else for each change would take too much time and would be too costly in the long term.

Together with Green City Solutions and the hardware supplier we decided on a solution with two controllers in each CityTree: The first controller was the existing embedded controller that was able to trigger the actuators and read values from the existing sensors and send them to the backend. The second controller was an extension controller that offered additional hardware ports for connecting more sensors and would run a Linux distribution that allowed the execution of Docker containers. Using Docker on the device-side would make it very easy to deploy new software to the devices using standard container technologies. This would allow the Green City Solutions engineers to write their own software and deploy it to the CityTrees. The extension controller would also carry all complex logic. As a first step the embedded controller was to be finalized and it would directly communicate with the backend via MQTT. In a second step, the extension control would be developed, and when added to a CityTree the embedded controller would send its messages to the extension controller via MQTT instead of directly to the backend. Only the extension controller would then talk to the backend.

IoT solutions for your company

Our IoT solution for Green City Solutions shows that not every IoT solution has to be complicated, expensive and slow to develop. The platform is characterized by flexibility and expandability, and is based on both efficient and stable technologies. We have also made sure that new developers can quickly get started. We supported our customer in building its own development team and managed to seamlessly hand over the project. After all, we want to give our customers a good start; we are not interested in a vendor lock-in. Thanks to the close and trusting cooperation with our customer and our many years of experience with IoT projects of all sizes, we were able to implement a viable and cost-effective solution for Green City Solutions that fitted their needs in a very short time.