How to Use Cloud Storage for Memory
2019-10-11 | By Maker.io Staff
Wireless Wifi Arduino Adafruit Feather micro:bit
Most projects that require memory storage will often either use onboard memory on a microcontroller (such as internal EEPROM) or an external memory IC (such as a serial EEPROM). However, some applications may call for cost-effective solutions where the inclusion of dedicated memory storage adds too much to the final production cost. In this scenario, the cloud can be used for more than just sensory data, so in this How-To, we will look at using the cloud for memory storage!
Cloud Memory Usage
Any device that has the capability to connect to the internet also has the capabilities of the internet and the resources that can be accessed via it. While this includes complex services such as AI processing and communication between remote devices, it also includes simple routines such as retrieving and storing information. Using the cloud for memory storage, for example, can be used to a designer’s advantage by removing the need for IoT devices to have large non-volatile memories for storing information. How this is implemented, however, depends on many factors, with its own advantages and disadvantages.
Using cloud storage, then, what data could you potentially store off-device?
- Configuration settings such as preferences
- Large sensor readings
- Simple audio files
- Simple interpreted applications (such as script files)
Cloud Services
In order to use the cloud for storage, a service is required, but the service itself does not have to be advertised as a cloud service. For example, services such as Adafruit.IO and Amazon Web Services can allow devices to submit and retrieve data, but a simple website can perform the same action. In fact, a simple free web-hosting service can potentially provide more storage capacity than a cloud service, as cloud services are often geared towards simple data packets (such as sensor readings) as opposed to whole text files.
A simple PHP page with a text field and submit button can be used by a device to submit large amounts of text (which would be generated in software), which is then saved into a separate text file on the web server whose name could be unique to the device. Then, a GET request made by the device allows the same device to retrieve the information stored previously (whose size would be too large to store in non-volatile memory). However, this method, if employed in a commercial product, would require login methods, usernames, and passwords; considering that such systems are already used en masse (forums, social media, banks, etc.), treating each device as a unique user that can access its own dedicated online file is neither complex nor unheard of.
If a web service is impractical or inappropriate, then a dedicated custom IoT server could be created using software such as the .net framework or even Python. A computer system connected to the internet via a static IP address (or connected to a service to provide a static IP address) would run a server application, which looks for incoming connection requests and then process those requests. As the server runs on an operating system, the full power of the OS can be used by the device with the server acting as a bridge between the two.
Non-Internet Enabled Devices
Not all devices are able to directly access the internet, such as Micro:bit, PICs and AVRs, however, these devices are still able to take advantage of cloud services and storage with the use of bridges. Instead of connecting directly to the internet, devices that lack internet connectivity can use communication busses such as UART, SPI, and I2C to interact with devices that do have internet connectivity. A simple API can be loaded onto the internet-enabled device, which can allow it to make requests on behalf of the connected device and then send data back to the connected device when internet services fulfill requests. For example, a Micro:bit can be connected to an Adafruit Huzzah32 via a UART link, and the Micro:bit can use the Huzzah32 as a serial terminal. Strings sent to the Huzzah32 over UART can be interpreted as HTTP text, which would allow the Micro:bit to interact with webpages without the need for a built-in Wi-Fi module.
Another way that some devices can be connected to the internet is by using the aforementioned methods through a pre-made software platform such as Atmosphere. Atmosphere IoT takes the SDKs of several chipsets and implements them onto their platform. This platform is made to not only allow users to easily drag and drop elements into a program that creates actual binary files that can be used with the physical hardware, but it also is used to help get data to the cloud. Atmosphere has created a section of their platform that is dedicated purely to sending data to the cloud, being able to retrieve that data, and perform several high-level tasks within the cloud.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum