Geiger counter with HA integration?

I am very interested if there is a direct ESPhome integration. I guess it’s a simple pulse compter ?

1 Like

I’ve never used ESPHome as I prefer stuff to be wired via Ethernet (because of reliability, longevity, and have to power it with a wire anyway) but here is my best guess at an ESPHome config for CPM:

sensor:
  - platform: pulse_counter
    pin: (whatever)
    name: "Radiation CPM"
    count_mode: rising_edge
    update_interval: 60
    unit_of_measurement: CPM

And with a CPM measurement you can calculate dose rates in your automation.

Or change the update_interval to a lower value and multiply in the automation to get the measurement more often.

2 Likes

I just set it up with ESPHome and it was very easy!

Very basic code and wiring.

This is the relevant code part of the ESPHome device, an ESP8266:

sensor:
  - platform: pulse_counter
    pin: GPIO4
    name: "Geiger Counter"
    update_interval: 15s

EDIT: I fixed the code. I realized that ESPhome calculates correctly the pulse/minute when changing the update_interval from default value.

8 Likes

Thanks a lot :)… It will helps me

Hi.

I can’t get this to work on my ESP32, as the counter does not increase with the impulses from the sensor.

Did you set any count_mode parameter latter on?

Thanks.

The solution for ESP8266 (GPIO14) and ESP32 (GPIO36): Pulse_counter pin goes high

2 Likes

How you convert CPM to uSv ?

You can find an example on the website at https://rhelectronics.net/store/radiation-detector-geiger-counter-diy-kit-second-edition.html

The Arduino Code by Brian Gauger" link has the simplest method of just multiplying it by a “magic number” conversion factor:

https://ln.sync.com/dl/e5ef275c0/jrxzkzjn-gpgn4svx-s8z9873v-np2ieuw7

For the SBM-20 used in the RH Electronics kit, multiply the CPM by 0.0057.

For different tubes, usually a Google will turn up the magic number. Or you have to go hunting for the tube datasheet.

Anyone has this working with Wemos D1 Mini? I’m still trying to figure out if I have faulty kit or doing something completely wrong :slight_smile:

What is the problem you are having?

Keep in mind that most of the Geiger kits output a 5V pulse.

ESP8266 isn’t 5V tolerant on most I/O pins.

What pin are you using?

What firmware?

Have you verified the Geiger counter works by itself with a speaker or scope on the output?

Thanks for followup @AaronCake.
I tried to get it working with Wemos D1 mini - it is producing ticking sound and LED is blinking too.
No matter what pin I’m using (tried D4 and D5 ) I get strange results. Even with some blinking, it’s giving very low rates - mostly 0, and maximum is 0,00x.
I did use J305 multipliers 0.00812037037037 (tried even 123.147092360319)

The problem is that even when it registers something (led + sound) I get 0 - that can be dozen of ticks a minute and still 0.

Also, I’m using 4 decimal spaces - still getting 0.

EDIT: Forgot to say - I’m using ESPHome for testing. Also counter receives power from ESP board, not independently.

I’ve never used ESPHome so I can’t say how that would need to be set up.

However, if you replace the Geiger counter with a button, momentary switch connected to VCC (or just a wire you can tap), do you get any counts when you press the button or tap the wire?

Did you guys see my post about a Geiger counter?
https://www.connectix.nl/connecting-a-geiger-counter-to-home-assistant/

I also can provide a ready-to-use example on integration of the GGreg20_V3 (SBM20 tube) ionizing radiation detector module into the HA using ESPHome under ESP8266 or ESP32.
https://github.com/iotdevicesdev/ggreg20-v3-homeassistant-esphome-example
It is also simple to convert those sample yaml-code to support any simmilar tubes tunning a convertion coef.
BR,

1 Like

There’s another version on sale through Banggood now - one with an oled display. Has anybody integrated this with HA?

i bought one, needed some mods to get it working. put esphome on it. works a treat.

4 Likes

that is just some grafics with the duration of the data?

the device puts out CPM. The Geiger tube has a specific micro Sieverts per hour calibration depending on the type of tube. Just added ESP32 and ESP home to count and transmit the data.

Here is my ESPH code.


esphome:
  name: esp-geiger01

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger: 
  #level: VERY_VERBOSE
  
# #Enable Home Assistant API
api:
 password: "getyourown"
 encryption:
  key: "getyourown="

ota:
  password: "getyourown"

wifi:
  ssid: urssid
  password: "getyourown"
  domain: .urdomain.local
  
# #Optional manual IP
  manual_ip:
    static_ip: x.x.x.x
    gateway: x.x.x.x
    subnet: 255.255.255.0
    dns1: x.x.x.x
    
switch:
  - platform: restart
    name: "esp-geiger01 Restart"

sensor:
  - platform: uptime
    name: "esp-geiger01 Uptime"
    update_interval: 60s
    
  - platform: wifi_signal
    name: "esp-geiger01 Wi-Fi Signal"
    update_interval: 60s

  - platform: pulse_counter
    pin: GPIO36
    name: "esp-geiger01 geiger counter CPM" 
    id: "geiger_counter"
    update_interval: 60s
    unit_of_measurement: 'CPM'
    on_raw_value:
      - sensor.template.publish:
          id: radiation_level
          state: !lambda 'return x *0.0081;'
# # this was what I got for my data sheet and it matched reasonably well with the background data that I have.  Many people are using other values.
          
  - platform: template
    name: "esp-geiger01 Radiation Level"
    id: "radiation_level"
    unit_of_measurement: 'µSv/h'
    update_interval: 60s
    icon: mdi:radioactive
    accuracy_decimals: 5
    
  - platform: dht
    update_interval: 10s
    pin: GPIO16
    model: DHT11
    temperature:
     name: "esp-geiger01 Temperature"
     unit_of_measurement: "°C" 
     filters:
      offset: 0
     
    humidity:
      name: "esp-geiger01 Humidity"
      filters:
       offset: 10
    
binary_sensor:
  - platform: template
    device_class: safety
    name: "esp-geiger01 Radiation Warning"
    # # This doesn't necessarily represent a "dangerous" count, but one that is abnormally high
    lambda: |-
      if (id(geiger_counter).state > 100) {
        // High Count.
        return true;
      } else {
        // Normal Count.
        return false;
      }

text_sensor:
  - platform: version
    name: "esp-geiger01  ESPHome version"

time:
  - platform: homeassistant
    id: homeassistant_time

1 Like

I know that my question is about the graphs… I know how to do them with time but…. How do you do the top limit? I assume that it’s the security point isn’t it?

type: custom:mini-graph-card
name: Radiation Level - 1hr
icon: mdi:radioactive
hours_to_show: 1
points_per_hour: 60
line_width: 1
entities:
  - entity: sensor.esp_geiger01_radiation_level
    name: µSv/h
    units: µSv/h
    line_width: 5
    color: green
    show_state: true
    show_line: true
    show_fill: true
    show_points: true
  - entity: sensor.virtual_sensor_020_usv
    name: 020 µSv
    units: µSv
    line_width: 5
    color: orange
    show_state: false
    show_legend: false
    show_line: true
    show_fill: false
    show_points: false

2022-07-19_192009 - Copy

Create Virtual sensors in your HA configuration.yaml and add them to the graph

#Virtual CPM for Graphing
  - platform: virtual
    name: 'sensor.30_CPM'
    class: measurement
    initial_value: 30
    initial_availability: true
    
#Virtual µSv for Graphing
  - platform: virtual
    name: 'sensor.020_µSv'
    class: measurement
    initial_value: 0.20
    initial_availability: true
2 Likes