Since I am mostly hardware and control engineer myself, communicating through web is quite hard to implement even the basics.
Sending and fetching data through serial port is working and also tested with particle cloud.
Now I would like to know if I can have my own server connected through a router and set it up like particle cloud server and let the particle electron subscribe as client.
I just want to send several bytes per every 10 seconds and send ack to confirm the data is well received to its destination.
Is there any easy step-by-step solution to this? or any reference to look at?
Any help would be much appreciated.
There is no available software to make a private cloud for the Electron, E Series, Argon, Boron, or Xenon. It’s not impossible, but to my knowledge, no one has done it.
However you don’t need to have full cloud support to communicate with an Electron. You can do so using TCP or UDP. There are a couple caveats to that, however:
For TCP, the Electron cannot be a server, so your server must be the server, and it must have a public IP address and firewall hole/port forwarding, since the Electron data communication is from the public Internet.
For UDP, a temporary port forwarding is set up in the mobile carrier network so data can be sent in both directions, but the Electron must always send data first and eventually the back-channel will time out (in 23 minutes).
However the more common scenario is to just access the Particle Cloud API from your server. This is easiest in Javascript using node.js and particle-api-js, but the REST API can be accessed from any language. Then you can use Particle publish and subscribe from your server and don’t need to mess with your firewall.
There was an official “spark-server” local cloud project, but it hasn’t been updated since 2015. It might be possible for somebody with more time, energy, and motivation than myself to update it and make it work with the current firmwares?
I haven’t looked at it to see how involved that might be. I actually wonder if it might be easier overall to just implement a stripped-down work-alike server and corresponding device library that just implements a few of the most common Cloud features (pub/sub, variables, functions). Maybe instead of “Cloud”, it could be called “Mist” or “Fog”?
Yeah, my fork has been updated a lot since the original and has a lot of improvements. It doesn’t support horizontal scaling so you’re right that it’s not much of a cloud. Some people are using it in production with a load balancer to get around that though.
Thanks for your work on the fork. Unfortunately it looks like mesh device support might take more than a few tweaks since they only seem to support UDP.
Just tried on a Boron LTE:
$ particle keys server ./default_key.pub.pem --host x.x.x.x --protocol tcp
Make sure your device is in DFU mode (blinking yellow), and is connected to your computer.: The device does not support the protocol tcp. It has support for udp
As a total alternate approach - install a copy of Thingsboard (www.thingsboard.io) on a local raspberry pi https://thingsboard.io/docs/user-guide/install/rpi/ . Use the MQTT library to publish JSON strings to it and show the data on the dashboard - this is a free product that should be easily able to do what you want.