...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
These are the components used to build and deploy the Weather Station on the platform in the middle of the vineyard.
Components
Raspberry Pi 3 Model B Vi.2
Raspberry Pi clear case
USB - microUSB cable
SanDisk Extreme 64GB MicroSD
MicroSD - SD adapter
Laptop computer w/ Arabic keycaps
Ethernet cable and adapter
The Weather Board Interface board
Adafruit 12Bit I2C Analog to Digital converter ADS1015
header pins and cables
Anemometer
Rain gauge
Wind direction indicator
WIFI Access Point
...
External 74GB USB drive (for backup)
Raspberry Pi
Headless Raspberry Pi Setup
Step 1. Download Raspbian Image
Head on over here to grab a copy of the Raspbian image. The “Lite” version will do.
Step 2. Write Image to SD Card
Write the image to SD card. You can find detailed instructions here.
...
mbarrow$ sudo dd bs=1m if=/Users/mbarrow/Documents/proyectos/OpenVino/raspbian/2017-11-29-raspbian-stretch-lite.img of=/dev/disk3 conv=sync
Step 3. Add “SSH” File to the SD Card Root
Enable SSH by placing a file named “ssh” (without any extension) onto the boot partition of the SD card:
...
-rwxrwxrwx 1 mbarrow staff 0 Jul 16 15:43 ssh
Step 4. Setup a fixed IP address for access over ethernet or wifi
(******THIS SECTION NEEDS REVISION******)
...
c) Unmount SD card and pop it into the pi with a network cable.
Step 5. Configure your IP Address
Step 6. SSH into your Pi
...
username: pi
password: raspberry
Step 7. Configure the Pi
That’s it! You can now configure your Pi via sudo raspi-config
...
Universal Time is now: Wed Jul 26 01:52:19 UTC 2017.
Step 8. Configure wifi
Edit the file /etc/wpa_supplicant/wpa_supplicant.conf to look like this:
...
ssid="costaflores"
proto=RSN
key_mgmt=NONE
}
Step 8. Update the Pi
Secure your login with a rsa key authentication and enabling it only the port 22. Here a guide.
...
sudo apt-get update
sudo apt-get upgrade
Step 9. Set a static IP address
Start by editing the dhcpcd.conf file
...
static domain_name_servers=192.168.8.1
Step 10. Reboot
sudo reboot
sudo route add default gw 192.168.1.1
Weather Board
The Weather Board is a weather station controller board designed to interface to Arduino and Raspberry Pi computers. It is an interface board developed by SwitchDoc Labs.
...
WeatherRack Anemometer/Wind Vane/Rain Bucket
Embedded Adventures I2C Lightning Detector MOD-1016 board
Adafruit HTU21D-F Temperature/Humidity breakout board
Adafruit 32KB FRAM /ADS1015
SwitchDoc Labs Grove ADS1116 16 Bit ADC Board
...
A Grove connector is a four pin standardized size connector used to plug into base units and Grove modules.
...
http://www.switchdoc.com/weatherrack-weather-sensors/
DS3231/EEPROM Real Time Clock
The DS3231 is a low-cost, extremely accurate I2C real- time clock (RTC). The device incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device. The DS3231 also has an on board temperature sensor.
Why use a Real Time Clock?
A realtime clock is necessary for any project requiring accurate time keeping especially when you don’t always have an Internet connection. The Raspberry Pi keeps pretty good time, but only if it is connected to the Internet. The Pi uses NTP to set the clock on power up if the Internet is available. It then calls the NTP servers (some are actually hosted by the National Institute of Standards and Technology (NIST) and linked to their atomic clocks). You aren’t going to get atomic clock accuracy using NTP, but it is pretty good.
...
The SwitchDoc Labs DS3231/EEPROM combination is included with the Weather Board board. It is plugged in by the user into JP11, taking care to having the battery facing the top of the board. Connected to the Weather Board, the DS3231 RTC looks like this:
The DS3231 library is on https://github.com/switchdoclabs/RTC_SDL_DS3231.
Example Code for the DS3231
There is a testSDL_DS3231.py included with the library. Here is the bare code needed:
...
You should see a result like this:
Test SDL_DS3231 Version 1.0 - SwitchDoc Labs Program Started at:2014-08-03 19:29:58 Raspberry Pi= 2014-08-03 19:29:58 DS3231= 2014-08-03 19:29:58
The wind and rain sensors
A standard anemometer measures wind speed by closing a contact as a magnet moves past a switch. One contact closure a second indicates 2.4 km/h. If you use a different anemometer, this constant can be changed in software. The Wind vane has 8 switches, each connected to a different resistor. The Weather Board measures the resistance value of the resistor by measuring the voltage on a resistor divider (with 10 K Ohm resistor).
...
The tipping bucket rain gauge makes one momentary contact closure per 0.2794 mm of rain.
To Set North on Wind Vane
Wind Vane screw Should Point North – This is South
...
If you accidentally mount it incorrectly, you can always adjust the direction in software.
Raspberry Pi Drivers are here at github.com/switchdoclabs/SDL_Pi_Weather_80422.
Cabling the weather vane and rain gauge
The rain gauge and wind gauges come cabled with short cables with RJ-11 connectors. This is a problem, because we need longer, more protected cabling to go to the WeatherPi. So we need to replace the current cabling, using a single Cat5 RJ45 to connect both instruments, in a sort of daisy chain.
Rain Gauge
First run the RJ45 cable to the rain gauge.
Remove a short section of the RJ45 cable shield, to enable access to the wiring pairs.
Replace Rain Gauge RED wire with RJ45 GREEN, and Rain Gauge GREEN wire with GREEN/WHITE
Tape the cabling in place for stability, but insure that no taping interferes with the rain gauge mechanism.
Original Cable | New Cable | RJ-11 pins |
Green | Green/White | 3 |
Red | Green | 4 |
Wind Gauges
The wind direction indicator is cabled to the anemometer through a short RJ11 cable. We can leave this connection as is. But the cable that goes to the WeatherPi needs to be replaced with the tail of the cable we used from the Rain Gauge.
First remove the wind indicator from the T-bar support.
Remove the three screws holding the first cable guide.
Remove the three screws holding the sensor board in place.
Remember the position of the sensor board with reference to the weather vane.
Cut the weather board cable.
Route the new Cat-5 cable through the first cover.
Cut away to the GREEN/WHITE and GREEN cables. These are already used by the Rain Gauge.
Remove the silicon protector and unsolder the existing four cables.
Replace with new cables as below:
Replace the covers, and route cables accordingly. Connect anemometer RJ11
...
The AM2315 I2C is a temperature and humidity sensor.. It uses special temperature and humidity acquisition technology, to ensure that the sensor has high reliability and excellent long-term stability. While it is not waterproof, it is weather resistant. This sensor does far better for sensing temperature and humidity where there might be wind and rain.
Comes with attached Grove connector
3.3V to 5.5V I2C interface and power
10 mA max current use during conversion
Good for 0-100% humidity readings with minimum 2% accuracy
Good for -20 to 80°C temperature readings ±0.1°C typical accuracy
Updated every 500ms (0.5 Hz)
Body size 98mm x 16mm diameter
20 inch long - 4 wire cable
This board/chip uses I2C 7-bit address 0x5C.
...
Weather Board | Reference | Color | GPIO-PIN |
JP2-2 | Rain Bucket | Grey | 37 |
JP2-3 | Anemometer | Gold | 40 |
JP1-1 | Power GND | Black | 6 |
JP1-2 | Power VDD | Red | 1 |
J7 (Grove) | AM2315 Temp | - | - |
JP4-1 | I2C-SCL | Yellow | 5 |
JP4-2 | I2C-SDA | Orange | 3 |
JP11 | DS3231 RTC | - | - |
JP5 | ADS1015 | - | - |
Configuring I2C
I2C is a very commonly used standard designed to allow one chip to talk to another.
...
pi@openvinopi: sudo i2cdetect -y 1
The results should be similar to this.
...
Device | Address |
DS3231 Realtime Clock | 0x68 |
AM2315 Temperature Sensor | 0x5C |
AT24C32 eeprom. | 0x57 |
BMP085 Barometric Pressure Sensor | 0x77 |
Temperature Sensor | 0x48 |
...
Install the WeatherPi test software:
Now test:
pi@openvinopi:~/RaspberryPi-WeatherPiArduinoV2 $ sudo python WeatherPiArduinoV2.py
...