Git Product home page Git Product logo

iotdevicesdev / ggreg20-v3-tasmota-esp32-driver Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 99 KB

GGreg20_V3 with Generic ESP32 with Tasmota Firmware and Berry script driver example

Home Page: https://iot-devices.com.ua/en/product/ggreg20_v3-ionizing-radiation-detector-with-geiger-tube-sbm-20/

License: Apache License 2.0

Berry 100.00%
tasmota tasmota-templates tasmota-driver esp32 esp32-library ggreg20-v3 iot-devices driver ionizing-radiation geiger-counter

ggreg20-v3-tasmota-esp32-driver's Introduction

Stand With Ukraine

GGreg20_V3 and ESP32 Tasmota Firmware driver

GGreg20_V3 Ionizing Radiation Detector powered SBM-20 GM tube with Generic ESP32 under Tasmota Firmware and Berry script driver example

Hackaday Project Page: https://hackaday.io/project/183103-ggreg20v3-ionizing-radiation-detector

I sell on Tindie

Documentation

Configuration Template

As an example, GPIO0 port as counter1 is used:

{"NAME":"ESP32-GGreg20","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1],"FLAG":0,"BASE":1}

Tasmota32 Berry Script Code

The ggreg20_v3_drv.be code can be loaded manually with copy/paste, or stored in flash and loaded at startup in autoexec.be

Note: This code is supported by ESP32 firmware only.

#-
 - Example of GGreg20_V3 driver written in Berry
 - Copyright IoT-devices, LLC - Kyiv - Ukraine - 2022
 - License https://github.com/iotdevicesdev/ggreg20-v3-tasmota-esp32-driver/blob/main/LICENSE
 - Note. You may additionaly use tasmota.cmd('counter1 0') to reset counter1
 -#

import string
var ctr = 0
var cur_ctr = 0
var cpm = 0
var ma5_pointer = 1
var ma5_val = 0
var dose = 0
ma5 = {}

class GGREG20_V3 : Driver
  var st, fn
  var num_ctr_val
  var ctr_val
  var st_ctr_val
  var ctr

#  print(tasmota.read_sensors())
  
  def read_power()
    import string
    var st = number(string.find(tasmota.read_sensors(), "C1")+4)
    var fn = number(string.find(tasmota.read_sensors(), "ESP32")-4)
    var i = st
    var ctr_val = ''
    var ma5_sum = 0
    while i <= fn do ctr_val = ctr_val + tasmota.read_sensors()[i]; i = i + 1 end end
    if ctr == 0 
      self.st_ctr_val = number(ctr_val); 
      cur_ctr = self.st_ctr_val; 
      ctr = ctr + 1 
    end
    if ctr == 60 
      self.st_ctr_val = number(ctr_val); 
      cur_ctr = self.st_ctr_val; 
      ma5[ma5_pointer] = self.num_ctr_val
      var j = 1
      while j <= size(ma5) do ma5_sum = ma5_sum + ma5[j]; j = j + 1 end end
      ma5_val = ma5_sum / size(ma5)
      dose = dose + (self.num_ctr_val * 0.00009)
      if ma5_pointer <= 4 
        ma5_pointer = ma5_pointer + 1 else ma5_pointer = 1 
      end; 
      ctr = 0 
    end

    cur_ctr = number(ctr_val)
    cpm = cur_ctr - self.st_ctr_val
    self.num_ctr_val = cpm * 0.0054
    return self.num_ctr_val; self.st_ctr_val
  end

  #- trigger a read every second -#
  def every_second()
    self.read_power()
    ctr = ctr + 1
  end

  #- display sensor value in the web UI -#
  def web_sensor()
      import string
      var msg = string.format(
                "{s}GGreg20_V3 cpm{m}%i CPM{e}"..
                "{s}GGreg20_V3 power{m}%1.3f uSv/h{e}"..
                "{s}GGreg20_V3 dose{m}%1.4f uSv{e}"..
                "{s}GGreg20_V3 ma5{m}%1.3f uSv/h{e}", 
                cpm, self.num_ctr_val, dose, ma5_val)
      tasmota.web_send_decimal(msg)
  end

  #- add sensor value to teleperiod -#
  def json_append()
      import string
      var power = self.num_ctr_val
      var msg = string.format(",\"GGreg20_V3\":{\"cpm\":%i,\"power\":%1.3f,\"dose\":%1.4f,\"power ma5\":%1.3f}", cpm, power, dose, ma5_val)
      tasmota.response_append(msg)
  end

end
GGREG20_V3 = GGREG20_V3()
tasmota.add_driver(GGREG20_V3)

Visualization

Following data is calculated by the GGreg20_V3 driver:

  • CPM - SBM-20 counts per minute
  • Ionizing Radiation Power, uSv/H
  • Ionizing Radiation Dose counted from uptime, uSv
  • Ionizing Radiation Power - A 5-minutes Moving Average
{"Time":"2022-01-08T23:22:11","COUNTER":{"C1":6966},"ESP32":{"Temperature":53.3},"GGreg20_V3":{"cpm":25,"power":0.135,"dose":0.0020,"power ma5":0.181},"TempUnit":"C"}

and figured out by the Tasmota's Web UI:

GGreg20_V3 Tasmota ESP32

Buy GGreg_V3 Ionizing Radiation Detector Module

On Tindie: https://www.tindie.com/products/iotdev/ggreg20_v3-ionizing-radiation-detector/

IoT-devices Online Shop: https://iot-devices.com.ua/en/product/ggreg20_v3-ionizing-radiation-detector-with-geiger-tube-sbm-20/

Watch demo video

Watch the video

IoT-devices YouTube Channel:

https://www.youtube.com/channel/UCHpPOVVlbbdtYtvLUDt1NZw/videos

ggreg20-v3-tasmota-esp32-driver's People

Contributors

distrubi avatar iotdevicesdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

aldweb

ggreg20-v3-tasmota-esp32-driver's Issues

geiger counters Radiation D v1.1 Cajoe with J305 tube

Hello
I followed the steps described in this project but it does not calculate my radiation value.

Can you adapt this project for my setup?:

  • Tasmota on nodemcu esp32 hw-463
  • counter pulse on GPIO36
  • geiger counters Radiation D v1.1 Cajoe with J305 tube
    I want to implement the values obtained in Domoticz
    Thank you!
    geiger counter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.