The CloudOut widget periodically sends numeric data to cloud services such as data.sparkfun.com and particle.io. By default, it sends the last value the widget received at the time of the send. If avg inputs is checked in the more tab, all values received during the period are averaged and the average is sent to the cloud.
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 Spark, 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 data 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
Click on the checkbox in the upper right to connect to the cloud service.
5 Particle Port Notes
The Particle Photon had different ports available for Digital and Analog outputs than a traditional Arduino. If you prefix the CloudOut widget port name with a “D” it will be treated as a digitalWrite(), an “A” will be treated as an analogWrite(), and an “S” will be treated as servo.write().
Check this particle documentation for details.
Particle Photon Port Availability
Dx – digitalWrite():Â All GPIO pins (A0..A7, D0..D7, DAC, WKP, RX, TX) can be used as long they are not used otherwise (e.g. as Serial1 RX/TX).
Ax – analogWrite():Â this function works on pins D0, D1, D2, D3, A4, A5, WKP, RX and TX with a caveat: PWM timer peripheral is duplicated on two pins (A5/D2) and (A4/D3) for 7 total independent PWM outputs. For example: PWM may be used on A5 while D2 is used as a GPIO, or D2 as a PWM while A5 is used as an analog input. However A5 and D2 cannot be used as independently controlled PWM outputs at the same time.
Sx – myServo.write(): if you specify the port as “S0†or “S1†connects to ports: D0, D1