Linux DHT22 and Seeeduino v3
DHT22 and Seeeduino v3 read temperature and humidity from USB to Linux


Read the temperature and humidity using a DHT22 with seeeduino v3 from the USB

Sources:

Used the basic example code for the DHT22 with the Seeeduino v3 from https://github.com/adafruit/DHT-sensor-library/tree/master/examples/DHTtester

When I tried to do this with the Arduino Uno I was getting weird readings or the board would stop responding at random intervals.

The Seeeduino v3.0 works fine but from time to time it would write the message “Binary file /dev/ttyUSB0 matches” to the log file so I used the following small script to avoid this and now I only get measurements.

vim /home/user/scripts/tempcath.sh

INPUT=$(grep -m 1 Humidity /dev/ttyUSB0)
NOW=$(date)
if [ "$INPUT" != "Binary file /dev/ttyUSB0 matches" ]; then
echo "$NOW" "$INPUT" >> /home/user/temp.txt
else
exit 0
fi

sudo crontab -e

*/20 * * * * /home/user/scripts/tempcath.sh

Sample graph using Google JavaScript Charts on a web page using the temperatures and humidity gathered from the sensor:

Temperature and humidity graph sample

Temperature and humidity graph sample


Posted on:

December 29, 2014
160 words

Contact Me:

If you are interested in contacting me feel free to do so by mail or online:

nob {at} nob.ro