I have written about IoT communication for about 3 months now. It started here. This is the 10th and final blog post on that topic at least for some while. I choose to discuss something with less of coding but more about reliable communications. So let's get right into it.
Not many times people consider the mobile service provider for their IoT data needs because they can change the plan anytime. But does it really matter? Well, it does. Before you disagree let me explain it to you.
Typically, when you choose a mobile carrier, you are charged by the data you consumed either prepaid or postpaid. Normally we call them data bundles in our country, Kenya. On your phone, there are possible connection speeds that you can have, 4G, 3G, EDGE, GPRS and your phone switches between them automatically unless you choose to override. Each of them offers a certain maximum speed but you are still charged for the data you consume.
In your IoT project, 2G (GPRS) will largely be enough but there are times you need more. Best example: you are uploading videos or downloading large files. Though the scenario is not common, one would find it a good choice to use 3G by default but fall back on to 2G if 3G is unavailable. The content being downloaded/uploaded can now take a shorter time and hence increase the battery life or reduce power being constantly consumed.
The choice of the carrier here would need to be one who offers 3G or 4G and yet your hardware and SIM card need have support for the same.
As mentioned earlier, the carrier would charge you per usage. Normally, prepaid plans are cheaper than postpaid ones. Example, if you purchase 10GB of data, it will be cheaper per MB than when you pay as you go.
How do you choose the right one? It is not an easy choice because you have to involve your finance department. Hopefully, you are in good terms. In general, corporates agree on pricing or special rates mainly because they purchase in bulk or are in a long-term business relationship.
Wait, that is just normal! Why does someone have to blog about it? Well, there's one more. It's reliability.
In Kenya, there are three mobile service providers but one of them, Safaricom, has a large share. I consider it to be over 50%. A number of people complain about their billing discrepancies but for IoT, it is not as important.
Last weekend, I was doing a test with Azure IoT hub and with the public MQTT broker at iot.eclipse.org but I wasted a lot of time troubleshooting what was a problem with the service provider. At first, I was using Airtel Kenya. As shown on other blogs, here and here, I use a lot of GPRS modules, mainly SIM900. Basically, if the modem had acquired the network and/or could do calls/SMS then it was good for GPRS. In addition, all the service providers in the country offer GPRS and 2G. I run the tests over a period of 4days, 10hours each. This is what happened.
1) Dealing with Azure IoT hub
Creating the BSD socket worked fine. Performing the SSL/TLS handshake worked fine. MQTT connect worked almost always. Unfortunately, MQTT publish and ping packets worked a maximum of 5 times a day.
2) Dealing with public broker at iot.eclipse.org
Creating the connection, performing SSL/TLS handshake and even MQTT connect worked. With the PING interval (aka keep alive) set at 20seconds, the failure rate was one in every 7 requests. PUBLISH packets seemed to work okay since they were few.
Unlike the Azure IoT hub, this public broker has no database for stored session, it does not verify client credentials and more. In general, it's functionality is a bare minimum.
At first, I thought my code was a problem but the fact that it worked with the public broker trashed the thought.
Secondly, I thought the Azure IoT hub had a problem. So I went to on to try it using a Windows program and it worked okay. I then connected the network cable to the development board and it was all okay.
Thirdly, I tried to change the module I was using but I had the same problems of failing packets.
At about 12am on Sunday, I got the random thought to change the SIM card and surprisingly it worked from the first attempt.
What I learnt
In Kenya, Safaricom is the only provider offering 4G at the moment although it's coverage is limited. This means that the 3G/2G reliability must remain great until they are able to widen the coverage of 4G in the country. This is the carrier whose SIM card worked on the first attempt as above.
Using a reliable carrier is an important step towards a successful IoT project.
I hope that through the series of posts someone has gotten some insight into their IoT project and possibly added some thought to it. I cannot promise to keep the posts up to date but if I write new posts I will surely link them. In case you have any question or comments do not wait for next time just see go ahead in the section below.