How to connect to Spark Cloud and pass the info from smart device

Hi Guys,

I am a newbie …pardon my basic questions here…

We are planning to develop a smart device which would post some information onto the spark cloud during its operations.

Had the following questions:

  1. Wanted to understand how the handshake would happen between my smart device and the spark cloud.
  2. Where inside the cloud can my smart device write the information,can it write it into a file or a database etc

Greatly appreciate help in this regard.


  1. the handshake will be handles by the firmware and nothing needs to be done by the user. All the configuration required wpuld be setting the wifi credentials

  2. Right now, there is no storing of information on the cloud. It’s more like accessing it through the API and saving it in your own storage/server

Soon, the Spark.Publish() feature which works like a key value store will be available but still, if you want to log/store all the information, you need a program/server to grab them through APIs and save it

Welcome @SRIRAM0506 — thanks for asking the question!

As @kennethlimcp said, you really don’t need to worry about the communication with the Cloud. The :spark: Core takes care of all that for you. Thus, you get to focus on making your own product great and can trust the connectivity to us!

Smart devices usually come in at least two pieces:

  1. the hard device itself that must be connected to the internet
  2. a web application that communicates with the device using the REST API

When you want to write data from the device to “the cloud” — you really mean your own web application, but the messages pass through the Spark Cloud.

If you want to understand better how the Core and Cloud communicate, you should look at the core-communication-lib, which is open source:


Thanks a lot for all your inputs.

Here is what I were thinking and may be you guys can guide me on how to accomplish it ,perhaps suggest a better way:

  1. We have various Bluetooth/RF sensors that we want to connect to a central SPARK Core (SPARK to be used
    as a hub).Each sensor will send a status e.g. ON /OFF (not sure if this is the best way to do it )
    Q1. Can SPARK Core be used to consolidate the statuses received from the sensors,or we need an additional
    micro-controller +circuitry to accomplish this ? (in short can SPARK be use as a HUB ?)

2.We will have a SPARK Core write the statuses from our sensors to the internet
Q1. What does the SPARK Cloud do ?
Q2 Is the SPARK Cloud mandatory to pass the info from the device to the internet ?
Q3. Are we mandated to develop our application on SPARK Cloud ?

  1. If we have to build our application on SPARK Cloud (e.g. install our webserver etc on SPARK Cloud),as of now how do we retrieve the contents that the SPARK Hub would have received from the sensors ?
    do we write a program on the SPARK cloud to PULL the information (believe till the publish feature is made available)?

Appreciate your inputs.

Thanks a lot!

@SRIRAM0506 I’ll try to answer each of your questions here:

1Q1: The Spark core could be used as a hub to consolidate the statuses of your sensors. You will definitely need additional circuitry to receive bluetooth messages as the Spark Core does not have bluetooth on board. The micro-controller is fairly powerful on the core (STM32), so you might not need an additional one, however, the Core shares CPU cycles between connectivity logic and user firmware, so it could potentially simplify your coding if you had a dedicated slave micro-controller to deal with bluetooth/RF connectivity exclusively.

