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.
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.
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