Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a website to communicate with an embedded device

I'm currently working on a project where I'm trying to control an embedded device through an Internet facing website. The idea is is that a user can go to a website and tell this device to preform some kind of action. An action on the website would be translated into a series of CLI commands and then sent to the device. Communication could potentially go both ways in the future, but right now I'm focusing on server-to-device.

The web server is a LAMP stack using Python (Django) and the device I'm trying to communicate with is a Beagle Board running eLinux. There would be only one device existing at any time communicating to the server.

I have all the functional parts written on the server and device side, but I'm having a bit of trouble figuring out how to write the communication layer. One of my big issues is that the device will be mobile and will be moving locations every few days. So, I can't guarantee a static IP address for the device. My networking programming knowledge is pretty minimal so I don't have that great an idea on where to start.

Does anyone have any ideas/resources on how I can start developing this kind of communication?

Thanks!

like image 377
user459998 Avatar asked Sep 27 '10 23:09

user459998


3 Answers

You can simply register a dynamic host name using a provider like DynDNS and have the device update it's IP on that website so the dynamic hostname always points to the device IP - there are plenty of clients, scripts etc. available for Linux that do just that.

like image 150
Jim Brissom Avatar answered Nov 14 '22 19:11

Jim Brissom


If the server is going to be static, you could always get the device to establish a connection to the server to report it's IP address.

You could write a simple UDP server for the device to listen for incoming communications and then write a client in python for your web server to call.

like image 23
Jon Cage Avatar answered Nov 14 '22 18:11

Jon Cage


My normal mode of conduct (certainly as it could have to go through NATs and the like) is to have the device set up a reverse SSH tunnel that just 'calls home': http://www.howtoforge.com/reverse-ssh-tunneling

Mind you, SSH connections break from time to time, so I'd set a heartbeat method on the server, and if the client (Beagle Board) misses a set amount of heartbeats, let it destroy the tunnel & create a new one.

like image 2
Wrikken Avatar answered Nov 14 '22 18:11

Wrikken