2Q1: It securely and reliably facilitates communication between your device and the internet via a REST API ( and your firmware (
2Q2: No. The Core can open up TCP or UDP connections to anywhere on a network. If you’d rather avoid the Spark Cloud altogether you can do this as well.
2Q3: No. You can create your own cloud, in fact, you’ll need some additional servers to store information long term–Spark Cloud can help facilitate the gathering of information of sensors, but it’ll be up to you store it. Spark.publish will be released very soon (likely within the next couple of weeks), so as of right now, you’d write a program to poll + pull information, however, you’ll soon be able to push information from the core as it’s generated.

Hope that helps!

Thanks for your comments as it helps me understand more about the communication scheme being used but, I do have a couple questions as such.

  1. Once Spark Cloud is made available for use in a local server environment will it still be a API Rest access only to control the pins on Spark Core ?

  2. If so, how can one by-pass the cloud and access the pins via an IDE similar to how the IDE is used on an Arduino ?

In other words if I may, can the Spark Core be controlled without hiring a software programmer ?

  1. You can control pins, read/write variable and call functions like the existing APIs provided
  1. Maybe you can elaborate slightly here. The Arduino IDE is like the Spark Cloud IDE. Both provides a platform to write your code and download to your device. You don’t actually access the pins through the Arduino IDE.

What’s your application requirement? Basically, think of the :spark: as an Arduino-compatible device with much more capabilities.

You write your own user code and download it to the core and get your project running. If you are the one programming the core then you’re effectively the software programmer.

Software programmer for which area are you referring?

Hi, thanks for reply. I am able to use HMTL via browser to run ide commands directly to an Arduino. Standard HTML links using IDE coding resulting in a webpage control of an Arduino. HTML Code running IDE parsed links in a web browser can be done by a 7 year old; very easy. HTML is also works on all platforms: Android, iOS, Linux, Windows, and all browsers.

Yes, it is true that I do flash code to the Spark Core like an Arduino but, how does a user rename a Tinker Pin 1 to LED 1 ? or A1 to Temperature ? without coding the API / xml ?

Am I wrong ? Is there something that I am unaware of to make these changes at a user level; like in a xml file. Or, is it the case that you need to be a Android java programmer to make or modify the API Android interface to change the user interface, i.e, Pin 1 —> Kitchen Light ?

Update Reason: 17 Errors in API Source from Github using Eclipse.

I just wanted to add why I am asking. I followed the instructions for inclusion of fonts and the Ti SmartConfig.jar in to the Spark Core API source code. Then I imported the code as instructed. The result of which was 17 errors and 1 warning in Eclipse. It won’t run in debugger in this state so I obviously have a learning curve called, Become an Android programmer.

This Spark Core is awesome. The Cloud is awesome but, sometimes simple and back to basics or option thereof is even more awesome. Most of my products will be controlled by an user from within their own local network not requiring the cloud. No product will be successful if its not very, very, very simple to use.

Hi again @spydrop,
as mentioned in this thread there are different ways to communicate with the Core (Cloud API, TCP/UDP, wired USB/USART/SPI/I2C).
But to use them the Core must run a firmware (sketch) to communicate with - just as on Arduino.
So when you say that you communicate with an Arduino via HTTP, what sketch is this Arduino running?
Since in Arduino the pins are referenced by numbers - and likewise on the Core - the translation of a pin name into its number is something either the firmware does or you have to do in your request - so I don’t quite undestand your renaming question.

Maybe you could elaborate this a bit more in a dedicated thread by using the “Reply as a new topic” so that we don’t hijack someone elses thread :wink:

As for your build problems with the android-app you could come back to “my” thread above, so we might be able to sort this there without hijacking again (I had some starting problems too, but they weren’t to hard to track down and squash).

I was just looking for an answer to this topic “How to connect to Spark Cloud and pass info from smart device” wherein my question was, Is it mandatory to use and Android API as a user interface for a user control interface. It was another person who asked me to explain in detail concerning Arduino being controlled via HTTP.

Yes, HTTP being the Ethernet Library of all things being easy example code:

HTML Page link --> <!’" value=“LAN ON”>

Arduino IDE Code --> client.println("<! a href="/?button1on"">ON");

if (readString.indexOf("?button1on") >0){
digitalWrite(led4, HIGH);

= Go High on Pin 4 via a HTTP Request. Very Basic Anyone can do this. Very Few are Android API Programmers.

This option is also possible in the Arduino Wireless Library as well.

Regardless, I will open a new topic.


I see now what you meant @spydrop.

To answer this and the same question here and there

  1. No, you don’t need any Android or iOS app to call the REST API - there are lots of alternatives mentioned in this forum (e.g. Node.js, curl, web apps like this and this, …)
  2. No, you don’t even need to use the :spark: Spark REST API (neither cloud nor local as it gets open sourced), since you could do it the way Arduino does it via TCP/UDP, but for this you’d need a sketch running on the Core that behaves like your Arduino sketch + libraries.
  3. The above codeline “digitalWrite(led4, HIGH);” of the Arduino sketch would run all the same on the Core once you “#define led4 (4)” e.g. for pin D4 or “#define led4 (14)” for pin A4 - I guess you’ll find a similar line somewhere in your Arduino sketch too. The “names” for the pins are just to “help” users and programmers remember what they are talking about and are of no significance to the µC. Much the same “button1on” and the translation logic for it are just an additional “abstraction layer”.

I hope this does actually address your questions in any helpful way.

1 Like