Telit Cinterion IoT Developer Community
Serverless computing demo - using Telegram messenger for communication with your IoT device
Showcase, August 26, 2019 - 9:57am, 5806 views
"Serverless computing is a cloud-computing execution model in which the cloud provider runs the server, and dynamically manages the allocation of machine resources."
When implementing a serverless architecture system, pricing actually looks at the number of executions, the usage, as opposed to pre-paid compute capacity. In other words, it’s cheaper.
Cloud vendors are a crucial part of Serverless computing. There are three different types of cloud vendors:
- IaaS (Infrastructure as a Service): This particular service denotes renting different infrastructures such as Virtual Machines, Servers, Storage, Operating Systems, and Networks.
- PaaS (Platform as a Service): Utilized for software development, in addition to software testing and software maintenance. Unlike IaaS, PaaS denotes extra tools - DBMS, BI services etc. Otherwise, it’s the same as IaaS.
- SaaS (Software as a Service): This service makes the users connect to the applications through the Internet on a subscription basis.
At present, there are quite a few top-notch cloud vendors out there. Going with this option, you are really off-loading a lot of baggage in terms of development impracticalities. It’s your choice, of course, but you can’t go wrong with any of the following cloud vendors:
- Google Cloud Functions
- Amazon Web Service
- Microsoft Azure
- IBM OpenWhisk
- and more
Serverless Architecture Pros:
Though not a magical wand serverless architecture does offer a couple of amazing advantages.
Pricing. One of the biggest advantages of Serverless computing is, of course, low pricing. You pay only for what is used. On top of that you are reducing operational costs ie years of server-related fees and capacity that has been pre-purchased - basically, all of that is now money saved.
Reduced maintenance. With no backend infrastructure to manage, as it all falls to Cloud vendors, you are free of maintenance problems you’d have if you’re running a server on your own. That includes updates, patches and taking care of potential hacks.
Scalability. Serverless architectures are inherently scalable allowing your application to, for example, scale automatically as the user base grows or usage increases.
Demo project - Using Telegram messenger for communication with your IoT device
This demo project allows you to control TV, A/C, etc. from your smartphone. It sends and receives infra-red remote control codes via Telegram messanger channel.
In this demo project the following components are used:
Cinterion concept board + SIM card
Telegram Bot Token - copy into your .JAD file
Connect Infrared decoder to Arduino pins on the Concept Board- Tx, Rx, 5V, GND
With the help of Concept Board DIP switches route the ASC1 intrefcae to Arduino RX/Tx.
Send this command to enable ASC1 - AT^SCFG="GPIO/mode/ASC1","std"
Java midlet running in the Concept Board makes Telegram Bot API calls to send and receive messages and repond to user button clicks in Telegram channel.
Using Telegram messanger in IoT applications has several benefits:
- Telegram servers will store the messages for at least 24 hours - your device may be sleeping most of the time to save power.
- When user starts communication with Telegram bot, the Java midlet that control it gets access to user first name (useful for nice greeting), user email (useful for sending notifications later).
- Telegram messenger supports emojis, stickers and buttons, see screenshots
- Telegram is hosted on the Amazon cloud, that makes it flexible, scalable, reliable and secure platform.
- This approach does not require any server side development.
- It's free