|
Post by Powderjockey on Jun 2, 2018 16:45:58 GMT -8
After it detects a lightning strike, does the LCD return to showing "Waiting for lightning"? If so, how long afterwards?
|
|
|
Post by Powderjockey on May 26, 2018 8:49:52 GMT -8
How is your push notification set up now? Can you share the code?
|
|
|
Post by Powderjockey on May 18, 2018 17:04:44 GMT -8
What does this mean to people that already have a few account and are using Wunderground?
|
|
|
Post by Powderjockey on May 10, 2018 17:42:32 GMT -8
I delete my account. I see it says I'm on the "free" plan, $0.00 for 30 days with 0 (zero) boards.
Sucks!
Maybe Node-RED using MQTT will be an option.
|
|
|
Post by Powderjockey on Apr 24, 2018 19:12:24 GMT -8
Thanks BP
import smtplib
# Establish a secure session with gmail's outgoing SMTP server using your gmail account server = smtplib.SMTP( "smtp.gmail.com", 587 )
server.starttls()
server.login( '<gmail_address>', '<gmail_password>' )
# Send text message through SMS gateway of destination number server.sendmail( '<from>', '<number>@tmomail.net', '<msg>' ) With the above code, it would be nice to be able to send a message including the distance from the lightning.
#!/usr/bin/env python # # ThunderBoard IOT - SwitchDoc Labs # # November 2017 #
VERSIONNUMBER ="Pi003" import sys import os import sms import smtplib # from above code
import time
from pubnub.pubnub import PubNub from pubnub.pubnub import PNConfiguration
# Check for user imports try: import conflocal as config except ImportError: import config
pnconf = PNConfiguration()
pnconf.subscribe_key = config.Pubnub_Subscribe_Key pnconf.publish_key = config.Pubnub_Publish_Key
pubnub = PubNub(pnconf)
# lcd
import grove_lcd as lcd
import RPi.GPIO as GPIO
#set up GPIO using BCM numbering GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False)
#Buzzer BUZZER = 13 GPIO.setup(BUZZER, GPIO.OUT, initial=0)
LED = 4
GPIO.setup(LED, GPIO.OUT, initial=0)
from datetime import datetime
import pytz
from apscheduler.schedulers.background import BackgroundScheduler
import apscheduler.events # lcd routines
def waitingForLightning(): lcd.setRGB(0,255,0) lcd.setText("Waiting For\nLightning")
def displayNoise(): lcd.setRGB(0,255,150) lcd.setText("Noise\nDetected")
def displayDisturber(): lcd.setRGB(0,200,150) lcd.setText("Disturber\nDetected")
def startIOTLightning(): lcd.setRGB(0,128,64) lcd.setText("ThunderBoardIOT\nV"+VERSIONNUMBER);
def initializingIOT(): lcd.setRGB(0,0,128) lcd.setText("Initializing\nCalibration");
def ThunderBoardFound(address): lcd.setRGB(0,0,128) lcd.setText("TBoard Found\nAddress="+address);
def displayLightning(): lcd.setRGB(255,0,0) lcd.setText("Lightning!! \nDistance="+str(LightningData.LastDistance)+"km");
# Buzzer
def buzzUser(count, spaceDelay):
for i in range(0, count): GPIO.output(BUZZER, 1) time.sleep(spaceDelay) GPIO.output(BUZZER, 0) time.sleep(spaceDelay)
#setup Thunder Board Lightning Detector from SDL_Pi_Thunderboard_AS3935 import AS3935
import LightningData # D16 InterruptGPIOpin = 16
startIOTLightning()
time.sleep(5)
sensor = AS3935(address=0x02, bus=1)
try:
sensor.set_indoors(False) ThunderBoardFound("0x02") print "Thunder Board present at address 0x02"
except IOError as e: sensor = AS3935(address=0x03, bus=1)
try:
sensor.set_indoors(False)
ThunderBoardFound("0x03") print "Thunder Board present at address 0x03"
except IOError as e:
print "Thunder Board not present" exit()
time.sleep(3)
initializingIOT()
sensor.set_indoors(False) sensor.set_noise_floor(0)
#if(sensor.runCalibration(InterruptGPIOpin) == False): # print("Tuning out of range, check your wiring, your sensor and make sure physics laws have not changed!");
sensor.calibrate(tun_cap=0x04)
sensor.set_min_strikes(1)
def readLightningStatus():
noise_floor = sensor.get_noise_floor() min_strikes = sensor.get_min_strikes() indoor = sensor.get_indoors() mask_disturber = sensor.get_mask_disturber() disp_lco = sensor.get_disp_lco() #interrupt = sensor.get_interrupt()
LightningData.Noise_Floor = noise_floor LightningData.Minimum_Strikes = min_strikes LightningData.IndoorSet = indoor LightningData.Mask_Disturber = mask_disturber LightningData.Display_LCO = disp_lco
print "---------" print "noise_floor=", noise_floor print "min_strikes=", min_strikes print "indoor=", indoor print "mask_disturber=", mask_disturber print "disp_lco=", disp_lco print "Interrupt Count=", LightningData.InterruptCount #print "interrupt=", interrupt
def handle_interrupt(channel): global count global sensor
LightningData.InterruptCount = LightningData.InterruptCount + 1 time.sleep(0.003) reason = sensor.get_interrupt() LightningData.LastInterruptResult = reason now = datetime.now().strftime('%H:%M:%S - %Y/%m/%d') tuple = time.tzname LightningData.InterruptTimeStamp = now + " " + tuple[0] LightningData.InterruptTimeStamp print "Interrupt reason=", reason if reason == 0x01: LightningData.LastResult = "Noise level too high - adjusting" print LightningData.LastResult sensor.raise_noise_floor() elif reason == 0x04: LightningData.LastResult = "Disturber detected - masking" sensor.set_mask_disturber(True) elif reason == 0x08: LightningData.LightningCount = LightningData.LightningCount +1 tuple = time.tzname LightningData.LightningTimeStamp = now + " " + tuple[0] distance = sensor.get_distance() LightningData.LastDistance = distance LightningData.LastResult = "Lightning! " +str(distance) + "km away." LightningData.LastLightningResult = "Lightning! " +str(distance) + "km away." print LightningData.LastResult + LightningData.LightningTimeStamp
LightningData.InterruptActive = True
GPIO.setup(InterruptGPIOpin, GPIO.IN, pull_up_down = GPIO.PUD_UP ) GPIO.add_event_detect(InterruptGPIOpin, GPIO.RISING, callback=handle_interrupt)
print "Waiting for lightning - or at least something that looks like it"
#from above code # Establish a secure session with gmail's outgoing SMTP server using your gmail account server = smtplib.SMTP( "smtp.gmail.com", 587 )
server.starttls()
server.login( '<gmail_address>', '<gmail_password>' )
# Send text message through SMS gateway of destination number server.sendmail('<from>', '<number>@msg.telus.com', '<"Lightning! " +str(distance) + "km away.">)
# setup apscheduler
def tick(): print('Tick! The time is: %s' % datetime.now())
def killLogger(): scheduler.shutdown() print "Scheduler Shutdown...." exit()
def blinkLED(times,length):
for i in range(0, times): GPIO.output(LED, 1) time.sleep(length) GPIO.output(LED, 0) time.sleep(length)
def publish_callback(result, status): print "status.is_error", status.is_error() print "status.original_response", status.original_response pass # handle publish result, status always present, result if successful # status.isError to see if error happened
def publishLightningToPubNub():
print('Publishing Data to PubNub time: %s' % datetime.now()) print ' LastResult: ' + str(LightningData.LastResult)
now = datetime.now().strftime('%H:%M:%S - %Y/%m/%d') tuple = time.tzname LightningData.LastPublishTimeStamp = now + " " + tuple[0]
myMessage = { "SoftwareVersion": VERSIONNUMBER, "LastInterruptResult": LightningData.LastInterruptResult, "LastResult": LightningData.LastResult, "LastLightningResult": LightningData.LastLightningResult, "LightningTimeStamp": LightningData.LightningTimeStamp, "LightningCount": LightningData.LightningCount, "InterruptCount": LightningData.InterruptCount, "LastDistance":LightningData.LastDistance, "Noise_Floor": LightningData.Noise_Floor, "IndoorSet": LightningData.IndoorSet, "Display_LCO": LightningData.Display_LCO, "Minimum_Strikes": LightningData.Minimum_Strikes, "Mask_Disturber": LightningData.Mask_Disturber, "InterruptTimeStamp": LightningData.InterruptTimeStamp, "LastPublishTimeStamp": LightningData.LastPublishTimeStamp } pubnub.publish().channel('ThunderBoardIOT').message(myMessage).async(publish_callback)
blinkLED(3,0.200)
returnValue = [] return returnValue
def ap_my_listener(event): if event.exception: print event.exception print event.traceback
print "-----------------" print "ThunderBoard IOT" print "" print "SwitchDoc Labs" print "Version: ", VERSIONNUMBER print "-----------------" print ""
if __name__ == '__main__':
# read initial state readLightningStatus()
# publish initial state publishLightningToPubNub()
scheduler = BackgroundScheduler()
#pubnub.subscribe(channels='my_channel', callback=callback, error=error, connect=connect, reconnect=reconnect, disconnect=disconnect)
# DEBUG Mode - because the functions run in a separate thread, debugging can be difficult inside the functions. # we run the functions here to test them. #tick()
scheduler.add_listener(ap_my_listener, apscheduler.events.EVENT_JOB_ERROR)
# prints out the date and time to console scheduler.add_job(tick, 'interval', seconds=60) # blink life light scheduler.add_job(blinkLED, 'interval', seconds=5, args=[1,0.250])
# add the Update to PubNub scheduler.add_job(publishLightningToPubNub, 'interval', seconds=120)
# check configuration scheduler.add_job(readLightningStatus, 'interval', seconds=3600)
# start scheduler scheduler.start() print "-----------------" print "Scheduled Jobs" print "-----------------" scheduler.print_jobs() print "-----------------" waitingForLightning()
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
try: # This is here to simulate application activity (which keeps the main thread alive). while True: time.sleep(1)
# display lightning on LCD if (LightningData.InterruptActive == True): if (LightningData.LastInterruptResult == 0x08):
displayLightning()
# beep user
if (LightningData.LastDistance <=1): buzzUser(3, 0.2) elif (LightningData.LastDistance < 15): buzzUser(2, 0.2) else: buzzUser(1, 0.2)
publishLightningToPubNub() LightningData.InterruptActive = False time.sleep(1)
elif (LightningData.LastInterruptResult == 0x04):
print "Disturber Found" displayDisturber() publishLightningToPubNub() LightningData.InterruptActive = False time.sleep(1)
elif (LightningData.LastInterruptResult == 0x01):
print "Noise Found " displayNoise() publishLightningToPubNub() LightningData.InterruptActive = False time.sleep(1)
waitingForLightning()
except (KeyboardInterrupt, SystemExit): # Not strictly necessary if daemonic mode is enabled but should be done if possible scheduler.shutdown
|
|
|
Post by Powderjockey on Apr 21, 2018 7:15:19 GMT -8
I gave it some moving and it appears to click, but not exactly sure if it is a click or the plastic flexing. The board is long way away so I never saw if the board lit up. I did recheck Wunderground and it showed 0.3 mm of rain, so it may be working. Suppose to get some rain today and I'll keep my eye on it.
|
|
|
Post by Powderjockey on Apr 21, 2018 7:11:14 GMT -8
I've had similar problems. Also what browser are you using?
|
|
|
Post by Powderjockey on Apr 21, 2018 6:58:01 GMT -8
I found a piece of python script, do I just copy and paste it into the ThunderBoardIOT.py?
Edit: I'm not a programmer, but would be willing to learn if someone wanted to tutor me a bit to get this working.
I was able to get python to send me a message, but it would be nice to embed the script into the ThunderboardIOT.py so it would tell me how far the lightning is away.
Scott
|
|
|
Post by Powderjockey on Apr 18, 2018 17:07:07 GMT -8
Here is this first email that I received. Perhaps this I'm misinformed.
2018-03-05
Your freeboard™ account is changing
Greetings! We’re making some important changes that could affect your usage of freeboard™. Please read our update below and let us know if you have any questions.
In 2017, our user growth exploded. While we are thrilled by the usage, it has also significantly increased our hosting costs. As a result, it’s become impossible for us to continue offering a free-forever, hosted option. Instead, new users will receive a free, 30-day trial period, after which they will be asked to purchase one of our affordable plans.
There is still a free option if you’d like to host it yourself. Just use our open source freeboard version. Visit our Github repo to learn more.
Current users will have 30-days from the announcement date to either choose a plan, export their dashboards (to host locally) or delete their account. All current dashboards will continue to work normally during the 30-day window.
All paid accounts will have access to unlimited public dashboards, as well as a new set of private dashboards, with their own set of special features.
Small business customers, who wish to allow unlimited customer access to public or private dashboards, will be able to sign up for a dedicated instance. We are also looking into lower cost memberships for read-only users.
We are making these changes in order to better serve our customers and partners, and to continue making enhancements to the platform. We know that this is a significant change, so let us know if you have any questions.
Thank you for using our services,
Bug Labs, Inc.
|
|
|
Post by Powderjockey on Apr 18, 2018 17:05:01 GMT -8
2018-04-18 Now, I've had a free account for a year or two, so I'm not sure why I am getting this email. I do remeber getting another email near the end of March
New freeboard™ trial period ends April 30
Hello, and thank you for using freeboard™.
Your freeboard account was transitioned to our new 30-day free trial. On April 30, 2018, only paid accounts (and new signups with new 30-day free terms) will be able to use the freeboard service normally.
After May 1, 2018, some public dashboards may no longer be accessible. Users who wish to access their dashboards may still do so by upgrading their account to one of our paid plans.
In the meantime, we encourage all our users to try hosting freeboard on their own. In this way, you will dictate who has access to your data.
Visit our Github repo to learn more.We are making these changes in order to better serve our customers, fund our growth, and to ensure that freeboard continues to be the best dashboard tool out there!
Thank you again for using our services,
Bug Labs, Inc.
|
|
|
Post by Powderjockey on Apr 18, 2018 12:29:08 GMT -8
I poured a glass of water into the bucket and it recorded nothing I will check the connections, listen for the click.
|
|
|
Post by Powderjockey on Apr 18, 2018 12:22:40 GMT -8
I was wondering with the shutdown of the free Freeboard accounts starting May 1, 2018, how does this affect the access to the boards that may already be created?
This is used in many of your tutorials. Freeboard states to clone their github and access the boards thru there, but I'm not sure exactly how this is done.
Thanks
|
|
|
Post by Powderjockey on Apr 16, 2018 11:27:33 GMT -8
What would cause nothing to show/record from the rain bucket?
It has rained here most of the night and throughout the day and it show 0 mm.
|
|
|
Post by Powderjockey on Apr 15, 2018 16:23:37 GMT -8
Sure. You can add that in either the Raspberry Pi or Arduino version of the IOT lightning detector. There are a number of packages available. BP BP, can you provide some links?
|
|
|
Post by Powderjockey on Apr 14, 2018 11:08:45 GMT -8
I downloaded the Arduino_IOT_ThunderBoard and see there is a time.zip file in the directory. This is the timelib.h library for Arduino and if needed, should be added to the Arduino library thru Manage Libraries.
Are you getting the proper times in the Serial Monitor?
|
|