Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.5 (build 3282) - 23 February 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

on External extra sensors and Windbarbs

Discussion of the Cumulusutils tool and website generator.

Moderator: HansR

Post Reply
User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

on External extra sensors and Windbarbs

Post by HansR »

The upcoming release of CumulusUtils (6.9.5) pulls two features out of beta:
  1. External Extra Sensors
  2. Windbarbs in Charts (see CDL)
Both can do with a little explanation, the first to make sure you understand what it does and what the limits are, the second to explain a technical bit on the windbarbs for those interested in HighCharts (which may be old news to you)

1)
The External Extra Sensors have been in beta for some time and apparently nobody is using it, but now that I had my geiger counter working I can use that as an example of what it is meant to do. Many sensors exist in this world and most of those are not being logged by CMX which means they can not be integrated easily with the existing charts. Charting those data anyway required dedicated coding for chart and data to display.

The goal of why I got involved with the geiger counter may have been a bit obfuscated by the time I got it running, but the essence is that I want to create the possibility for CUtils to have any sensor a user may come up with, to be charted automatically after configuration. That means that I just define the interface to any - whatever type - sensor. It will be the users responsibility to comply to that interface in any way he/she wants.

The idea is you name your External Extra Sensor in the configuration file and supply a CSV file with the data in the data directory of CMX. That's it. See the wiki for the detail of the format.

I named it External Extra Sensors to emphasize the sensor lies outside the CMX/CUtils system : it is not being logged by CMX, it is not recognized by CMX it is just completely unknown to the preprogrammed possibilities of the system. And yet, when configured correctly the sensor blends in with the existing sensors and the chart can be combined with other Plot Variables. Note this is not limited to the CUtils website but it is a feature of the ExtraSensors module / ChartsCompiler which will generate the charts. The charts can be used independently in any website. Up to the datafile, the responsibility is with the user. Picking up the datafile and creating the charts is CUtils.

Example description:
I connected my DIY Geiger Counter to a separate RPi and had the Python program running to read out the device and log the data in the required format:

Code: Select all

dd/MM/yy HH:mm, value
That file is copied in a cron job every ten minutes to my CMX machine where I have CUtils configured with:

Code: Select all

ExternalExtraSensors=geiger
I modified the chart for the Title, the ChartId en I added the WindBarbs (wind is interesting when talking about radiation sources). That is it. Multiple External sensors can be used, each with their own datafile. (See my site, menu=>Extra=>Extra Sensors; select the dropdown GeigerCounter)

What can be done/needs to be done: currently only one value per sensor can be in the datafile. Multiple values from one sensor can not be handled. This will be implemented on demand (lets first see this being used ;) )

As usual: any remarks or suggestions are welcome.

Code: Select all

# Raspberry Pi connection for the DIY Geiger Counter:
# Maybe the code can be optimized but it works and that's good. 
#     VIN = INT connected to pin#12 (via a 100nF decoupling capacitor: not used)
#     5V to pin#2
#     GND to pin#6
# Modified to create logfile by Hans Rottier on 1 july 2022
# For use with Cutils, to be modified for automatic logfile change at month rollover
#

import time
from datetime import datetime
import RPi.GPIO as GPIO
import locale

GPIO.setmode(GPIO.BOARD) # use RaspPi board layout pin numbering
GPIO.setup(12, GPIO.IN) # Only works if do NOT have a pull up or down

counter = 0

thisYear = datetime.now().year 
thisMonth = datetime.now().month
tmp = "geiger{}{:02}"
Filename = tmp.format(thisYear, thisMonth) + ".txt"
#print(Filename)

logFile = open(Filename, 'a', 1 )

def tube_impulse_callback(channel): # threaded callback -- falling edge detected
    global counter # make counter global to be able to increment it
    counter+=1

# when a falling edge is detected on pin#12, regardless of whatever 
# else is happening in the program, the tube_impulse_callback will be run
GPIO.add_event_detect(12, GPIO.FALLING, callback=tube_impulse_callback)

try:
    while True:
        currentMinute = datetime.now().minute
        while datetime.now().minute == currentMinute: # this minute..
            time.sleep(1) # .. wait while add_event_detect detects pulses
        tmp = "{},{}\n"
        logFile.write( tmp.format(datetime.now().strftime("%d/%m/%y %H:%M"), counter) )
        counter=0 # reset counter

#except KeyboardInterrupt:
#    GPIO.cleanup() # clean up GPIO on CTRL+C exit
#except:
#    GPIO.cleanup() # clean up GPIO on normal exit
finally:
    GPIO.cleanup() # clean up GPIO on normal exit
    logFile.close()
2) Windbarbs
Last release (6.9.2) the windbarbs were introduced in the ChartsCompiler. There was a difference between Above and Below windbarbs. This was caused by plotting Windbarbs and data to the same xAxis (when using Below). This compressed the data such that the distance between datapoints became the same as for the windbarbs (2 - 3 hours) i.s.o. the required 5 or 10 minutes or even 1 minute. It has been solved by creating separate xAxis for the windbarbs with offset:0 (Below) or opposite: true (Above). This won't be noticed by the user, but if you are interested in highcharts it may be a useful technique.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
Post Reply