We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X

Cloud Computing in IoT

Through cloud computing, microcontrollers can perform very resource-intensive computations by outsourcing the work.

Some of the biggest challenges in traditional embedded design are computing and storage. Microcontrollers, by their very nature, have limited storage and throughput. These challenges have been mitigated by making embedded code efficient and to the point. But even with the most efficient code, there are still many applications a microcontroller just cannot do. 

These throughput and storage limitations are somewhat lifted through cloud computing. Through cloud computing, microcontrollers can perform very resource-intensive computations by outsourcing the work.  

What is the Cloud? 

Whenever you hear the term "cloud," it’s easy to immediately think of storage. A place to store your files, backups, settings, etc. And while storage is a big part of the cloud, one could argue that cloud computing, especially for IoT devices, is a much bigger deal. 

Cloud computing is the concept of offloading work away from the device in question. This makes it possible for relatively inexpensive and small microcontrollers to perform tasks that require a lot of computational power.  

Example of Cloud Computing: Automatic Store Door 

Imagine the following application: A door to a store that opens automatically whenever a human is in front of it. It should not open for other moving things such as pigeons, making the traditional motion sensing solution infeasible.

To solve this problem, one can use computer vision. Take a picture, if a person is detected, open the door. Computer Vision algorithms typically require a significant amount of processing. A system with only a microcontroller would not have the throughput to perform a calculation to identify a person in a picture. This is where cloud computing comes in. Send the picture to the cloud, have it perform the calculation and send the result back to the microcontroller. If the cloud says, “Yes, there is a person there,” open the door. 

Some of the major advantages of this are cost and simplicity. There is no need to have an expensive computer on-site with complicated software, a simple and inexpensive microcontroller can do the trick by outsourcing the work to the cloud. Two more benefits include scalability and efficiency. If you have several doors in your store, you only duplicate the microcontroller and the camera. The cloud solution is reused by having all the devices connect to it. 

It is built using an AVR-IoT WG Board, a stepper motor and a stepper 2 Click board™ to drive the motor. Weather data is fetched from an external weather forecast provider. This data is parsed and translated to a clock-hand position. This is where cloud computing comes in. The code on the microcontroller controls the motor and listens for a simple message from the cloud which tells it where on the clock face to point to. The more computationally heavy tasks are handled by the cloud entirely. The microcontroller is oblivious to the fact that it shows the weather. 

Cloud Configuration 

The weather clock uses the AVR-IoT WG board, which connects to the Google Cloud Platform (GCP) out of the box. The board is added to a GCP project by using the IoT Core module. Simply open the module, add the device and enter its ID and public-key. As the board is pre-provisioned with GCP, a secure connection is automatically created. 

As alluded to above, the weather clock needs forecast weather data to process and send to the clock. Fetching and processing of the data are done through the Cloud Functions module. You can add your code by creating a cloud function and inputing it there. This can be scheduled to run with a given time interval, or whenever an event occurs. 

As the GCP is modular, you only add the module that is right for your project. For instance, the automatic door example would perhaps use the Vision module, which offers a pre-trained neural network to identify objects in images.  

Introducing the Weather Clock 

To discuss how to integrate a cloud solution in your IoT projects, we’ll have a look at the Microchip Weather Clock, a demo intended to show a simple IoT cloud project. The weather clock has weather symbols and temperature on the scales instead of time. Depending on the predefined location, the clock hand rotates and points towards the current weather. 

Conclusion and Further Reading 

By using the cloud as a computation resource and not just a storage resource, you will open the door for inexpensive, simple and elegant embedded solutions. Easy-to-use development boards such as the AVR- and PIC-IoT WG boards can do very resource-heavy tasks by outsourcing the work.  

If you’d like to learn more about the weather clock, the embedded code, cloud solution and construction read the Home Automation – Weather Clock User Guide, available here: http://ww1.microchip.com/downloads/en/DeviceDoc/Home-Automation-Weather-Clock-DS50002962A.pdf

The AVR-IoT and PIC-IoT Boards are available with both Google Cloud Platform and AWS Cloud. For more information about these board, visit one of the following links: 

For more information on how cloud computing can be used in your IoT projects, please tune in to today’s Microchip IoT Design Week 2020 livestream, where we’ll discuss cloud computing as a tool in home automation. 

Johan Lofstad, Mar 9, 2020