DHT Sensor, Processing and Raspberry Pi


I have a hard time trying to get a value to Processing from a DHT22 temperature and humidity sensor (1-wire protocol) on a Raspberry Pi. I have used Arduino a lot but I am not god at java and I am not used to integrate processing with other libraries.

Anyway I have been able to get Processing running on Raspberry Pi with Oracle Java. I have also been able to read signals from GPIO thanks to this guide: http://xseignard.github.io/2013/04/24/processing-and-gpios-on-raspberry-pi/

The problem is that to get my idea working i need to get values from a DHT22 sensor. Most of the solutions is for Python and I am not used to that language. But i found this: http://hirt.se/blog/?p=493

Actually I got it working as far as when i run sudo java –jar w1.jar I got the right values.

The problem comes when I try to get the values to Processing. I have put w1.jar in the library directory in Processing and renamed files to work with Processing. I import the library in Processing along with java.io java.util

And I put Set sensors = Sensors.getSensors(); in setup part of the sketch. But I get IOException error. It seems like it is not possible to access the sensor values. Does anyone have any idea about how to solve this? Is it possible to use this method to get values from 1-wire sensors to Processing or am I struggling with something that is doomed from the start?

My backup plan is to try to get the values from Arduino to Processing on the Raspberry Pi. I have found this: http://scruss.com/blog/2014/01/07/processing-2-1-oracle-java-raspberry-pi-serial-arduino-☺/ Maybe I should try that instead? But it would be nice to leave the Arduino out of it if possible.

If anyone has any solution, please tell! And, as I said, I am not god at java, so please be patient with me.



Sign In or Register to comment.