Publish data to particle cloud from my own server


I want to publish data to particle cloud from my own server. Argon device will be listening to the events and toggle led. Here I want to create my own server and publish data from my server to particle cloud. I am new to java script. I am not sure how to create my own server and publish data to particle cloud. Could you please help me if you have any example?

Hi, and welcome to the community!
The scope of an answer is kind of big.
You can create your own server by starting a linux VM in any cloud provider: Google, Microsoft Azure or AWS (or any!). Then you install node js in it, and code away something in js to hit the Particle API.

But even better, can you explain what you want to achieve? Maybe there are easier solutions…

@gusgonnet thanks for your quick response.

I don’t want to use any cloud provider like Google, Microsoft Azure. I just want to create simple server of my own and that server has to publish/send data to particle cloud. I will use Particle.subscribe() on the device itself so device will be listening to the events and toggle accordingly

for this you can install Linux in a server of your own:

then install node js in it:

Once you have that you can look at the ParticleJS:

And look at the particle API docs:

PS: you do not need a server right now, you can start coding away on your own computer, then create the server later on.

Thanks for the clear explanation.

Instead of installing ubuntu server,

I will install node.js in bash terminal and then I will manage/publish data to particle IoT device using

Is this works?

not really sure what you want to achieve ? get the data from some sensor and display in web browser ? or trigger some relay on/off ?
if this is the case so check this out:

on Linux you can use SimpleHTTPServer and run it with
python -m SimpleHTTPServer 80 (no needs for node.js)

also you can check this one but this is not so advanced as rickkas7 example but you can test it and run even without any server


@dreamER I have to create simple server. That server has to send data(ON/OFF) to particle cloud to trigger relay ON/OFF on IOT device. This device will be listening to the event and act accordingly.

I don’t want to send data to server/web browser from IOT device. Instead I want to send data from server to particle cloud.

If you want to send data (or a command) to a Particle device (one device, or just a few devices) using the Particle cloud, I recommend that you use Particle.function() in lieu of Particle.subscribe() on the device. You write a function to process the ON/OFF command, just like any other function that you would write for your Particle device, and then you declare Particle.function() in setup. Now you can use Particle’s API (https: POST) from your server (or from any Internet connected device) to call that function. The cloud function takes one string argument (but you can send the function many items of information by json or xml encoding the string). The function returns an INT if you need a return value. If you need to get back more than an INT in response to a cloug function call, you can create a json or xml encoded string and make it available to the cloud using Particle.variable(), which uses https: GET. See the Particle documentation at: Particle.function() - Cloud Functions | Reference | Particle. You can call Particle.function() and Particle.variable() by coding up web GET and POST requests, per Particle’s documentation. You can do this in any language that has http or web libraries. For example, we write Android apps to communication with Particle devices in MIT App Inventor 2, see: GitHub - TeamPracticalProjects/Connectivity_Tools_with_Particle_Devices: Document describing the IoT connectivity tools and techquies that we use with Particle devices.. We also used Particle’s javascript API to make cloud function calls and read cloud variables from a web page as part of our SIS project: GitHub - TeamPracticalProjects/SISProject: An IoT sensor platform based on's Arduino-like processors. Currently for monitoring an older person living alone, but a great platform to use for other projects too.

IMHO, you would only use publish and subscribe for your stated needs if you wanted your Internet connected device to send commands to many Particle devices at one. The many Particle devices would then subscribe to your web publication. However, Particle.function() is much better suited if you are sending commands to one (or a few) specific Particle device.


P.S. The Particle console provides wonderful tools for calling your Particle cloud functions and reading you cloud variables while debugging to firmware.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.