apt-get install arduino arduino-core
# add necessary usergroups relogin or restart
arduino
Load the "blink" example and try to upload to arduino for a quick test
download dht11.cpp and dht11.h put them under ~/sketchbook/libraries/DHT11 folder
burn the sketch dht11_test1.pde to the arduino
https://www.virtuabotix.com/virtuabotix-dht11-pin-out-reference-guide/
monitor the serial port at 115200 baud, you should see the data like this :
Read sensor: OK
Humidity (%): 36.00
Temperature (°C): 26.00
Temperature (°F): 78.80
Temperature (°K): 299.15
Dew Point (°C): 9.80
Dew PointFast (°C): 9.76
Checking the connected system to work
- the new raspberry B+ does not have enough power on USB ?? you will need an external power-supply for your arduino
- the older raspberry B has enough power for the arduino on USB
# check the new device is connected
$ lsusb
# get the device path
$ dmesg
# setup the connection baudrate to 115200
$ stty -F /dev/ttyACM0 raw ispeed 115200 ospeed 115200 -ignpar cs8 -cstopb -echo
# and lets see the output
$ cat /dev/ttyACM0
DHT11 TEST PROGRAM
LIBRARY VERSION: 0.4.1
Read sensor: OK
Humidity (%): 36.00
Temperature (°C): 25.00
Temperature (°F): 77.00
Temperature (°K): 298.15
Dew Point (°C): 8.91
Dew PointFast (°C): 8.88
apt-get install lighttpd
Add a cgi script and configure
Setup crontab
$ crontab -e
* * * * * date > /tmp/temperature && grep -m1 -A2 OK /dev/ttyACM0 >> /tmp/temperature
Create a CGI script
#!/bin/bash
echo "Content-type: text/html"
echo
echo "<html><body><pre style='font-size:72px'>"
cat /tmp/temperature
echo "</pre></body></html>"
echo
further plans: