I have connected Grove Light, Sound and Temperature/Humidity sensor to GrovePi and running separate python scripts to fetch the sensors every 1/2 second.
Observed that whenever any other script is running with Temperature/Humidity script, the Temperature/Humidity script outputs “Nan”. If Temperature/Humidity script is running alone then it reports correct values.
Is there any issue with the simultaneously Temp/Humidity data?
Light Sensor is connected to A0, Sound to A1 and Temp/Humdity to D6. GrovePi firmware is latest 1.1.
Sorry I meant D5 and D6. I have removed all the sensors now and have only temperature/Humidity - D4 and Button - D1. When I am polling (Pything script) D1 for Button status, I start getting Nan in temperature script. As soon as I stop the Button Script, I get correct temperature and humidity values.
Hi,
Can you try using 1 as the argument in the command that asks for temperature, e.g: [temp,humidity] = grovepi.dht(sensor,1) instead of [temp,humidity] = grovepi.dht(sensor,0).
YES the Temperature/Humidity sensor works if there is no other script running to read status of any other sensor. Is there any issue with python libraries? May be while the python script is running to process the temperature/humidity data, if any other sensor data is read, it corrupts the temperature/humidity data. This is just a guess.
Is there any other library c/c++/or java to use with raspberrypi+groovepi? I tried to compile arduino based c/c++ library but can’t get them to work.
Hi,
Sorry but there is no other language which supports the GrovePi completely.
How the GrovePi works is that, the Raspberry Pi sends a command to the GrovePi. The GrovePi runs that command and stores the result back into a message buffer. The RaspberryPi then requests it to send the data back after some time (there has top be a small delay between the two so that we are sure that the data is loaded into the buffer), the GrovePi sends the data that is in the buffer.
Your hunch might be right, that the data in the buffer might be getting corrupted. You should put sufficient delay before and after the read.
Also, are you running the two scripts simultaneously?
Hi,
You should not run the scripts simultaneously and should only run one script. We would recommend you to put all your logic in one code itself. The reason being that the input data is loaded into a buffer and the GrovePi waits for a command. When you run two scripts together, the timing can be a mismatch, also there is a sleep command in the GrovePi library, so that may also cause a conflict.
Now the reason that I suspect that other sensors work and the DHT sensor does not, might be that that other sensors are very fast and complete their operations instantaneously whereas the DHT sensor takes some time to read the values back and it might be causing a conflict there.
I would recommend you to not run multiple programs simultaneously.
Hi,
If you want to do something such as read the DHT sensor when the button is pressed, use an If statement. We have a couple of projects on the GrovePi site that should help you.
I am also facing the same problem, though I am not running simultaneous scripts for the dht sensor. I tried changing the pins but still no improvement. I have many other sensors -that work fine but dht script only gives nan values. Any suggestions? The version of the grovepi firmware is 1.1 (which I guess is up-to-date).
Hi,
So I will try to write all my confusions point-by-point. I hope it is clear enough. 1. I have a temperature and humidity sensor pro, that I connect to one of the digital pins (say D4). When I run the example script, it prints Nan for both sensors. The same value is printed if I probe the port when nothing is connected. So basically, it looks like the sensor is not getting recognized.
I have the same problem with Ultrasonic ranger sensor as well. It gives out the max value (65535), which I get if nothing is connected to the port at all. 2. I have tried both dht and ultrasonic ranger sensors one by one without connected any other sensor, to avoid the problem of buffer being overwritten but that has not helped. I have analogue sensors (air quality, sound, light) that are working just fine, even if connected simultaneously and read through multiple scripts. 3. I tried to see if i2cdetect registers any sensors butI can only see the grovespi at 0x04 and nothing else.I am a little confused if these sensors should be shown by i2cdetect as they are not directly connected to Raspberry Pi. 4. Is there any way I can find out the current firmware version of the grovepi apart from looking at the version number in the grovepi repo. It could be that the grovepi shield has been flashed before and the repo is a new download? The repo shows a version of 1.1, which I guess is the up-to-date version.