I get questions about LPWAN designs each week. The question below I will answer online, because it is a generic question.
NB-IoT / LTEM / LoRaWAN design question:
We’ve been in contact a few times a few years ago now (!), discussing low power wireless and RF topics.
Great to see how much you’ve developed your business and your interests.
For a few years now I’ve been working significantly with LoRaWAN, doing hardware and firmware wireless sensor designs for customers.
Very recently a significant new customer has asked us to design a combined LoRaWAN / Cellular (LTE-M/ NB-IoT) board. Cellular is pretty new.
I am currently selecting a suitable cellular modem. The idea is that we will run sensor applications on a specific (STM32L4… ) MCU, which will communicate with either a cellular modem or LoRaWAN modem via an AT serial interface (not simultaneously). This is a departure from the single MCU application + LoRaWAN stack that we use now.
Part of the design is of course identifying an application-level protocol.
There is one discussion on your site where you recommend CoAP for NB-IoT.
We will be starting with LTE-M, using NB-IoT a bit later.
Rather than CoAP (which I’ve used before) there is another choice now MQTT-SN over UDP, which is being promoted extensively by one manufacturer at least.
As a fan of MQTT anyway, going the MQTT-SN route looks like a really good fit.
So I was interested if you had any thoughts on using that over CoAP?
Good to say hello anyway.
Very best regards
NB-IoT / LTEM / LoRaWAN design answer:
In Germany, we say a picture says more than 1000 words. The English proverb is “A picture paints a thousand words.” The German and English proverbs are therefore very similar. Many words have been used by others in their answers so far but no pictures. So I will start my answer with a picture. The akorIoT Group has a reference design for a tracker with an open block diagram using the BG95-M3. We are therefore very familiar with the potential capabilities of the Quectel BG95-M3.
IoT protocols comparison
The above graphic shows the number of bytes required to transmit a message. The red area shows the necessary protocol overhead of the carrier: TCP/IP or UDP/IP. TCP/IP specifies that the telegram must be acknowledged automatically after transmission. If the transmission is negative or there is no acknowledgement, TCP/IP repeats the message several times automatically. However, if the acknowledgement is impossible for technical reasons, TCP/IP burns energy and bandwidth unnecessarily. NB-IoT is quite a new radio technology, however, data was already transmitted via radio before NB-IoT. A praiseworthy example is 802.15.4 with 6LoWPAN. 6LoWPAN is a transmission protocol on IP (PPP) and was specified for radio and wire. The layer above it is UDP (not TCP). If a radio channel is disturbed, then it generally makes no sense to start a new transmission of the telegram. UDP does not send an acknowledgement and does not expect an acknowledgement. If you elect to use UDP, then the acknowledgement must be done in the protocol layer above it. The protocol layer above UDP is usually CoAP in the case of 6LoWPAN. CoAP requires that a telegram is sent (with or without acknowledgement). This means that the programmer himself can decide whether he needs an acknowledgement or not. We serve a customer who has been using GPRS for over ten years and transmits his position data with a proprietary protocol based on UDP. 98% of his sent messages reach the server. Since the customer transmits every five seconds, the loss of a single message is unimportant. If you transfer this thinking to your design and use CoAP, then you can confidently do without the receipt, because 98% of the sent messages will arrive on the server. LWM2M is based on CoAP. LWM2M is a protocol layer above CoAP.
The structure as a glance
PPP => UDP/IP => CoAP => LWM2M
PPP => UDP/IP => MQTT-SN => not defined
PPP => TCP/IP => MQTT => not defined
In the akorIoT Group, we decided to use CoAP and defined the protocol layer above it ourselves. In addition, we have chosen an encryption method that is extremely secure and thus avoids the risk that third parties can read our data traffic. The encryption is from end-to-end and therefore neither the NB-IoT network operator nor other bad guys can read our communications.
The most convenient way with the highest energy waste is HTTPS with JASON. The most inconvenient way with the lowest energy consumption is NB-IoT NON-IP on UDP with its own protocol. It is also the way with the most barriers because NON-IP is not supported by all network operators. If you plan a local product for example only for Germany then you can use NON-IP without problems. If you plan like the akorIoT GROUP does Internationally, then NB-IoT with CoAP is a good approach. Whether you then use LWM2M above or your own protocol layer, is up to you. LWM2M is a convenient approach, because not only the profiles of the telegrams are regulated there, but also the login to the server and the device management. LWM2M can also be used with SMS or based on LoRaWAN. The background is that CoAP does not expect an acknowledgement or CoAP accepts an acknowledgement with extremely long runtime. Long runtimes are normal with TCP/IP and its compulsion for receipts will be the death of your battery.
I hope, I could bring a little light into the darkness with my graphics. Unfortunately many people still confuse the bearer and the protocol layers above the bearer. I, therefore, recommend that you take a quick look at the OSI layer model even if the TCP/IP or UDP protocol does not follow the layer model exactly.
Regardless of your earlier question, you can ask me for the reference design with an open block diagram and open addresses for all radio modules and sensors for less than €200. I am the co-founder of the akorIoT idea. I will then help her to make a custom copy of my own device or we will make the custom copy for you. The antenna in the reference design of the akorIoT SensPRO costs you zero Euro or zero Dollars. The antenna cannot be transferred so simply, because this antenna changes depending on the size of the board and the housing. We therefore always adapt the antenna to the customer’s specific requirements. So if you want to make the copy of our reference design yourself, we will only take care of the transfer of the antenna to your physical design if necessary.
Using LWM2M you get on CoAP, SMS or LoRaWAN. LWM2M contains device management and a lot of more features as well. Nevertheless, it makes maybe sense to copy the basics of the akorIoT SensPRO to your new PCB.
harald.naumann (at) lte-modem.com
2 CommentsAdd a Comment
Thanks for the reply.
MQTT-SN typically talks to an MQTT-SN enabled MQTT broker. So your diagram might read:
PPP => UDP/IP => MQTT-SN => MQTT.
Most of the comparisons around are between LWM2M and MQTT, whereas I haven’t really come across anything that compares LWM2M with MQTT-SN + MQTT, perhaps because MQTT-SN is relatively new and is still developing.
Ron, the main diffrence od MQTT and MQTT-SN is that the offere no layers for the devices managened and message profiles.
PPP => UDP/IP => MQTT-SN => MQTT-SN to MQTT relay (broker) because the MQTT server is waiting for TCP/IP based messages.