n307 Hamburg DE Germany
Read the statement by Michael Teeuw here.
Posts
-
RE: Contribute to a module. Volunteers wanted! Easy!
-
RE: Using a PIR sensor to turn off the monitor
Great and very useful!
Can you do also make a tutorial for the modul HC-SR04 including all phyton scripts?That would be really great. -
Trouble with update to 2.4.1
Hi all,
i’ve tried to update to 2.4.1.
But if Fails with some comments.
Who can help a newbie?Pls have a look at the log and how to i fix the warnings?
ThanksLogfile:
–> https://1drv.ms/u/s!ApE0YZ4Ndle9kAa62cB46jrluJDk -
RE: MMM-WunderGround Temperature stop working
Yes, you’re right. My “old” station disappears. I’ll take a new one and it works.
Thanks
-
RE: MMM-WunderGround Temperature stop working
Where do you change/renew your station?
Can you provide the link?
Thanks -
RE: MMM-WunderGround Temperature stop working
@trividar
Click on “Learn more” and ask for a price :-( -
RE: MMM-WunderGround Temperature stop working
See here:
https://www.wunderground.com/weather/api/
They wrote:
“To improve our services and enhance our relationship with our users, we will no longer provide free weather API keys as part of our program.” -
RE: Trouble with python script for ultrasonic mudule HC-SR04
@idoodler Thanks for your Reply.
There is no clicking noise … as i haven’t got any sound device connected.
But you’re right … the 100 seems to be the problem.
I didn’t “saw” it … damn.
I’ll correct this and test it again.Thanks
-
Trouble with python script for ultrasonic mudule HC-SR04
Hi,
i’ve got some problems with my script (don’t know, where i found it).
In principle, it works, but after 1 or 2 days, the monitor switches no longer on or off.
This means that the script is in an undefined state.
With the logging I wanted to see where it hangs, but that does not really work either.
Who can help me and optimize the script?Thank you
#Bibliotheken einbinden / Import libs from subprocess import call import RPi.GPIO as GPIO import time import logging #Einstellungen für das Logging / settings for log options logging.basicConfig(level=logging.INFO, format='%(message)s', datefmt='%m-%d %H:%M', filename='PIR.log', filemode='w') # define a Handler which writes INFO messages or higher to the sys.stderr console = logging.StreamHandler() console.setLevel(logging.INFO) # set a format which is simpler for console use formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') # tell the handler to use this format console.setFormatter(formatter) # add the handler to the root logger logging.getLogger('').addHandler(console) #GPIO Modus (BOARD / BCM) GPIO.setmode(GPIO.BCM) #GPIO Pins zuweisen / set GPIO pins GPIO_TRIGGER = 23 GPIO_ECHO = 24 Monitor_State = 0 Counter = 0 TVSERVICE = '/opt/vc/bin/tvservice' #Richtung der GPIO-Pins festlegen (IN / OUT) / direction for Pins (in/out) GPIO.setup(GPIO_TRIGGER, GPIO.OUT) GPIO.setup(GPIO_ECHO, GPIO.IN) Text = (time.strftime("%d.%m.%Y %H:%M:%S")) + (" Messung vom User gestartet") logging.info('Gestartet') logging.info(Text) logging.info('ENDE') # Bildschirm erst einmal ausschalten :-) / switch off monitor first :-) call([TVSERVICE, '-o']) def distanz(): # setze Trigger auf HIGH / set trigger to HIGH GPIO.output(GPIO_TRIGGER, True) # setze Trigger nach 0.01ms aus LOW / set trigger after 0.01ms low time.sleep(0.00001) GPIO.output(GPIO_TRIGGER, False) StartZeit = time.time() StopZeit = time.time() # speichere Startzeit / remember starttime while GPIO.input(GPIO_ECHO) == 0: StartZeit = time.time() # speichere Ankunftszeit / remember 2'nd time while GPIO.input(GPIO_ECHO) == 1: StopZeit = time.time() # Zeit Differenz zwischen Start und Ankunft / calc difference TimeElapsed = StopZeit - StartZeit # mit der Schallgeschwindigkeit (34300 cm/s) multiplizieren # und durch 2 teilen, da hin und zurueck distanz = (TimeElapsed * 34300) / 2 return distanz if __name__ == '__main__': try: while True: abstand = distanz() if abstand < 120 and Monitor_State == 0: logging.info('Monitor gestartet') Monitor_State=1 Counter = 0 call([TVSERVICE, '-p']) elif abstand < 120 and Monitor_State == 1: Ausgabe = " Counter reset " + (" - %.1f cm" % abstand) logging.info(Ausgabe) Counter = 0 elif abstand >= 120 and Monitor_State == 1 and Counter = 100 and Counter >= 11: Monitor_State=0 Counter = 0 call([TVSERVICE, '-o']) time.sleep(1) # Beim Abbruch durch STRG+C resetten / reset after STRG+C except KeyboardInterrupt: GPIO.cleanup()