Gravity: Geiger Counter Module Ionizing Radiation Detector Wiki - DFRobot


Ionizing radiation, an invisible and intangible enemy, exists not only in nuclear power plant reactors. In fact, we are bombarded by radiation from the surrounding environment and outer space all the time, but fortunately our body is strong enough to resist the natural background radiation.

No active contact does not mean that high-energy ionizing radiation will not be encountered. Natural marble building materials, ore gems with different colors, and "negative ion powder" of unknown composition may contain different amounts of radioactive elements. With the use of a Geiger counter, these radioactive sources have nowhere to hide.

In addition, the Geiger counter is a good random number generator, and undetermined high-energy particle ionization events can provide enough random entropy to get you a truly random number, rather than a fixed random sequence based on a random algorithm.



Geiger Counter

M4011 Geiger Tube

Function Description


  1. Pin
  1. Switch



Connection Diagram

Connection Diagram.png

The Geiger counter library needs to use external interrupts for counting, so it can only be connected to external interrupt pins.
On Arduino UNO, the external interrupts are pins 2 and 3. For other development boards, please refer to the development documentation.

Arduino Development Board External Interrupts Reference Document

Sample program

  @file geiger.ino
  @brief    Detect CPM radiation intensity, the readings may have a large deviation at first, and the data tends to be stable after 3 times
  @copyright   Copyright (c) 2010 DFRobot Co.Ltd (
  @licence     The MIT License (MIT)
  @author [fengli](
  @version  V1.0
  @date  2021-9-17
  @get from

#include <DFRobot_Geiger.h>
#if defined ESP32
#define detect_pin D3
#define detect_pin 3
   @brief Constructor
   @param pin   External interrupt pin
DFRobot_Geiger  geiger(detect_pin);

void setup()
  //Start counting, enable external interrupt

void loop() {
  //Start counting, enable external interrupt
  //Pause the count, turn off the external interrupt trigger, the CPM and radiation intensity values remain in the state before the pause
  //Get the current CPM, if it has been paused, the CPM is the last value before the pause
  //Predict CPM by falling edge pulse within 3 seconds, the error is ±3CPM
  //Get the current nSv/h, if it has been paused, nSv/h is the last value before the pause
  //Get the current μSv/h, if it has been paused, the μSv/h is the last value before the pause

Upload the program and open the serial monitor to view the output results. The reading takes about half a minute to stabilize.

Pause count

Since the Geiger counter uses external interrupts, other programs that are being executed by the Arduino are suspended when the output signal triggers the interrupt. If the I/O pin is being operated to communicate with other devices, a sudden insertion of an interrupt may cause a communication error. The Geiger counter library provides a pause counting function to temporarily turn off external interrupts to avoid the impact.

//Pause count

//restore count

geiger.pause(); Keeps radiation readings in their last state before pausing until geiger.start(); is executed to continue counting.

Pausing the count will affect the measurement accuracy, please only pause when necessary.


More Documents