Enhancing Connectivity: Mobile App Development for IoT
27 Sep 2023
In an era marked by unprecedented technological advancement, the Internet of Things (IoT) stands at the forefront of innovation, reshaping the way we interact with the world around us. IoT's integration of physical devices, sensors, and data networks has given rise to a connected ecosystem that transcends traditional boundaries.
At the heart of this revolution lies mobile app development, a critical catalyst in harnessing the full potential of IoT. From smart homes that adapt to our preferences to industrial systems optimizing efficiency, IoT solutions have found their way into every aspect of our lives. However, the true power of IoT lies not just in connecting devices but in enabling us to interact with them seamlessly. This is where mobile app development takes center stage, offering the gateway to control, monitor, and extract meaningful insights from a network of interconnected devices.
This article offers a detailed summary of our recent webinar, featuring insights from two of our mobile app development experts, Andranik Hayrapetyan and Arman Hovsepyan. During the webinar, they delved into the prevalent challenges encountered when developing mobile apps for IoT projects and shared strategies for navigating these challenges smoothly. Additionally, they offered real-world illustrations from their portfolio of mobile IoT projects, providing the listeners with tangible examples to enhance their understanding in this field.
Challenges in Developing Hardware-Dependent Mobile Apps
Hardware-dependent mobile apps or IoT apps have a set of distinctive features thanks to which their development process essentially differs from that of other types of applications. For the end user, such apps might not look any different from a regular mobile application, but the truth is that they come with a set of functionalities that require direct communication with specific hardware components.
Here is what a typical mobile app (online banking, cab booking, news applications, etc.) looks like:
The flow of such an application is quite straightforward and simple. It has a single source of truth, i.e., the backend services, and communicates with them in a well-defined and widely adopted RESTful API standard over the Internet and the HTTP protocol.
When it comes to IoT apps, there is not a one-size-fits-all solution. Each case requires a unique approach and solution.
To give you a better idea, here is an example of the simplest form of an IoT application flow:
There are many different ways of communicating with a device such as Bluetooth Low Energy, Bluetooth Classic, Direct Wi-FI, Zigbee, etc. For example, wireless headphones are connected to the phone via Bluetooth Classic, but a smart thermostat uses Bluetooth Low Energy to make such communication possible. Smart vacuum cleaners require Direct Wi-Fi to do the initial configurations. Such cases are abundant.
The choice of the means of connection is never up to you. It depends on the peripheral device itself. The mobile app development team takes the final decision on this from the hardware design and development team.
Below we will illustrate several different cases of IoT mobile applications.
Case #1The simple flow of the app illustrated above can transform into something a bit more complex. Here is what changes in the flow.
In this case, the app already needs to communicate with the backend services and the peripheral devices simultaneously via syncing data from one to the other.
E.g., a smartwatch is connected to the mobile phone and constantly communicates with its app via BLE. At the same time, the app sends information to the backend services.
In scenarios such as this, the mobile app does not only perform the role of the user-facing part of the system, but also acts as a mediator between totally diverse parties, each of which communicates with different protocols and data structures where each can become unreachable in a particular moment of time.
There can also be a case where we have to deal with multiple peripheral devices which can make things more complicated.
Here is what a similar case looks like.
For example, let’s say you have smart light bulbs all over your house, you will need to register all of them in the app in order to be able to control them and check their status.
Such apps need to keep track of all the connected devices to detect from which device they received a message. They also need to handle the situation where they receive a command from the user or from the backend that needs to be addressed to one of the connected peripherals. Moreover, these apps are also responsible for checking the connection status and the connection signal of the connected devices.
In another case, there can be a smart device which also acts as a hub and has other peripherals connected to it. In this instance, the mobile app communicates to the hub itself and through the hub, to the other devices as well.
Here is what it looks like:
There are scenarios where it is possible for the app to communicate with all the peripherals directly, like in smart home systems, where the multiple elements of the smart home can either be connected and controlled individually, or all of them can be connected to a central hub and carry out the communication from there.
Finally, there can be a case where the hub is somewhere in the cloud and both the mobile app and the peripheral devices communicate with the hub via the Internet in order to be able to send messages to each other.
The flow of such a project looks approximately like this:
The list of such different cases can go on and on with examples where things get even more complex but we won’t overwhelm you with more technical descriptions. The point here is that while in case of usual client-server apps the mobile app is the last link in the system, in IoT projects it is in the middle of the chain and is connected to different parties with different communication protocols.
End-to-End Testing and Reproduction of Bugs
As you have probably learnt by now, when it comes to IoT projects, things get complicated on all levels. You need to do end-to-end testing and reproduction of bugs in certain conditions of such apps because it is usually hard to create all the necessary conditions for peripheral devices that can cover all the possible scenarios.
Let’s have a look at some examples.
- If you have an app that checks the CO2 concentration levels in a room and has to change color when the levels are too high, the testing process is going to be quite challenging since it’s not easy to increase or decrease CO2 levels to your liking.
- An app that controls a smart vacuum cleaner is also going to be hard to test. Imagine a scenario where you need to test a certain behavior of an application for a smart vacuum robot and there is a need to reproduce a bug that happens in the app only when the battery of the robot is below 10% while the robot is cleaning the room in an intensive cleaning mode. That sounds like a lot of waiting.
- Testing a drone control app can also be a daunting process. In certain cases, to successfully carry out the testing, your app will be required to send an instruction to the drone to take off and go up for about 500 meters then go to a location picked on a map, record a 2-minute video there by turning around and return. You can’t do this in an office, can you?
To handle these kinds of issues, various levels of mocking and simulations need to be performed. For example, in the 1st case, we can develop a simple page that shows the row reading of the CO2 from the sensor. This can be tested once in various conditions with another production-ready CO2 sensor to make sure that the correct sensor readings are being transferred to the app. Then we can mock the results of the readings inside the app to correct and test the color changes.
In a different case, we may need to create a full functioning simulator of the peripheral device which will then help the development and QA teams mock the different states of the device.
IoT mobile app project development challenges don’t end here, however, we informed you of some of the main ones so you know what to expect if you are about to embark on an IoT mobile app development journey.
IoT Mobile App Project Examples: A First-Hand Account of Experience from Our Experts
Theory is important but as they say, practice makes perfect. During the webinar, our experts shared some examples of IoT project development cases from their experience. Let’s have a quick overview of some of them.
Air Quality Monitoring Device App
The aim of this project was to make a wearable device which would be connected to the mobile phone of the user via BLE and send notifications about the air quality monitoring sensors’ readings. In case of abnormal levels of some of the gasses in the air, the device would then alert the phone which would set off an alarm.
The diagram above displays the different parties and their communication protocols involved in the project. As you can see, we have an air quality monitoring device which holds different sensors and is connected to the mobile app through BLE. The app, in its turn, is connected to a backend service.
Some of the challenges and overall processes involved in the development of this project were the following:
- The mobile app acted as a mediator between the air quality monitoring device and the backend service, sending the readings from the former to the latter. It was also aggregating the readings to its local database. Since the memory of the wearable device was limited, it could not gather too much historical data, making the data management process quite complicated.
- The communication with the device was done with UART protocol over BLE. When the development of the mobile application reached the point where the real device needed to be connected, the real device was not yet assembled. This can happen with any hardware device that is just being designed and assembled for the first time. However, the entire communication protocol of the app and device via the UART protocol was documented, which helped us create another Android application simulating the actual hardware device. We were able to develop 70% of the application with this simulator app, until the assembly of the real hardware was finished and shipped to us. And even after we had the real device, we were using this simulator for testing some extreme situations which are hard to produce with real sensors.
- Upgrading the firmware of the edge device was another challenge. Thankfully there is a protocol designed for that part which is called DFU (Device Firmware Update) and we used it together with our custom logic to handle the firmware updates.
Through overcoming these challenges and finding the best solutions for every phase of the development process, our team was able to build an app that enables users to gain control over their health by tracking the quality of the air they breathe in.
Patient Health and Safety Monitoring App
This app had several connected devices:
- A medical alert speaker and virtual assistant which carries out multiple functions, including reminding patients of their appointments, answering health questions, sending notifications to family caregivers, etc.
- A medical alert watch that keeps track of the patients’ health, providing them with a pedometer and a heart rate monitor.
- A medical alert pendant with a built-in fall detection system and an emergency help button.
The mobile app, in this case, was to act as an admin controller to configure the settings for all of the above-listed devices. It should be noted that at this time some of our IoT devices came with a built-in cellular SIM card with a 4G network support and some of them did not (e.g., the virtual speaker device). In order for this device to be able to communicate with our servers, we had to think of a way to connect it to a Wi-Fi network.
And so a direct BLE connection between the app and the device was established, where the app was the central unit and the device was the peripheral. To start the pairing process, we put a hardware button on the peripheral IoT device which would broadcast specific services and characteristics on long press. After the mobile app discovered the peripheral, it read some identifiers, verified the device with our server to make sure that it was valid to register and had an active subscription plan and in case of success, it established the connection.
Afterwards, the device started discovering nearby Wi-Fi networks and transmitted the list to our mobile app. Then the app displayed the list to the user who would select one of the available networks, enter the password, and send the credentials back to the device to connect it to the network.
As soon as the connection was established, the device would be able to communicate with our cloud services using RESTful APIs and completing the rest of the necessary configurations crucial for the product’s smooth performance, such as push notifications which act as medical or appointment reminders for the users.
Drone Control App for Plant Monitoring
The purpose of the app was to help farmers track plant status, get immediate data of the plantation condition, and monitor the expected production. Checking every plant is not the easiest of tasks, especially for farmers who already have a lot on their plate. A drone control app would come in handy and lift a huge burden off their shoulders.
Our team created a mobile app which would run inside an Android-powered remote control of a drone, use a specific SDK provided by the manufacturer for controlling drones of a certain type, set schedules, and execute missions.
The app was also connected to a web portal through the backend service. In the web portal, operators could check the statuses of the connected drones and execute missions as well. An example of a mission is for the drone to take off, fly over Field 1 at a given altitude, take pictures every 1 meter, fly back, and send the pictures back to the web portal.
The drone could also receive interactive commands to increase altitude, fly back, take an instant image, etc. The mobile app was in the center of this system, it was taking the missions from the portal, sending them to the drone, etc.
The challenge with such apps is the drone since it can be quite unpredictable when you mess with its SDK directly. Our team needed to make sure that the app was easily scalable and could support different manufacturers with different SDKs in the future.
Greenhouse Control and Monitoring App
Another great example of an IoT mobile app in our team’s experience is the building of a greenhouse control and monitoring app.
We designed a complete solution for monitoring greenhouses as well as assigning daily tasks to the farmers working on-site.
The main challenge with this project or any project of this kind, for that matter, was the remote location of the fields which makes them out of the range of mobile networks. Additionally, it’s either too expensive or almost impossible to create Wi-Fi coverage in these areas.
This is why only one controller machine was designed per multiple fields. It acted as a controller and gateway for tablet applications. The latter connected with it through direct Wi-Fi connection and synched with it to get everyday assignments. Afterwards, farmers would go to the fields with their tasks on the tablet, complete them, take measurements and pictures, and create reports completely offline, and only at the end of the day, sync the data back to the controller.
As you can see, the demand for hardware dependent mobile apps is on the rise and will remain so for a long while since they make processes much easier and more efficient across all sectors and industries. We tried to showcase some practical examples of IoT mobile app development without overwhelming you with too many technical details. Hopefully, our experience will serve you as a beacon and help you navigate your IoT mobile app development journey wisely and successfully.
If you have any questions, our team would be happy to help you and provide you with more useful information on all things regarding app development. Additionally, go ahead and check our tech talks for more first-hand insights from our tech experts.
Transform your business with Volo
Ready to discuss your next tech project?