The CloudIn widget periodically retrieves numeric data from cloud services such as data.sparkfun.com and particle.io. This data is typically published by another device. Because cloud services limit the frequency of data accesses, the widget waits for a set period between each access (10 seconds by default).
Instructions
1 Set up cloud service
Before you can use the Cloud widgets, you must set up your cloud service and get the right information to put into the widget’s more tab.
- data.sparkfun.com – This is one of the easiest to use cloud services. Go to the New Stream page, and fill out the required fields to set up a stream for the Cloud widgets. Once you’ve done this, you’ll get the necessary info such as “public key” and “data field”. Note that the Cloud widgets only work with a single “field” set up in your data.sparkfun.com stream.
- particle.io – once you’ve set up a Particle device (Photon or Spark), it will have an individual Device ID, and all your devices will have the same Access Token. The CloudOut widget is configured to work with a Particle device set up with the standard Tinker sketch from Particle running on the device. If you want to be able to use a servo with the Particle device, you’ll need a modified version of Tinker called tinker-ntk.ino that needs to be flashed to the Particle device.
2 Select service and set
In the more tab, select a cloud service from the drop down. Each service has different information that needs to be entered into the CloudIn widget so that it can access your account. Set that information in each of the fields.
These usually include:
- One or more security keys
- The name of a data field
- For a cloud device like the Particle, a pin ID
- If the service can be run on your own server, a URL may be necessary. For example, the data.sparkfun.com service (called Phant) can also be installed on your computer or server, and you can then access your own cloud service at that URL. This also allows you to avoid the data frequency limits on the commercial service.
3 Set the update frequency
By default, the Cloud widgets check the cloud service every 10 seconds (10,000 milliseconds). You can increase or decrease this time, but be aware that most services restrict the number of requests per minute. So if you set or request data too frequently, the service will stop responding.
4 Connect
Once you’ve set the key, you should check the input box in the upper left corner of the widget. This will start the timer to retrieve values.
5 Adjust range
Like the AnalogIn widget, you can adjust the range of the data arriving from the cloud.
- Output range min and max – These allow you to scale the incoming values to start at min and end at max. For example, typically sensor values range from 0-1023. Changing max to 500 would scale those values to have a range of 0-500.