Thankyou all for taking the time to write scrpts, I will try them out tomorrow and let you know my results.
I also have been playing, and you last script worked OK(ish). I am fortunate in that I have two Raspberry Pi3,s with a GrovePi mounted on top and are running the same versions of Raspbian jessie, and up to date Grove Software. Sadly I had problems with Raspbian for Robots, in that I was unable to install some extra packages. Which i am not bothering at thia present time.
One thing issue I do have is I am not able to run GrovePi with Python 3. so for now I will stick to Python 2 for now, and get it working on that.
Regarding the programming the windspeed pulse counter I am using my second GrovePi that has a grovepush button switch to simulate the anemometer as a test bed. I have been able to assemble a scipt for testing on my other RPI that is going the be used as my main weather station and had all the sensors connected. Which are connect as listed below.
--------------------------BOARD AND SENSOR SET UP---------------------------
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
bus = smbus.SMBus(1)
else:
bus = smbus.SMBus(0)
GPIO.setwarnings(False)
12C SENSORS
ds3231 = SDL_DS3231.SDL_DS3231(1, 0x68) # RTC
bmp280 = BMP280.BMP280() # GROVE 12C TEMPERATURE-HUMID-BARO
bmp280 = BMP280.BMP280()
hdc = HDC1000()
hdc.Config()
GROVE SENSORS
Anemometer = 5 # Pin 5 is D5 Port. ----- Anemometer
Rain_Tipper = 6 # Pin 6 is D6 Port. ----- Rain_Tipper
Light_Sensor = 14 # Pin 14 is A0 Port. Grove - Light_Sensor
Water_Sensor = 15 # Pin 15 is A1 Port. Grove - Water_Sensor
Moisture_Sensor = 16 # Pin 16 is A2 Port. Grove - Moisture_Sensor
grovepi.pinMode(Anemometer, “INPUT”) # Anemometer
grovepi.pinMode(Rain_Tipper, “INPUT”) # Rain Tipper
grovepi.pinMode(Light_Sensor, “INPUT”) # Grove - Light Sensor
grovepi.pinMode(Water_Sensor, “INPUT”) # Grove - Water Sensor
grovepi.pinMode(Moisture_Sensor, “INPUT”) # Grove - Moisture Sensor
dust_ppm = dust_sensor_lib.Dust_Sensor()
GROVE LEDS AND GROVE DIGITAL
blue_led = 4
flash_led = 3
digitalWrite(flash_led, 0)
digitalWrite(blue_led, 0)
adc = Adafruit_ADS1x15.ADS1115() # ADC ADS1115
GAIN = 1 # 5volts
value = 0
voltageValue = 0
For now the dust sensor is disconnected as that is causing me problems, again I will look at this later, after everything else is working.
Thanks for your help, please keep the suggestions coming, as I hope it may encourage others the try and build a weather station.
Michael