Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases

Data transfer over internet via http or another protocol.

Hi Guys,

I am currently working on my own IoT project. In my device there are some inputs and outputs. I want to control my device remote over internet. I have more than one device to control and that devices have static ip, so ip adress is changing all the time. It means ssh connection to control the devices is bad idea because ip is changing few times in every hour.

The connection algorithm is something like this.

İf one of the device input changes=>send request to server and tell the parameter has changed. If server took any changes in a parameter=>send request the user client to tell the parameter has changed.(or users sends request for every 5 seconds to ask is there an any change in the device)

If user client changed a device output=>send data to server to tell an output data of device has changed

If server took any changes in device output parameter=>send request to device to tell the output parameter has changed(or device sends request for every 5 seconds to understand if it should change any output value)

I need to create a server side. The devices should connect the server and users too will connect to server. So I have some clients and one server.

My first question is if my devices connects to server as a client. And sends request for every 5 seconds. It means my device will response my changes in a 5 seconds delay. And I dont want delay. In the same time if there are no changes in the server, my device will send nonsense request to server and make server busy. So is it possible to send request to client from server?

Same problem for user to see if there is an any updates in the server. I need to send request to client from server because I dont want delay.

My second question is can I change a data in a file with php? I am talking about editing a file like txt file... Or is there an any alternative way to do this projects' server side?

What do you suggest?

Thanks in advance and I am sorry because of my bad english...

3 Answers

It is really hard to advise you without know more details of you IoT project.

There are a whole variety of wireless technologies (including Zigbee, Z-wave, 6LoWPAN, WiMax, etc) --mostly concentrated on putting together "mesh" networks that support extremely low power device of very short distances.

However, it sounds like your device is using data transfer to an Internet server over a wired connection.

Besides HTTP, though, they are protocols like MQTT (MQ Telemetry Transport) and CoAP (not very secure but good for power constrained devices).

Many MQTT implementations use something called "data streams":

https://developer.ibm.com/streamsdev/2014/03/01/streams-internet-things/

There is even talk of "data stream networks" evolving in various forms:

http://iotdesign.embedded-computing.com/guest-blogs/why-you-need-a-data-stream-network-for-the-internet-of-things/


But overall the IoT thing is happening very much from the "ground up".

That means that no big commercial consortium is "pushing" the technology,

(although many are trying to adapt to support it somewhat),

thus the protocols (including data communications) ,

and any worldwide "community", are still very much

in the "nascent" (still-under-development) stage.


Here's one article related to this:

https://pinocc.io/blog/building-the-internet-of-things/a-single-protocol-for-the-internet-of-things/

That article talks about going down the 7 layer OSI model:

https://en.wikipedia.org/wiki/OSI_model

..moving from FTP to level 4 protocols like TCP and UDP (but

I don't know if you want to go that low).


One forum I've found for IoT questions that's not totally hostile to "noob" question is this one:

http://iot-playground.com/forum/index

...and I'm sure there are others if you google around a little.


Bottom line:

Finding specific answers for specific IoT projects/devices is going to take some more specifics (like Raspberry Pi versus Arduino, drivers used, which O/S (probably Linux variant) used, etc.

Good luck with your project, though...sound interesting.

And if you know better community to ask questions like this please let me know :)

Hi James,

Thank you very much for your answer. It was very informative with so nice keywords for google :) I am currently reading the community forum you have shared. And reading about MQTT, XMPP etc. I will write here and update you when I found something if you interested about my project.

Thank you very much again, keep follow this discussion. I am sorry about my bad english, have a nice day.