Geiger Counter


  • Hardware Contributor

    As I live near a nuclear power plant, I thought it would be a good idea to have a radioactivity sensor:
    geiger.jpg
    Components used:

    Geiger Counter Kit:
    http://www.ebay.com/itm/321499888801?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

    An SBM-20 tube:
    http://www.ebay.com/itm/280865770387?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

    And MySensors with this sketch:

    #include <SPI.h>
    #include <MySensor.h>
    
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 1   // Id of the sensor child
    
    #define LOG_PERIOD 60000     //Logging period in milliseconds, recommended value 15000-60000.
    
    #define MAX_PERIOD 60000    //Maximum logging period
    
    unsigned long counts;             //variable for GM Tube events
    
    unsigned long cpm;                 //variable for CPM
    
    unsigned int multiplier;             //variable for calculation CPM in this sketch
    
    unsigned long previousMillis;      //variable for time measurement
    
    unsigned long timeReceived = 0;
    unsigned long timeRequested = 0;
    
    MySensor gw;
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_VAR1);
    
    void setup()
    {
      wdt_enable(WDTO_8S);
      gw.begin();
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Geiger Sensor", "1.1");
    
      wdt_reset();
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID, S_ARDUINO_NODE);
      
      // Geiger initialise
      counts = 0;
    
      cpm = 0;
    
      multiplier = MAX_PERIOD / LOG_PERIOD;      //calculating multiplier, depend on your log period
    
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the geiger sensor digital pin as input
    
      digitalWrite(DIGITAL_INPUT_SENSOR, HIGH);                                 // turn on internal pullup resistors, solder C-INT on the PCB
    
      attachInterrupt(1, tube_impulse, FALLING);  //define external interrupts
    
    }
    
    void loop()
    { 
      wdt_reset();
      unsigned long currentMillis = millis();
    
      if (currentMillis - previousMillis >= LOG_PERIOD) {
    
        cpm = counts * multiplier;
    
        gw.send(msg.set(cpm));
    
        counts = 0;
        previousMillis = currentMillis;
    
      }
    }
    
    
    void tube_impulse() {              //procedure for capturing events from Geiger Kit
    
      counts++;
    
    }
    
    
    
    
    

    I get cpm and in Node-Red I calculate microsievert/per hour:

    [{"id":"ba386057.845d3","type":"mqtt-broker","broker":"192.168.92.4","port":"1883","clientid":"NodeRed"},{"id":"75acf1fb.8a531","type":"mqtt in","name":"Geiger CPM","topic":"MyMQTT/48/1/V_VAR1","broker":"ba386057.845d3","x":146,"y":52,"z":"d1478aa9.2eb878","wires":[["d17bbe2a.2e844"]]},{"id":"d17bbe2a.2e844","type":"function","name":"Nach uSievert umrechnen","func":"cpm = msg.payload;\n\n// für SBM 20 Röhre\n// http://cs.stanford.edu/people/nick/geiger/\nusv = cpm * 0.0057;\n\nmsg.topic = 'NodeRed/Geiger/usv';\nmsg.payload = usv;\n\nreturn msg;","outputs":1,"valid":true,"x":377,"y":52,"z":"d1478aa9.2eb878","wires":[["c53927ba.3ac6d8"]]},{"id":"c53927ba.3ac6d8","type":"mqtt out","name":"","topic":"","qos":"","retain":"","broker":"ba386057.845d3","x":647,"y":52,"z":"d1478aa9.2eb878","wires":[]}]```

  • Admin

    Cool! I also live near a plant but it has been closed for 10+ years unfortunately (?).


  • Hero Member

    @FotoFieber Thanks for posting. I have this Geiger counter kit on its way to me: https://sites.google.com/site/diygeigercounter/software-features along with an sbm-20. I plan to build the outside sending unit like this: https://sites.google.com/site/diygeigercounter/wireless-monitoring along with a custom shield that'll hold the NRF24 with PA/LNA and a few other components to control the power to the geiger counter and the NRF24. I won't need the indoor display station that's described on the site as I'm using the MySensors gateway and HomeSeer instead.

    Cheers
    Al


  • Hardware Contributor

    Here is the update for mysensors 2.0

    //
    #define SKETCH_NAME "Geiger Sensor"
    #define SKETCH_MAJOR_VER "2"
    #define SKETCH_MINOR_VER "0"
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    #define MY_RF24_CHANNEL  13
    #define MY_RF24_BASE_RADIO_ID ((uint64_t)0xF8A813FC09CL)
    
    
    //
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 1   // Id of the sensor child
    
    #define LOG_PERIOD 60000     //Logging period in milliseconds, recommended value 15000-60000.
    
    #define MAX_PERIOD 60000    //Maximum logging period
    
    unsigned long counts;             //variable for GM Tube events
    
    unsigned long cpm;                 //variable for CPM
    
    unsigned int multiplier;             //variable for calculation CPM in this sketch
    
    unsigned long previousMillis;      //variable for time measurement
    
    unsigned long timeReceived = 0;
    unsigned long timeRequested = 0;
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    
    #include <SPI.h>
    #include <MySensors.h>
    
    MyMessage msg(CHILD_ID, V_VAR1);
    
    void setup()
    {
      wdt_enable(WDTO_8S);
      
      // Geiger initialise
      counts = 0;
    
      cpm = 0;
    
      multiplier = MAX_PERIOD / LOG_PERIOD;      //calculating multiplier, depend on your log period
    
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the geiger sensor digital pin as input
    
      digitalWrite(DIGITAL_INPUT_SENSOR, HIGH);                                 // turn on internal pullup resistors, solder C-INT on the PCB
    
      attachInterrupt(1, tube_impulse, FALLING);  //define external interrupts
    
      wdt_reset();
    }
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER);
    
      wdt_reset();
      wait(500);
      present(CHILD_ID, S_ARDUINO_NODE);
      
      wdt_reset();
      wait(500);
     }
    
    void loop()
    { 
      wdt_reset();
      unsigned long currentMillis = millis();
    
      if (currentMillis - previousMillis >= LOG_PERIOD) {
    
        cpm = counts * multiplier;
    
        send(msg.set(cpm));
    
        counts = 0;
        previousMillis = currentMillis;
    
      }
    }
    
    
    void tube_impulse() {              //procedure for capturing events from Geiger Kit
    
      counts++;
    
    }
    
    
    
    

    @Hek
    What do you think about a sensor type geiger counter with cpm and microsievert? V_VAR1 for cpm ist not cool 🆒


  • Admin

    Haha, not cool. 😄 What? Radioactivity is always cool!

    Well, we still use VAR_1 for pulses in EnergyMeterPulseSensor, which probably is a bit more commonly used. A generic V_PULSECOUNT perhaps..On the EnergyMeterPulseSensor is it only used for saving a state in case of power failure. Is it the same use-case here?


  • Hardware Contributor

    @hek
    counts per minute:
    https://en.wikipedia.org/wiki/Counts_per_minute

    A generic V_PULSECOUNT would be fine.

    The microsievert is the interesting physical unit you can derive from the cpm. The calculation is depending from the tube you use.

    http://cs.stanford.edu/people/nick/geiger/

    In my case:
    usv = cpm * 0.0057;

    What about a type S_RADIOACTIVITY?

    Here the natural radioactivity in my garage:
    0_1471672357241_Grafana   Radioaktivität.png

    The sum of the doses you get over time is the interesting number:
    https://en.wikipedia.org/wiki/Sievert


  • Admin

    S_RADIOACTIVITY sounds like useful new device type.

    When reading up a bit more. Wouldn't it be better to send in radiation level (uSv/hr) as V_LEVEL. We try to re-use V_LEVEL between device-types for SI-levels of any kind.

    I have started this a new issue here to discuss it further:
    https://github.com/mysensors/MySensors/issues/567

    henrikekblad created this issue in mysensors/MySensors

    open S_RADIOACTIVITY #567



  • Excellent - thank you guys. I have been looking for an addition to my weather station.
    I think I'll place an order for this one: http://www.ebay.co.uk/itm/182166337823?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT
    This is 100% Japanese built Arduino based Geiger counter.



  • @hek Henrik, where do you stand with S_RADIOACTIVITY please?
    Unfortunately, I cannot use S_CUSTOM or any other with Domoticz so has to wait for a S_RADIOACTIVITY being implemented with (1) MySensors (2) Domoticz.

    Thanks
    Alex


  • Admin

    It's just a matter on agreeing on what types/data to send. Please post your input in the issue.



  • @hek The logging software is reporting is as follows every minute:

    CPS, 2, CPM, 15, uSv/hr, 0.08, SLOW
    (Please see http://mightyohm.com/blog/2012/02/tutorial-geiger-counter-data-logging/)

    Therefore, there are four parameters here and I propose to use the following:

    1. CPS --> ???
    2. CPM --> ???
    3. uSv/hr --> S_RADIOACTIVITY (V_LEVEL)
    4. SLOW/FAST -> S_INFO (V_TEXT)


  • We can keep it simple - CPM and uSv/hr are the two typically reported.
    Even more simple - knowing CPM we can figure out uSv/hr


  • Hardware Contributor

    @alexsh1
    Calculation of uSv/hr based on CPM is dependent of the tube. If we do not implement the calculation in the sketch, it must be done in the controller.



  • @FotoFieber my understanding is that all meters are calibrated to either Cs137 or Co60, which is more likely down to the tube. However, I do not understand why we care about the conversion. My geiger meter reports both uSv/hr and CPM and a number of other meters reports exactly the same. If there is any conversion required, it has to be done in the sketch IMHO.



  • @hek Any news on this please? I am missing definition for CPS/CPM.



  • @FotoFieber Cannot use MyMessage msg(CHILD_ID, V_VAR1); as this is not supported by Domoticz.


Log in to reply
 

527
Online

6.9k
Users

7.8k
Topics

82.6k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.