Pull data from Arduino

Dear All,

This is my first post to openremote community. First of all, I would like to thank you for this high quality opensource product.
I would like to include my household IoT devices to openremote. I’m starting with Arduino where I can use UDP to TCP GET/PUT/POST, and I wanted to check if someone has an example on how to program this on both site openremote and Arduino UNO side.

Thank you in advance,
Akram

1 Like

Hi and welcome to the community!

Let’s clear up some terminology, UDP, TCP and GET/PUT/POST refer to different things. UDP and TCP are transport layer protocols used on an IP network. GET/PUT/POST are HTTP methods as defined in the Hyper Text Transfer Protocol which is an application layer protocol that runs on top of the TCP transport layer protocol.

To communicate between an Arduino and OpenRemote you will either need to use a USB cable and make sure of serial communication utilising the Serial Client Protocol (this means your OpenRemote instance is running on hardware within USB cable reach of your Arduino. Alternatively you need an Arduino with IP interface (either a shield or an Arduino model that has this already onboard), there is a great, vibrant community around Arduino so that is the best place to get help and guidance on how to implement serial or TCP communication on your board; I’m not sure there are any Arduino boards and libraries that support a full HTTP stack so low level communication is the better option which will involve sending packets of data (could be UTF-8 strings for example), the basics are the same independent of whether serial or TCP is used.

From the OpenRemote side then either is supported and information can be found in the wiki.

NOTE: There is a pending documentation update to provide more information about generic protocol (Serial, TCP, UDP, etc.) configuration so please keep an eye on the wiki and if necessary ask follow up questions here on the forum.

Hi Rich,

Let me ask the question differently. My Arduino has a shield and is already connected with an IP. There are libraries that offers the TCP stack, no issues. I wanted to send from my Arduino a single packet with an attribute (let’s say temperature) and a value, and I want this to be digested by openremote. How do I parse this data on openremote?

Regards,
Akram

Perhaps this thread can help? HTTP Server config

That definitively helps. Let me give it a shot and I will share with you the result…
Thanks!

It works like charm! Thanks a lot for your support. I’m now getting the data evey 5 seconds from the Arduino, however, the graph granularity is 1min apparently. Is there a way to have more granular graphs?

Glad to hear you got it working, if you are generating data every 5s then that will be the granularity of the data being stored in the DB, the problem you have is that the REST API for the graph and the graph component only goes down to 1 hour window with 1 minute granularity as you’ve discovered and what happens in the backend is that all datapoints within the 1 minute will be averaged, we’d like to improve the decimation algorithm and make it selectable (min/max would be useful).

If you can explain your need to see the actual datapoints then we can consider making an update.

I’m building a home automation suite. The sensors I have at home are sending data every second and should react quickly to events. For example, if water is flowing through a pipe, trigger the pump to accelerate water flow. If flame is detected on the Water heater, trigger the pumps and so on…
I also would like to get the visual to understand the trend, so a granularity is required here.

Well, please note that for this kind of application you would need a Real Time solution, something local running some kind of RTOS. Openremote is a web application and something simple like broken cable can result in disaster. Perhaps, we should put it in DISCLAIMER that OpenRemote is not really suited for this kind of control loop solutions @Pierre ?

Hi, as Michal mentioned, be careful using OpenRemote for business critical systems. From a system design perspective, you want to prevent dependancy on an internet connection, so run OR locally. And if your scenarios are critical put proper additional health monitoring in place. For reaction times of a second or more OR is perfect but in case you need milliseconds, indeed go RTOS.

Would be good to put a disclaimer indeed. I’m running the server locally, however, I prefer indeed to go for a RTOS. Do you have any good recommendation for this?

Dank u wel!
Akram