yellowknife
Published

DIY dosimeter for the youngest engineers

The purpose of the article is to create the most detailed assembly instructions how to make your first do-it-yourself radiation detector

BeginnerFull instructions provided2 hours1,571
DIY dosimeter for the youngest engineers

Things used in this project

Hardware components

radsens 2
×1
OLED display SSD1306
×1
MH-FMD Piezo Buzzer Module
×1
Breadboard 120*80
×1
Espressif ESP32 development board
×1

Story

Read more

Custom parts and enclosures

Protection Glass

You should make two pieces - back and forward

Schematics

DIY dosimeter connection scheme

Code

Code for DIY dosimeter

Arduino
// Connecting the libraries
#include <radSens1v2.h>  // RadSens library
#include <Wire.h>        // I2C library
#include <GyverOLED.h>   // One of the easiest-to-learn OLED libraries by Alex Gyver
#define buz 18   // Initializing the buzzer pin. You may change it if you connected buzzer to another pin

GyverOLED<SSD1306_128x64, OLED_NO_BUFFER> oled;   // Initializing OLED screen 
ClimateGuard_RadSens1v2 radSens(RS_DEFAULT_I2C_ADDRESS);   // Initializing RadSens


uint32_t timer_cnt; // Timer for updating count of pulses and intensity
uint32_t timer_imp; // Timer for updating pulses for buzzer
uint32_t timer_oled; // Timer for updating OLED data

float dynval;  // Variable for dynamic intensity value
float statval; // Variable for static intensity value
uint32_t impval;  // Variable for count of impulses
uint32_t pulsesPrev;  // Variable for count of impulses at previous cycle

void setup() {
  pinMode(buz, OUTPUT);  // Initializing buzzer as an output
  ledcSetup(1, 500, 8); // Initializing PWM for buzzer (ONLY FOR ESP DELETE THIS STOKE FOR ARDUINO)
  ledcAttachPin(buz, 1); // Initializing buzzer pin for PWM (ONLY FOR ESP DELETE THIS STOKE FOR ARDUINO)
  oled.init();           // Initializing OLED in code
  oled.flipV(1);         //I has flipped the screen for comfortable use
  oled.flipH(1);         // For normal appearance of text we need horizontal inverting
  oled.clear();
  oled.setScale(2);      // Setting scale of text
  radSens.radSens_init();
  oled.clear();
  radSens.setSensitivity(105);     // Setting sensitivity of Heiger’s tube (in case of not default tube, check technical specifications of your tube to find sensitivity)
  int16_t sensval = radSens.getSensitivity();
  oled.setCursor(10, 2);
  oled.print("Sens:");
  oled.setCursor(42, 4);
  oled.print(sensval);
  delay(4000);
  oled.clear();
  pulsesPrev = radSens.getNumberOfPulses(); //Setting number of pulses to zero
}

void beep(int deltime) {     // Setting time and frequency of buzzer beeps
  ledcWriteTone(1, 500);  // Switching on (freq = 500Hz)
  delay(3);
  ledcWriteTone(1, 0);   // Switching off
  delay(deltime);
}
/*
  void beep(int deltime){
    tone(buz, 500, deltime)
  }                                            same function but for Arduino */

void loop() {

  if (millis() - timer_imp > 250) {  // This function creates crack of buzzer
    timer_imp = millis();
    int pulses = radSens.getNumberOfPulses();
    if (pulses > pulsesPrev) {
      for (int i = 0; i < (pulses - pulsesPrev); i++) {
        beep(30);  // You may change this parameter if you need longer cracks
      }
      pulsesPrev = pulses;
    }
  }

  if (millis() - timer_cnt > 1000) {      // Writing values to global variables
    timer_cnt = millis();
    dynval = radSens.getRadIntensyDyanmic(); 
    statval = radSens.getRadIntensyStatic();
    impval = radSens.getNumberOfPulses();
  }

  if (millis() - timer_oled > 1000) {  //Writing variables to a strings and display them on the screen
    timer_oled = millis();
    String dynint = "Dyn: ";
    dynint += dynval;
    String statint = "Stat:  ";
    statint += statval;
    String nimp = "Imp: ";
    nimp += impval;
    oled.setCursor(0, 1);
    oled.print(dynint);
    oled.setCursor(0, 3);
    oled.print(statint);
    oled.setCursor(0, 5);
    oled.print(nimp);
  }
}

Credits

yellowknife

yellowknife

3 projects • 3 followers

Comments