Linux – Connecting a Embedded Device from Cloud

embeddedlinux

I am working on a Embedded Device using Linux operating System. The device is having a local database for storing sensor information and motor state. This device will be used for controlling a motor and getting some sensor data.

I made a node.js based webserver on this device and made some GET API's for getting the data and controlling the motor also. ( On Local LAN ).

I have to control more number of device using cloud
And also I am having a Server with Linux Operating System. (PC).

Now My Question is:
How to Control All my devices connected on local lan with internet connectivity,
from my Linux Server individually.

I mean, my Linux Server is not aware of my deices's IP and even my devie is not directly accessed from Internet.( because Routing is difficult ).

I need suggestions……Please help me.

Best Answer

It's easier to tell all your devices "where the server is" than it is to tell your server "where all the devices are". It's much easier to ensure that a single server is reachable from all your devices than it is to ensure all of your devices are reachable from your server.

So normally you would have the embedded devices connect to the server rather than vice-versa. If you need to be able to request/control stuff then it's pretty easy to keep a TCP connection open continuously. Just make sure you put in place a protocol for checking the connection is still alive and if-no reestablishing it.

Depending on deployment scenarios it may be acceptable to hardcode the server address when the embedded devices are built or it may be nessacery to make that configuraable.

Related Topic