- #Raspberry pi temperature and light logger install
- #Raspberry pi temperature and light logger update
The weather data for each day is periodically and continuously logged into a local SQLite3 database, restarting on every (re)boot. If the Pi does not have network access, you can simply copy the data via USB and open the tab-delimited file into a Google Sheet as needed.Īs the Pi gives off heat, the temp sensor seems to be most accurate when placed a few inches from the enclosure, as shown in the picture above.This application logs weather data - temperature, barometric pressure, and relative humidity data from sensors connected to a Raspberry Pi. An example of a Google line chart created with the output data file. Instructions such as the Adafruit ones here can be followed to set up the Pi to write directly to a Google Sheet which has a live-updated interactive chart that is publicly accessible. So it would take about 125 days to write 1MB of data.įor easy visualization of the data, Google Sheets with a chart can be configured. Log file size for temperature, humidity, ratio and concentration is about 15K for 45 hours, so around 8K written per day. The Pi 3 has a tendency to run warm depending on the enclosure you are using you can check temp with /opt/vc/bin/vcgencmd measure_temp and may add a heatsink and/or fan as necessary. You can cram everything into a plastic enclosure, but make sure to use electrical tape or screw in the various components so they don't cause interference or come unplugged. Sudo udevadm info -a -p `udevadm info -q path -n /dev/sda1` In the crontab example below, the temp sensor is at GPIO 25, the LED is at GPIO 4, emailing is enabled via the address given, and Google Sheets data copying is enabled (more information on this in the notes section at the bottom of README.md).
Make sure to replace the pin number(s) and destination email with the appropriate ones for your setup. The example given below will run every 5 minutes. Lastly, edit the crontab via crontab -e to run the monitor_dht22.py script at the desired interval. gsheets Turn on Google Sheets logging, must configure email EMAIL Email destination for warnings min_rh MIN_RH Minimum acceptable humidity, default 30 max_rh MAX_RH Maximum acceptable humidity, default 50 min_temp MIN_TEMP Minimum acceptable temp, default 32F max_temp MAX_TEMP Maximum acceptable temp, default 70F h, -help show this help message and exit 1) Set up data collection and loggingįirst, we will set up the Adafruit library to read data from the DHT (from ) by doing the $ python monitor_dht22.py -h The completed Pi will perform the following functions: 1) collect temperature and humidity, show the values on the LCD screen, and write the values to a log file every 5 minutes 2) email an alert if temperature or humidity thresholds are exceeded and 3) automatically copy the log file to a USB drive, when inserted.
They are typically labeled G (GND), V (VCC), and D (Data). The DHT22 already soldered to the PCB board will have three pins. Connect (G)round to one of the Pi's ground pins.Connect power (VCC) to one of the Pi's 5V pins.You may also want to run sudo raspi-config and change the time zone so that dates/times will be appropriate for your location. Edit the hostname in /etc/hostname if desired and configure the wireless settings for your network.
#Raspberry pi temperature and light logger update
On first boot, change the default password and run a sudo apt-get update & sudo apt-get upgrade. Put in the new SD card, connect the Pi to ethernet and power up. Place a file named ssh, without any extension, within the /boot/ partition of the SD card to enable SSH on first boot so the Pi may be run headless.
#Raspberry pi temperature and light logger install
USB drive to copy log files to automatically when insertedĭownload and install the latest Raspbian Jessie Lite to your Pi's SD card.LED to flash when reading is taken (with 1kΩ resistor), either with breadboard or directly soldered-on wires.DHT22 temperature-humidity sensor (preferably one already soldered to a PCB board) and jumper wires (female-to-female).16x2 I2C LCD Display and jumper wires (female-to-female).Power supply (for the most flexibility in adding future peripherals, an official 5V 2.5A power supply is recommended).
Ethernet cable and wireless network credentials.Mini SD card (16GB minimum) with adapter, and a computer to use to image the initial SD card.Raspberry Pi (tested on Pi 3 B and older B models).Raspberry Pi monitor for environmental conditions in archival storage, using the DHT22 sensor for temperature and humidity data collection.