Jump to content






Photo

RPi3-Pine642Gb Weather station

Posted by pete_c , 20 June 2017 · 344 views

It is a drawing only right now but easy to build these days and reasonably priced.
 
Note that the Pine64 2Gb is larger than the RPi3.  It does have a built in RTC and it will run 64bit Ubuntu such that it runs circles around the RPi3 and sells for $29 USD with no case or power supply.
 
weatherstation

 
Baby steps here....
 
Testing a new little lightning sensor here using an old RPi, Wheezy and one GPIO port doing a pulse count via Python.
 
empnew

 
Might also add a NOAA radio to above concoction as I use one today connected to the OmniPro 2.
I have read you can purchase one on a board for tinkering with.  (RPI and Arduino stuff) or maybe use the SDR radio for this.
Raspberry Pi B+/2 NWR Receiver/SAME Decoder
noaaradio

 
 
1 - testing Lightning sensor
2 - 1-wire network working
3 - Meteostick to Davis working (Davis weather station ISS attached intruments)
4 - NTP server - Sure GPS with PPS working
5 - NOAA satellite images working and shrinking footprint to the Pine64
6 - NOAA radio data
7 - Geophone vibration data  (over the last 20 years or so have called these devices - 'thumpers'
 
Hardware Parts list for Lightning sensor:
 
A - Hobby Boards lightning sensor that has dual counters for 1-wire connecting.
 
I have used this one for years now with no issues.  Old 1-wire network was based on multiple Temp-0X devices and USB/Serial Maxim 1-wire devices.  Old network was configured in a star fashion from the 1990's.  The lightning device was on the roof next to the AAG weather station.  The AAG weather station worked but my wind speed counts were off or it was just very windy all of the time.  Over the years went to a Davis weather station.
That said removed AAG Weather station and 1-Wire lightning sensor.  Testing the 1-wire lightning sensor in the basement (works fine there too) and built a new RPi2 Jessie based 1-wire combo temperature/humidity sensor hub in the attic providing sensors for the attic and bedrooms below using Digitemp.  This RPi2 was also a Z-Wave device.  Probably changing the RPi2 to a Pine64 with 2Gb of memory and switching over to Ubuntu linux. 
 
B - testing a lightning sensor being sold on Ebay with simple analog and digital connectivity.  Just measures lightning pulses. (very simple device). 
 
smdlightning sensor

 
Connectivity to the RPi (original old one ) is 3.3VDC, Ground and GPIO2. 
 
1 - 3.3VDC - EMP to RPi Pin #1 (3VDC)
2 - ground - EMP to RPi Pin #6 (ground)
3 - GPIO2 - EMP digital to RPi GPIO2 Pin #3 on original RPi-1 - the voltage from the digital output triggers the pulse on GPIO2.
 
Python script to read and test for pulses is:  (see attached python file in zip format)
       
#!/usr/bin/env python
import RPi.GPIO as GPIO
import datetime
import sys
import signal

#verbose = True        # global variable
############################################################################################################
############################################################################################################
def printusage(progname):

        print progname + ' <gpio-pin-number> <filename> [debug]'
        print 'Example usage: '
    print progname + ' 2 /path/to/mylogfile'
        print progname + ' 2 /path/to/mylogfile debug'
    sys.exit(-1)

def signal_handler(signal, frame):
        if verbose:
        print('You pressed Ctrl+C, so exiting')
    GPIO.cleanup()
        sys.exit(0)
def readvalue(myworkfile):
    try:
        f = open(myworkfile, 'ab+')        # open for reading. If it does not exist, create it
        value = int(f.readline().rstrip())    # read the first line; it should be an integer value
    except:
        value = 0                # if something went wrong, reset to 0
    #print "old value is", value
    f.close()    # close for reading
    return value

def writevalue(myworkfile,value):
    f = open(myworkfile, 'w')
    f.write((str(value)+ '\n'))            # the value
    f.write((str(datetime.datetime.now())+ '\n'))    # timestamp
    f.close()    
############################################################################################################
############################################################################################################
######### Initialization

#### get input parameters:
try:
    mygpiopin = int(sys.argv[1])
    logfile = sys.argv[2]
except:
    printusage(sys.argv[0])
verbose = False
try:
    if sys.argv[3] == 'debug':
        verbose = True
        print "Verbose is On"
    else:
        printusage(sys.argv[0])
except:
    pass

#### if verbose, print some info to stdout
if verbose:
    print "GPIO is " + str(mygpiopin)
    print "Logfile is " + logfile
    print "Current value is " + str(readvalue(logfile))
#### setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(mygpiopin, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
signal.signal(signal.SIGINT, signal_handler)    # SIGINT = interrupt by CTRL-C

########## Main Loop
while True:
    # wait for pin going up
    GPIO.wait_for_edge(mygpiopin, GPIO.RISING)
    # read value from file
    counter=readvalue(logfile) + 1
    if verbose:
        print "New value is", counter
    # write value to file
    writevalue(logfile,counter)
    # and wait for pin going down
    GPIO.wait_for_edge(mygpiopin, GPIO.FALLING)
############################################################################################################
############################################################################################################
 
Running the following in a cron job.
 
/root/gpio-counter.py 2 /var/log/gpio2-counter.log &
 
The above noted I can get test pulses using a piezo electric lighter about 2-3mm away from the antenna but no lightning pulses in the house next to a window.
 
The vendor has sent me a new updated device to test which I will be doing in the next few days.
 
C - Franklin Lightning sensor chip
 
This one will involve a bit of bit banging and using the i2C bus on the RPi (or anything else).  I have been doing this stuff with RPi's and testing mini travel routers and ardunino (very small stuff).
 
Basically it is 3 wires and 2 wires for power.  (2 GPIO and 1 IRQ for i2C stuff and VCC and ground)
 
weatherstation


 
as3935

 

AS3935 A

 
26th of June, 2017
 
Rebuilding RPi2 in attic today for testing purposes.
- base is a Z-Wave GPIO and PiFace RTC
- it is doing Z-Wave and using Digitemp for temperature and humidity readings on the second floor and attic.
- adding old Hobby Boards Lightning 1-wire sensor dual counter to the 1-wire network as it has worked fine in the basement.
- I was using Jessie lite on the device and it has crashed now 3 times in the span of one year so switching to Wheezy as it is lighter to me than Jessie Lite.
- alternative is just to keep the original Pi doing Z-Wave and add a second one for the 1-wire stuff.

Attached Files






September 2017

S M T W T F S
     12
3456789
10111213141516
17181920 21 2223
24252627282930

Recent Comments