Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Best way to read data from Sensor(Best way to read data from Sensor)
Best way to read data from Sensor [message #1732783] Fri, 20 May 2016 01:13 Go to next message
Jatinder Arora is currently offline Jatinder AroraFriend
Messages: 1
Registered: May 2016
Junior Member
Hi All,

I have observed that Pi4J is the recommended way to read data from Sensor and further perform any action on that data in the Kura framework.

Being a Java developer, I strongly feel that pi4j is not best fit all the times for reading data from various sensors. For example: Reading humidity and temperature from DHT 11 sensor.

Keeping above in mind, I have following queries:

1. Is it a good practice to read data from sensor using the language suitable for that particular sensor. For example: C or Python and then share the data with the Java file in Kura framework for further action ?

2. If answer to above is yes then what is the best way to perform it. I can think of couple of ways like a) Store sensor data in file system and read data from file system in java file b) Runtime.exec() in java thus executing python script using java.

Please guide. Thanks in advance.

Regards,
Jatinder
Re: Best way to read data from Sensor [message #1732990 is a reply to message #1732783] Mon, 23 May 2016 14:49 Go to previous message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hello,

Where have you observed that Pi4J is the recommended solution for reading sensor data? The greenhouse demo uses this approach, but it needs to be updated. It was developed before we were including jdk.dio within Kura. The recommended approach for reading sensor data in Eclipse Kura is jdk.dio.

If your sensors are connecting over standard interfaces (I2C, GPIO, etc.), I would follow this documentation [1][2]. Eclipse Kura has services setup specifically for GPIO and expose the jdk.dio APIs for I2C. In some cases, sensors do require specific lower level code to interact with the sensor. In these cases, I would use JNI to act as a bridge between the low level code (i.e. C) and Java. Let me know if you need more direction on how to do this.

[1] http://eclipse.github.io/kura/doc/kura-dio-apis.html
[2] https://esf.eurotech.com/docs/how-to-use-gpio

Thanks,
--Dave
Previous Topic:Store and Forward feature for Http web service call
Next Topic:Micro controller requirement for KURA
Goto Forum:
  


Current Time: Wed Sep 25 21:23:53 GMT 2024

Powered by FUDForum. Page generated in 0.04241 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top