├── .gitignore ├── LICENSE ├── README.md ├── Schematic.fzz ├── i2c_screen.jpg ├── images ├── final_product.png ├── geiger_hardware.png ├── hc06.png ├── nano.png └── signal_pin.png ├── nrd_code └── nrd_code.ino └── schematic.png /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Martin Kankaanranta 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Radiation Detector 2 | 3 | Arduino code for Nitramite 4 | [Nuclear Radiation Detector Android application](https://play.google.com/store/apps/details?id=com.nitramite.radiationdetector). 5 | This repository exists so that app users can get code, open issues and make contributions. 6 | 7 | To get started see [firmware versions](#firmware-versions) part or look table of contents for more. 8 | 9 | Making this hardware requires a little bit of knowledge with Arduino's, soldering, wiring and maybe little bit of 10 | Arduino 11 | programming depending on which Geiger counter hardware you are using and how much it required you to customise this 12 | code. 13 | 14 | 15 | Table of contents 16 | ================= 17 | 18 | * [How did I do it?](#how-did-i-do-it) 19 | * [Related links](#related-links) 20 | * [Firmware versions](#firmware-versions) 21 | * [Hardware schematic](#schematic) 22 | * [Oled screen support (optional)](#oled-screen-support) 23 | * [Module](#module) 24 | * [Pinouts](#pinouts) 25 | * [Required libraries](#required-libraries) 26 | * [More information](#more-information) 27 | * [Real life image](#real-life-image) 28 | * [Fritzing parts (for schematic drawing)](#fritzing-parts) 29 | 30 | How did I do it? 31 | ============ 32 | 33 | This is my version how did I do it just for reference. 34 | 35 | 1. You need any hardware capable to be connected to Arduino. I connected my Aliexpress kit to Arduino digital pin three. 36 | Arduino code is doing CPM measurement and transformation to uSv/h. Arduino sends readings to Android app every 10 37 | seconds. 38 | ![geiger_hardware.png](./images/geiger_hardware.png) 39 | Kit I bought looked like this. You can use any kit which has Arduino cababilities. Usually told at description of 40 | item.

41 | 2. You don't need to modify reading output from Arduino code but if you do, remember to have it in form like: 42 | `cpm=924;uSv/h=7.5029` 43 | App will look for splitter char `;` -> `cpm=` and `uSv/h=` extract values and show them. Arduino code also sends all 44 | ticks 45 | as t; don't modify this or remove it.

46 | 3. I used this kind of Arduino Nano: 47 | ![geiger_hardware.png](./images/nano.png) 48 | I used HC-06 bluetooth module to send data from Arduino. It looks like this: 49 | ![geiger_hardware.png](./images/hc06.png)

50 | 4. Use [hardware schematic](#schematic) section drawing to solder wires according to instruction.

51 | 5. 52 | * Serial.prints are actual TX which arduino bluetooth module will output for Android application. Don't change that. 53 | * So what ever you do, don't change output format. You can output any values you want with specified titles as 54 | tests. 55 | * I am using Arduino Nano and HC-06 module. You can use what ever you like. 56 | * I tested my cheap kit with americium-241 which was found from old fire detector. 57 | * Note: this cheap kit signal pin is labeled as VIN which is misleading. See image below which shows where 58 | connection 59 | point between Arduino and Geiger counter is in this specific kit. 60 | ![geiger_hardware.png](./images/signal_pin.png) 61 | If you have questions about this app or Arduino side, open issue or https://nitramite.com/contact.html. 62 |

63 | 6. Heres final product: 64 | ![geiger_hardware.png](./images/final_product.png) 65 | 66 | Related links 67 | ============ 68 | [Android Application](https://play.google.com/store/apps/details?id=com.nitramite.radiationdetector) 69 | [Youtube promo video](https://youtu.be/VzV9t7CP7Yc) 70 | 71 | 72 | Firmware Versions 73 | ============ 74 | To use only basic Geiger counter, Bluetooth module and Arduino combo, just download 75 | [basic first version code relase 1.0.0](https://github.com/norkator/radiation-detector-arduino/archive/1.0.0.zip). 76 | 77 | To support oled screen or any other future hardware, download 78 | [current main branch code](https://github.com/norkator/radiation-detector-arduino/archive/main.zip). 79 | 80 | 81 | Schematic 82 | ============ 83 | Repository has updated Schematic made with Fritzing. Some more information could be found 84 | [from here](http://www.nitramite.com/radiation-detector.html). 85 | 86 | ![Schematic](./schematic.png) 87 | 88 | 89 | Oled screen support 90 | ============ 91 | Here is some information about Oled screen support. 92 | 93 | Module 94 | ----- 95 | SSD1306 Oled 96 | 97 | Pinouts 98 | ----- 99 | 100 | * SDA -> A4 (i2c) 101 | * SCL -> A5 (i2c) 102 | * GND -> Ground 103 | * VDD -> 5v (Screen pin labeled as VCC or VDD) 104 | 105 | Required libraries 106 | ----- 107 | 108 | * Adafruit BusIO 109 | * Adafruit-GFX-Library 110 | * Adafruit_SSD1306 111 | 112 | More information 113 | ----- 114 | Good tutorial: 115 | https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/ 116 | 117 | Real life image 118 | ----- 119 | ![OledScren](./i2c_screen.jpg) 120 | 121 | 122 | Fritzing parts 123 | ============ 124 | Custom parts which may not be found from Fritzing by default 125 | 126 | * [HC-06 module](https://github.com/RafaGS/Fritzing/blob/master/Bluetooth%20HC-06.fzpz) 127 | * [Oled Screen](https://ajcreatif.com/oled_128x64_I2C_monochrome_display.fzpz) 128 | -------------------------------------------------------------------------------- /Schematic.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/Schematic.fzz -------------------------------------------------------------------------------- /i2c_screen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/i2c_screen.jpg -------------------------------------------------------------------------------- /images/final_product.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/images/final_product.png -------------------------------------------------------------------------------- /images/geiger_hardware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/images/geiger_hardware.png -------------------------------------------------------------------------------- /images/hc06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/images/hc06.png -------------------------------------------------------------------------------- /images/nano.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/images/nano.png -------------------------------------------------------------------------------- /images/signal_pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/images/signal_pin.png -------------------------------------------------------------------------------- /nrd_code/nrd_code.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * Arduino radiation Geiger counter Project 3 | * Coding started 15.06.2019 4 | * Code constructed from various sources to archieve CPM and uSv/h counts 5 | * Transforming CPM (Counts per minute) to uSV/h here at Arduino side 6 | * Send reading to front end via bluetooth every 10 sec 7 | * 8 | * Changelog 9 | * # 15.06.2019, Initial code 10 | * # 16.06.2019, Added Serial.println("t;"); to play sound on Android app 11 | * # xx.12.2020, Week 51, Added code for i2c screen support, requested by user 12 | */ 13 | 14 | /** 15 | * ### Chart ## 16 | * CPM uSv/hr Description 17 | * ------------------------------------ 18 | * 12 0.10 Average background 19 | * 25 0.21 World average 20 | * 50 0.42 Normal on short duration 21 | * 60 0.5 Larger peak of short duration 22 | * 100 0.83 Larger peak of longer duration 23 | * 150 1.25 Getting into dangerous area 24 | * 500 4.17 Dangerous, leave immediately! 25 | */ 26 | 27 | /** 28 | * Sample output 29 | * cpm=924;uSv/h=7.5029 30 | * cpm=780;uSv/h=6.3336 31 | * cpm=816;uSv/h=6.6259 32 | */ 33 | 34 | /* 35 | * Oled screen support 36 | * To enable following screen support you need to install libs: "Adafruit BusIO", "Adafruit-GFX-Library" and "Adafruit_SSD1306" 37 | * Display pins: 38 | * SDA -> A4 (i2c) 39 | * SCL -> A5 (i2c) 40 | * GND -> Ground 41 | * VDD -> 5v (Screen pin labeled as VCC or VDD) 42 | */ 43 | #include 44 | #include 45 | #include 46 | #define OLED_RESET 4 47 | Adafruit_SSD1306 display(OLED_RESET); 48 | 49 | // Pins 50 | const int GEIGER_COUNTER_PIN = 3; 51 | unsigned long OLED_SCREEN_I2C_ADDRESS = 0x00; // 0x00 = disabled 52 | 53 | // Variables 54 | long count = 0; 55 | long countPerMinute = 0; 56 | float usvh = 0.0; 57 | long timePreviousMeassure = 0; 58 | 59 | // Conversion factor - CPM to uSV/h 60 | #define CONV_FACTOR 0.00812 61 | 62 | // Setup 63 | void setup() { 64 | 65 | // Init serial 66 | Serial.begin(9600); 67 | 68 | delay(2000); 69 | 70 | // Init pins 71 | pinMode(GEIGER_COUNTER_PIN, INPUT); 72 | 73 | attachInterrupt(digitalPinToInterrupt(GEIGER_COUNTER_PIN), tick, FALLING); //define external interrupts 74 | Serial.println("Init arduino geiger counter"); 75 | 76 | OLED_SCREEN_I2C_ADDRESS = findOledScreen(); 77 | if (OLED_SCREEN_I2C_ADDRESS != 0x00) { 78 | // Just note, every tutorial screen has same address, 0x3C 79 | Serial.println("--> " + OLED_SCREEN_I2C_ADDRESS); 80 | display.begin(SSD1306_SWITCHCAPVCC, OLED_SCREEN_I2C_ADDRESS); 81 | display.clearDisplay(); 82 | } 83 | } 84 | 85 | 86 | // Loop 87 | void loop() { 88 | if (millis() - timePreviousMeassure > 10000){ 89 | countPerMinute = 6 * count; 90 | usvh = countPerMinute * CONV_FACTOR; 91 | timePreviousMeassure = millis(); 92 | Serial.print("cpm="); 93 | Serial.print(countPerMinute, DEC); 94 | Serial.print(";"); 95 | Serial.print("uSv/h="); 96 | Serial.println(usvh, 4); 97 | writeOledScreenText((String) countPerMinute, (String) usvh); // Todo, verify this 98 | count = 0; 99 | } 100 | } 101 | 102 | 103 | void tick() { 104 | Serial.println("t;"); 105 | detachInterrupt(0); 106 | count++; 107 | while(digitalRead(GEIGER_COUNTER_PIN) == 0){ 108 | } 109 | attachInterrupt(0, tick, FALLING); 110 | } 111 | 112 | 113 | /** 114 | * Find first responding i2c address 115 | * because we only have one i2c device connected (hopefully) 116 | */ 117 | long findOledScreen() { 118 | Serial.println ("Scanning for I2C Oled screen."); 119 | byte count = 0; 120 | Wire.begin(); 121 | for (byte i = 1; i < 127; i++) { 122 | // Serial.println("Scanning " + i); 123 | Wire.beginTransmission (i); 124 | if (Wire.endTransmission () == 0) { 125 | 126 | Serial.print("Found i2c address: "); 127 | Serial.print(i, DEC); 128 | Serial.print(" | "); 129 | Serial.println(i, HEX); 130 | 131 | return i; 132 | 133 | count++; 134 | delay (1); 135 | } 136 | } 137 | return 0x00; 138 | } 139 | 140 | 141 | /** 142 | * Write oled screen content 143 | * Good tutorial: https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/ 144 | */ 145 | void writeOledScreenText(String cpm, String usvh) { 146 | if (OLED_SCREEN_I2C_ADDRESS != 0x00) { 147 | display.clearDisplay(); 148 | 149 | display.setTextColor(WHITE); 150 | display.setTextSize(1); 151 | display.setCursor(0,0); 152 | display.print("CPM | uSv/h"); 153 | display.setTextSize(2); 154 | display.setCursor(0,10); 155 | display.print(cpm); 156 | display.print(" | "); 157 | display.print(usvh); 158 | 159 | // Draw content 160 | display.display(); 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/norkator/radiation-detector-arduino/5b5da7795574c73681952e7c74520dddcd0cc463/schematic.png --------------------------------------------------------------------------------