19 Commits

Author SHA1 Message Date
Holger Fleischmann
92b42556f8 Merge branch 'master' of https://github.com/grillbaer/esp32-geiger-counter 2021-04-09 12:00:31 +02:00
Holger Fleischmann
e044850b90 Set WiFi persistent false to fix connect error #4 2021-04-09 12:00:22 +02:00
Holger Fleischmann
cffa2c43f0 Update README.md 2021-03-07 17:33:05 +01:00
Holger Fleischmann
17845b6f9f blinky LED now on GPIO 18 2021-03-07 17:30:51 +01:00
Holger Fleischmann
ed8bc79706 changed pins for EZSCB ESP32 2021-03-07 16:46:23 +01:00
Holger Fleischmann
bd8315be1b updated readme for schematic 2021-01-30 17:59:32 +01:00
Holger Fleischmann
2e4d51c08e checked and corrected KiCad schematic 2021-01-30 17:55:42 +01:00
Holger Fleischmann
88a98fb8d2 Update README.md 2021-01-30 11:14:22 +01:00
Holger Fleischmann
38c69ce641 added re-engineered DRAFT KiCad schematics 2021-01-29 20:46:58 +01:00
Holger Fleischmann
4eed311214 Fixed typo 2020-12-12 21:54:48 +01:00
Holger Fleischmann
e2f9e6fb25 added badge for github actions 2020-12-10 19:38:36 +01:00
Holger Fleischmann
df997b295b trying to fix travis ci build 2020-12-10 19:35:12 +01:00
Holger Fleischmann
82ca57b63b trying to fix travis ci build 2020-12-10 19:31:57 +01:00
Holger Fleischmann
24d9f56191 trying github actions for building 2020-12-10 19:22:24 +01:00
Holger Fleischmann
748b82144e trying to fix travis ci build 2020-12-10 19:17:51 +01:00
Holger Fleischmann
3518e171a1 added SSL/TLS support for MQTT 2020-12-10 19:07:28 +01:00
Holger Fleischmann
733ca426a4 trying to fix mqtt stops to work after a few hours 2020-11-15 11:36:06 +01:00
Holger Fleischmann
91c7b5e2ef added one decimal to uSph for MQTT export 2020-11-14 20:57:09 +01:00
Holger Fleischmann
ee81a2f49b added MQTT publishing support 2020-11-14 14:44:22 +01:00
18 changed files with 2037 additions and 29 deletions

31
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: PlatformIO CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
run: pio run

View File

@@ -1,15 +1,16 @@
language: python
python:
- "2.7"
- "3.7"
sudo: false
cache:
directories:
- "~/.platformio"
- $HOME/.cache/pip
install:
- pip install -U platformio
- platformio update
- pio update
script:
- platformio run
- pio run

View File

@@ -1,13 +1,15 @@
[![Build Status](https://travis-ci.org/grillbaer/esp32-geiger-counter.svg?branch=master)](https://travis-ci.org/grillbaer/esp32-geiger-counter)
![PlatformIO CI](https://github.com/grillbaer/esp32-geiger-counter/workflows/PlatformIO%20CI/badge.svg) [![Build Status](https://travis-ci.org/grillbaer/esp32-geiger-counter.svg?branch=master)](https://travis-ci.org/grillbaer/esp32-geiger-counter)
# IoT Geiger Counter with ESP32, OLED Display and Thingspeak Channel
# IoT Geiger Counter with ESP32, OLED Display, Thingspeak Channel and MQTT
- Measures radioactive gamma and beta radiation with quite good resolution at the typical low levels of the natural radiation (due to the big STS-6 tube)
- Displays the current counts per minute (CPM), estimated dose equivalent rate in micro-Sievert per hour (µS/h) and 10 minutes history with 5 second resolution as bargraph
![Circuit Board](media/geiger-counter-pcb.jpg)
- Low-power mode for use with batteries, OLED display and click sounds on, WiFi off
- WiFi mode for thingspeak data upload every minute, see https://thingspeak.com/channels/758223
- WiFi mode for
- optional thingspeak data upload every minute, see https://thingspeak.com/channels/758223
[![https://thingspeak.com/channels/758223](media/thingspeak.png)](https://thingspeak.com/channels/758223)
- MQTT publishing to a broker every minute with optional SSL/TLS support
Feel free to use this project as a base for your own projects AT YOUR OWN RISK!
@@ -16,19 +18,32 @@ Feel free to use this project as a base for your own projects AT YOUR OWN RISK!
- Russian Geiger counter tube STS-6 (CTC-6) at 400 V with ~5 MΩ series resistor
- High voltage circuit from ArnoR at mikrocontroller.net https://www.mikrocontroller.net/topic/380666, schematic https://www.mikrocontroller.net/attachment/273334/HystereseStepUpTLC555-2.png. *Keep the high-voltage capacitor small to avoid dangerous charges! For safety avoid any contact with the high voltage parts!*
- ~400 µs pulse generation using Geiger tube series resistors as voltage divider, high impedance input to darlington transistor and TLC 555 timer for rectangle pulse generation (schematic and pulses see below)
- ESP32 board Wemos Lolin32
- ESP32 board EzSBC ESP32-01
- OLED 128x64 with controller SH1106 at I2C
- Voltage supply from either USB or power supply or 3x 1.5V AAA batteries, circuit works stable from 3.0 V up to 5.0 V
- Pulse input is expected at GPIO 18 (high pulses with at least about 250 µs length)
- Pulse input is expected at GPIO 15 (high pulses with at least about 250 µs length)
- Switch for WiFi mode is expected at GPIO 4 (low=WiFi mode, high=low-power mode)
- OLED I2C bus is expected at GPIO 22 (SCK) and 21 (SDA)
- Pins may be adjusted in `main.cpp`
# Software
- [PlatformIO VSCode project](https://github.com/platformio/platformio-vscode-ide) using [Arduino](https://github.com/arduino/Arduino) library, [Espressif ESP-IDF](https://github.com/espressif/esp-idf) for sleep functions and [U8g2](https://github.com/olikraus/u8g2) for display output
- [PlatformIO VSCode project](https://github.com/platformio/platformio-vscode-ide) using [Arduino](https://github.com/arduino/Arduino) library, [Espressif ESP-IDF](https://github.com/espressif/esp-idf) for sleep functions, [U8g2](https://github.com/olikraus/u8g2) for display output and [Arduino-MQTT](https://github.com/256dpi/arduino-mqtt).
- Low-power mode uses light sleep, a wake-up for each signal pulse change and a wake-up every 1000 ms to update pulse statistics and OLED. This results in about 90% sleep. Could be improved using deep sleep and ULP. However, light sleep is already quite good and much easier.
- WiFi mode uses no sleep and simple interrupts for pulse counting. Pulse statistics and OLED are updated every 1000 ms, data is sent to thingspeak every 60 s.
- Credentials (WiFi SSID, password, thingspeak channel key) are declared in `credentials.h` and replaced by dummy values in `credentials.cpp` by default. Define your real secrets in a sibling file named `secret_credentials.h` (which is never committed!). It will automatically be included by `credentials.cpp` if it exists.
- Credentials, addresses and user for WiFi, thingspeak channel and mqtt broker are declared in `credentials.h` and replaced by dummy values in `credentials.cpp` by default. Define your real secrets in a sibling file named `secret_credentials.h` (do never commit!). It will be automatically included by `credentials.cpp` if it exists. You may copy `TEMPLATE_secret_credentials.h` as a starting point.
# MQTT Message Format
Published messages have the following JSON format:
```json
{
"pulses": 69,
"cpm": 69,
"uSph": 0.08,
"secs": 60
}
```
# Geiger Tube Pulse Forming
@@ -45,3 +60,9 @@ This is the formed pulse at point B, from 5 V to about 0.5 V for 200 µs:
![Formed pulse at output point B](media/geiger-signal-formed.png)
It is then fed into a 555 timer to further extend its duration for the ESP32 wake-up from low-power mode.
# Schematic
KiCad files are located in folder `hardware`. Currently only schematic, no PCB.
![Schematics](media/kicad-circuit-sketch.png)

View File

@@ -0,0 +1,9 @@
EESchema-DOCLIB Version 2.0
#
$CMP MPSA44
D 0.5A Ic, 400V Vce, NPN High Voltage Transistor, TO-92
K NPN High Voltage Transistor
F http://www.onsemi.com/pub_link/Collateral/MPSA42-D.PDF
$ENDCMP
#
#End Doc Library

View File

@@ -0,0 +1,135 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# ADS1115_ADC_Module
#
DEF ADS1115_ADC_Module U 0 40 Y Y 1 F N
F0 "U" 300 150 50 H V C CNN
F1 "ADS1115_ADC_Module" 350 50 50 H V C CNN
F2 "" 300 150 50 H I C CNN
F3 "" 300 150 50 H I C CNN
DRAW
S 100 -50 550 -1150 0 1 0 f
X A3 1 0 -1050 100 R 50 50 1 1 I
X VDD 10 0 -150 100 R 50 50 1 1 W
X A2 2 0 -950 100 R 50 50 1 1 I
X A1 3 0 -850 100 R 50 50 1 1 I
X A0 4 0 -750 100 R 50 50 1 1 I
X ALRT 5 650 -650 100 L 50 50 1 1 O
X ADDR 6 650 -550 100 L 50 50 1 1 I
X SDA 7 650 -450 100 L 50 50 1 1 B
X SCL 8 650 -350 100 L 50 50 1 1 I
X GND 9 0 -250 100 R 50 50 1 1 W
ENDDRAW
ENDDEF
#
# EzSBC_ESP32-01
#
DEF EzSBC_ESP32-01 U 0 40 Y Y 1 F N
F0 "U" 0 900 50 H V C CNN
F1 "EzSBC_ESP32-01" 0 750 50 H V C CNN
F2 "" 0 900 50 H I C CNN
F3 "" 0 900 50 H I C CNN
DRAW
S -850 1050 850 -1050 0 1 0 f
X GND 20 -950 -950 100 R 50 50 0 0 W
X GND 21 950 -950 100 L 50 50 0 0 W
X Vin 22 950 -850 100 L 50 50 0 0 W
X 3.3V 23 950 -750 100 L 50 50 0 0 w
X GND 3 -950 750 100 R 50 50 0 0 W
X 3.3V 32 950 150 100 L 50 50 0 0 w
X Vin 37 950 650 100 L 50 50 0 0 W
X GND 38 950 750 100 L 50 50 0 0 W
X IO36 1 -950 950 100 R 50 50 1 1 I
X IO25/RTC6 10 -950 50 100 R 50 50 1 1 B
X IO26/RTC7 11 -950 -50 100 R 50 50 1 1 B
X IO27/RTC17 12 -950 -150 100 R 50 50 1 1 B
X n.c. 13 -950 -250 100 R 50 50 1 1 N
X IO23/VSPI_MOSI 14 -950 -350 100 R 50 50 1 1 B
X IO22/I2C_SCL 15 -950 -450 100 R 50 50 1 1 B
X IO21/I2C_SDA 16 -950 -550 100 R 50 50 1 1 B
X EN/Reset 17 -950 -650 100 R 50 50 1 1 I
X 3.3V 18 -950 -750 100 R 50 50 1 1 w
X Vin 19 -950 -850 100 R 50 50 1 1 W
X IO39 2 -950 850 100 R 50 50 1 1 I
X IO0/RTC11/Boot 24 950 -650 100 L 50 50 1 1 B
X IO2/RTC12 25 950 -550 100 L 50 50 1 1 B
X IO4/RTC10 26 950 -450 100 L 50 50 1 1 B
X IO5/VSPI_SS 27 950 -350 100 L 50 50 1 1 B
X IO12/RTC15/HSPI_MISO 28 950 -250 100 L 50 50 1 1 B
X IO13/RTC14/HSPI_MOSI 29 950 -150 100 L 50 50 1 1 B
X IO14/RTC16/HSPI_SCK 30 950 -50 100 L 50 50 1 1 B
X IO15/RTC13/HSPI_SS 31 950 50 100 L 50 50 1 1 B
X IO16/L1_RED 33 950 250 100 L 50 50 1 1 B
X IO17/L1_GREEN 34 950 350 100 L 50 50 1 1 B
X IO18/VSPI_SCK/L1_BLUE 35 950 450 100 L 50 50 1 1 B
X IO19/VSPI_MISO/L2_BLUE 36 950 550 100 L 50 50 1 1 B
X IO3/RX0 39 950 850 100 L 50 50 1 1 I
X Vin 4 -950 650 100 R 50 50 1 1 W
X IO1/TX0 40 950 950 100 L 50 50 1 1 O
X IO35 5 -950 550 100 R 50 50 1 1 I
X IO34 6 -950 450 100 R 50 50 1 1 I
X IO33/RTC8 7 -950 350 100 R 50 50 1 1 B
X IO32/RTC9 8 -950 250 100 R 50 50 1 1 B
X 3.3V 9 -950 150 100 R 50 50 1 1 w
ENDDRAW
ENDDEF
#
# MPSA44
#
DEF MPSA44 Q 0 40 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "MPSA44" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 0 0 25 0 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F
X E 1 100 -200 100 U 50 50 1 1 P
X B 2 -200 0 200 R 50 50 1 1 I
X C 3 100 200 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Pressure_R_Bridge
#
DEF Pressure_R_Bridge U 0 40 Y Y 1 F N
F0 "U" 650 -850 50 V V C CNN
F1 "Pressure_R_Bridge" 550 -850 50 V V C CNN
F2 "" 650 -850 50 V I C CNN
F3 "" 650 -850 50 V I C CNN
DRAW
A -450 -850 50 -899 899 0 1 0 N -450 -900 -450 -800
S -450 -450 450 -1250 0 1 0 f
S -250 -1000 -50 -1100 0 1 0 N
S -250 -700 -50 -600 0 1 0 N
S 50 -1100 250 -1000 0 1 0 N
S 50 -600 250 -700 0 1 0 N
P 2 0 1 4 -50 -1050 50 -1050 N
P 2 0 1 4 0 -1050 0 -1250 N
P 2 0 1 4 0 -450 0 -650 N
P 2 0 1 4 50 -650 -50 -650 N
P 3 0 1 4 -300 -1250 -300 -1050 -250 -1050 N
P 3 0 1 4 -300 -450 -300 -650 -250 -650 N
P 3 0 1 0 -200 -1000 -150 -1100 -100 -1000 N
P 3 0 1 0 -200 -700 -150 -600 -100 -700 N
P 3 0 1 0 100 -1100 150 -1000 200 -1100 N
P 3 0 1 0 100 -600 150 -700 200 -600 N
P 5 0 1 4 250 -1050 300 -1050 300 -450 300 -650 250 -650 N
X A_low 1 -300 -1350 100 U 50 50 1 1 P
X A_mid 2 0 -1350 100 U 50 50 1 1 P
X n.c. 3 300 -1350 100 U 50 50 1 1 N
X AB_top 4 300 -350 100 D 50 50 1 1 P
X B_mid 5 0 -350 100 D 50 50 1 1 P
X B_low 6 -300 -350 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

View File

@@ -0,0 +1,491 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Connector_Conn_01x02_Male
#
DEF Connector_Conn_01x02_Male J 0 40 Y N 1 F N
F0 "J" 0 100 50 H V C CNN
F1 "Connector_Conn_01x02_Male" 0 -200 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_1x??_*
$ENDFPLIST
DRAW
S 34 -95 0 -105 1 1 6 F
S 34 5 0 -5 1 1 6 F
P 2 1 1 6 50 -100 34 -100 N
P 2 1 1 6 50 0 34 0 N
X Pin_1 1 200 0 150 L 50 50 1 1 P
X Pin_2 2 200 -100 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_Conn_01x04_Female
#
DEF Connector_Conn_01x04_Female J 0 40 Y N 1 F N
F0 "J" 0 200 50 H V C CNN
F1 "Connector_Conn_01x04_Female" 0 -300 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_1x??_*
$ENDFPLIST
DRAW
A 0 -200 20 901 -901 1 1 6 N 0 -180 0 -220
A 0 -100 20 901 -901 1 1 6 N 0 -80 0 -120
A 0 0 20 901 -901 1 1 6 N 0 20 0 -20
A 0 100 20 901 -901 1 1 6 N 0 120 0 80
P 2 1 1 6 -50 -200 -20 -200 N
P 2 1 1 6 -50 -100 -20 -100 N
P 2 1 1 6 -50 0 -20 0 N
P 2 1 1 6 -50 100 -20 100 N
X Pin_1 1 -200 100 150 R 50 50 1 1 P
X Pin_2 2 -200 0 150 R 50 50 1 1 P
X Pin_3 3 -200 -100 150 R 50 50 1 1 P
X Pin_4 4 -200 -200 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_Screw_Terminal_01x02
#
DEF Connector_Screw_Terminal_01x02 J 0 40 Y N 1 F N
F0 "J" 0 100 50 H V C CNN
F1 "Connector_Screw_Terminal_01x02" 0 -200 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
TerminalBlock*:*
$ENDFPLIST
DRAW
C 0 -100 25 1 1 6 N
C 0 0 25 1 1 6 N
S -50 50 50 -150 1 1 10 f
P 2 1 1 6 -21 -87 13 -120 N
P 2 1 1 6 -21 13 13 -20 N
P 2 1 1 6 -14 -80 20 -113 N
P 2 1 1 6 -14 20 20 -13 N
X Pin_1 1 -200 0 150 R 50 50 1 1 P
X Pin_2 2 -200 -100 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_Buzzer
#
DEF Device_Buzzer BZ 0 1 Y N 1 F N
F0 "BZ" 150 50 50 H V L CNN
F1 "Device_Buzzer" 150 -50 50 H V L CNN
F2 "" -25 100 50 V I C CNN
F3 "" -25 100 50 V I C CNN
$FPLIST
*Buzzer*
$ENDFPLIST
DRAW
A 0 0 125 -899 899 0 1 0 N 0 -125 0 125
P 2 0 1 0 -65 75 -45 75 N
P 2 0 1 0 -55 85 -55 65 N
P 2 0 1 0 0 125 0 -125 N
X - 1 -100 100 100 R 50 50 1 1 P
X + 2 -100 -100 100 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_C
#
DEF Device_C C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "Device_C" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
C_*
$ENDFPLIST
DRAW
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_CP
#
DEF Device_CP C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "Device_CP" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
CP_*
$ENDFPLIST
DRAW
S -90 20 90 40 0 1 0 N
S 90 -20 -90 -40 0 1 0 F
P 2 0 1 0 -70 90 -30 90 N
P 2 0 1 0 -50 110 -50 70 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_D
#
DEF Device_D D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "Device_D" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
TO-???*
*_Diode_*
*SingleDiode*
D_*
$ENDFPLIST
DRAW
P 2 0 1 10 -50 50 -50 -50 N
P 2 0 1 0 50 0 -50 0 N
P 4 0 1 10 50 50 50 -50 -50 0 50 50 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_D_Zener
#
DEF Device_D_Zener D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "Device_D_Zener" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
TO-???*
*_Diode_*
*SingleDiode*
D_*
$ENDFPLIST
DRAW
P 2 0 1 0 50 0 -50 0 N
P 3 0 1 10 -50 -50 -50 50 -30 50 N
P 4 0 1 10 50 -50 50 50 -50 0 50 -50 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_L
#
DEF Device_L L 0 40 N N 1 F N
F0 "L" -50 0 50 V V C CNN
F1 "Device_L" 75 0 50 V V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Choke_*
*Coil*
Inductor_*
L_*
$ENDFPLIST
DRAW
A 0 -75 25 -899 899 0 1 0 N 0 -100 0 -50
A 0 -25 25 -899 899 0 1 0 N 0 -50 0 0
A 0 25 25 -899 899 0 1 0 N 0 0 0 50
A 0 75 25 -899 899 0 1 0 N 0 50 0 100
X 1 1 0 150 50 D 50 50 1 1 P
X 2 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "Device_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Jumper_Jumper_2_Bridged
#
DEF Jumper_Jumper_2_Bridged JP 0 0 Y N 1 F N
F0 "JP" 0 75 50 H V C CNN
F1 "Jumper_Jumper_2_Bridged" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Jumper*
TestPoint*2Pads*
TestPoint*Bridge*
$ENDFPLIST
DRAW
A 0 -70 100 1269 531 0 1 0 N -60 10 60 10
C -80 0 20 0 0 0 N
C 80 0 20 0 0 0 N
X A 1 -200 0 100 R 50 50 1 1 P
X B 2 200 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Jumper_Jumper_2_Open
#
DEF Jumper_Jumper_2_Open JP 0 0 Y N 1 F N
F0 "JP" 0 110 50 H V C CNN
F1 "Jumper_Jumper_2_Open" 0 -90 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Jumper*
TestPoint*2Pads*
TestPoint*Bridge*
$ENDFPLIST
DRAW
A 0 -30 100 1269 531 0 1 0 N -60 50 60 50
C -80 0 20 0 0 0 N
C 80 0 20 0 0 0 N
X A 1 -200 0 100 R 50 50 1 1 P
X B 2 200 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Sensor_Nuclear-Radiation_Detector
#
DEF Sensor_Nuclear-Radiation_Detector V 0 0 Y N 1 F N
F0 "V" 200 50 50 H V L CNN
F1 "Sensor_Nuclear-Radiation_Detector" 200 -50 50 H V L CNN
F2 "" 200 100 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
A -125 135 16 -184 1084 0 1 0 N -110 130 -130 150
A -205 135 16 -184 1084 1 1 0 N -190 130 -210 150
A -175 125 16 1616 -716 1 1 0 N -190 130 -170 110
A -165 95 16 -184 1084 1 1 0 N -150 90 -170 110
A -165 175 16 -184 1084 1 1 0 N -150 170 -170 190
A -135 165 16 1616 -716 1 1 0 N -150 170 -130 150
C 0 0 111 0 1 0 N
C 55 -35 10 0 1 0 F
T 0 80 125 50 0 0 0 + Normal 0 C C
P 2 0 1 0 -45 -60 45 -60 N
P 2 0 1 0 -45 60 45 60 N
P 2 0 1 0 0 -60 0 -100 N
P 2 0 1 0 0 100 0 60 N
P 4 0 1 0 -100 140 -120 120 -80 100 -100 140 F
P 4 1 1 0 -140 100 -160 80 -120 60 -140 100 F
X 1 1 0 200 100 D 50 50 1 1 P
X 2 2 0 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Timer_TLC555xP
#
DEF Timer_TLC555xP U 0 20 Y Y 1 F N
F0 "U" -400 350 50 H V L CNN
F1 "Timer_TLC555xP" 100 350 50 H V L CNN
F2 "Package_DIP:DIP-8_W7.62mm" 650 -400 50 H I C CNN
F3 "" 850 -400 50 H I C CNN
ALIAS LM555xN ICM7555xP LMC555xN MC1455P TLC555xP NA555P SE555P SA555P
$FPLIST
DIP*W7.62mm*
$ENDFPLIST
DRAW
S -350 -300 350 300 0 1 10 f
S -350 -300 350 300 0 1 10 f
X GND 1 0 -400 100 U 50 50 0 0 W
X VCC 8 0 400 100 D 50 50 0 0 W
X TR 2 -500 200 150 R 50 50 1 1 I
X Q 3 500 200 150 L 50 50 1 1 O
X R 4 -500 -200 150 R 50 50 1 1 I I
X CV 5 -500 0 150 R 50 50 1 1 I
X THR 6 500 -200 150 L 50 50 1 1 I
X DIS 7 500 0 150 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
# Transistor_BJT_BC328
#
DEF Transistor_BJT_BC328 Q 0 0 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "Transistor_BJT_BC328" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
ALIAS BC556 BC558 BC559 BC560 BC327 BC328
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 90 -70 70 -90 50 -50 90 -70 90 -70 F
X C 1 100 200 100 D 50 50 1 1 P
X B 2 -200 0 225 R 50 50 1 1 I
X E 3 100 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Transistor_BJT_BC517
#
DEF Transistor_BJT_BC517 Q 0 0 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "Transistor_BJT_BC517" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 0 25 0 100 75 100 100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F
X C 1 100 200 100 D 50 50 1 1 P
X B 2 -200 0 225 R 50 50 1 1 I
X E 3 100 -200 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_GNDPWR
#
DEF power_GNDPWR #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -200 50 H I C CNN
F1 "power_GNDPWR" 0 -130 50 H V C CNN
F2 "" 0 -50 50 H I C CNN
F3 "" 0 -50 50 H I C CNN
DRAW
P 2 0 1 0 0 -50 0 0 N
P 3 0 1 8 -40 -50 -50 -80 -50 -80 N
P 3 0 1 8 -20 -50 -30 -80 -30 -80 N
P 3 0 1 8 0 -50 -10 -80 -10 -80 N
P 3 0 1 8 20 -50 10 -80 10 -80 N
P 3 0 1 8 40 -50 -40 -50 -40 -50 N
P 4 0 1 8 40 -50 30 -80 30 -80 30 -80 N
X GNDPWR 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_PWR_FLAG
#
DEF power_PWR_FLAG #FLG 0 0 N N 1 F P
F0 "#FLG" 0 75 50 H I C CNN
F1 "power_PWR_FLAG" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
X pwr 1 0 0 0 U 50 50 0 0 w
ENDDRAW
ENDDEF
#
# power_VCC
#
DEF power_VCC #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_VCC" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X VCC 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# project_EzSBC_ESP32-01
#
DEF project_EzSBC_ESP32-01 U 0 40 Y Y 1 F N
F0 "U" 0 900 50 H V C CNN
F1 "project_EzSBC_ESP32-01" 0 750 50 H V C CNN
F2 "" 0 900 50 H I C CNN
F3 "" 0 900 50 H I C CNN
DRAW
S -850 1050 850 -1050 0 1 0 f
X GND 20 -950 -950 100 R 50 50 0 0 W
X GND 21 950 -950 100 L 50 50 0 0 W
X Vin 22 950 -850 100 L 50 50 0 0 W
X 3.3V 23 950 -750 100 L 50 50 0 0 w
X GND 3 -950 750 100 R 50 50 0 0 W
X 3.3V 32 950 150 100 L 50 50 0 0 w
X Vin 37 950 650 100 L 50 50 0 0 W
X GND 38 950 750 100 L 50 50 0 0 W
X IO36 1 -950 950 100 R 50 50 1 1 I
X IO25/RTC6 10 -950 50 100 R 50 50 1 1 B
X IO26/RTC7 11 -950 -50 100 R 50 50 1 1 B
X IO27/RTC17 12 -950 -150 100 R 50 50 1 1 B
X n.c. 13 -950 -250 100 R 50 50 1 1 N
X IO23/VSPI_MOSI 14 -950 -350 100 R 50 50 1 1 B
X IO22/I2C_SCL 15 -950 -450 100 R 50 50 1 1 B
X IO21/I2C_SDA 16 -950 -550 100 R 50 50 1 1 B
X EN/Reset 17 -950 -650 100 R 50 50 1 1 I
X 3.3V 18 -950 -750 100 R 50 50 1 1 w
X Vin 19 -950 -850 100 R 50 50 1 1 W
X IO39 2 -950 850 100 R 50 50 1 1 I
X IO0/RTC11/Boot 24 950 -650 100 L 50 50 1 1 B
X IO2/RTC12 25 950 -550 100 L 50 50 1 1 B
X IO4/RTC10 26 950 -450 100 L 50 50 1 1 B
X IO5/VSPI_SS 27 950 -350 100 L 50 50 1 1 B
X IO12/RTC15/HSPI_MISO 28 950 -250 100 L 50 50 1 1 B
X IO13/RTC14/HSPI_MOSI 29 950 -150 100 L 50 50 1 1 B
X IO14/RTC16/HSPI_SCK 30 950 -50 100 L 50 50 1 1 B
X IO15/RTC13/HSPI_SS 31 950 50 100 L 50 50 1 1 B
X IO16/L1_RED 33 950 250 100 L 50 50 1 1 B
X IO17/L1_GREEN 34 950 350 100 L 50 50 1 1 B
X IO18/VSPI_SCK/L1_BLUE 35 950 450 100 L 50 50 1 1 B
X IO19/VSPI_MISO/L2_BLUE 36 950 550 100 L 50 50 1 1 B
X IO3/RX0 39 950 850 100 L 50 50 1 1 I
X Vin 4 -950 650 100 R 50 50 1 1 W
X IO1/TX0 40 950 950 100 L 50 50 1 1 O
X IO35 5 -950 550 100 R 50 50 1 1 I
X IO34 6 -950 450 100 R 50 50 1 1 I
X IO33/RTC8 7 -950 350 100 R 50 50 1 1 B
X IO32/RTC9 8 -950 250 100 R 50 50 1 1 B
X 3.3V 9 -950 150 100 R 50 50 1 1 w
ENDDRAW
ENDDEF
#
# project_MPSA44
#
DEF project_MPSA44 Q 0 40 Y N 1 F N
F0 "Q" 200 75 50 H V L CNN
F1 "project_MPSA44" 200 0 50 H V L CNN
F2 "Package_TO_SOT_THT:TO-92_Inline" 200 -75 50 H I L CIN
F3 "" 0 0 50 H I L CNN
$FPLIST
TO?92*
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 0 0 25 0 N
P 2 0 1 0 25 25 100 100 N
P 3 0 1 0 25 -25 100 -100 100 -100 N
P 3 0 1 20 25 75 25 -75 25 -75 N
P 5 0 1 0 50 -70 70 -50 90 -90 50 -70 50 -70 F
X E 1 100 -200 100 U 50 50 1 1 P
X B 2 -200 0 200 R 50 50 1 1 I
X C 3 100 200 100 D 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

View File

@@ -0,0 +1 @@
(kicad_pcb (version 4) (host kicad "dummy file") )

View File

@@ -0,0 +1,33 @@
update=22/05/2015 07:44:53
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
(sym_lib_table
(lib (name project)(type Legacy)(uri C:/dev/git/esp32-geiger-counter/hardware/kicad/lib/geiger.lib)(options "")(descr ""))
)

View File

@@ -5,4 +5,11 @@ extern const char *wifiSsid;
extern const char *wifiPassword;
extern const char *thingspeakApiKey;
extern const char *mqttHost;
extern int mqttPort;
extern const char *mqttTlsServerRootCert;
extern const char *mqttUser;
extern const char *mqttPassword;
extern const char *mqttTopic;
#endif /* CREDENTIALS_H_ */

View File

@@ -4,7 +4,9 @@
#include "GeigerData.h"
void initIngest();
void loopIngest();
void deinitIngest();
void ingest(GeigerData &geigerData, uint16_t intervalSamples);
void ingestToThingspeak(GeigerData &geigerData, uint16_t intervalSamples);
void ingestToMqtt(GeigerData &geigerData, uint16_t intervalSamples);
#endif /* INGEST_H_ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@@ -12,7 +12,7 @@
platform = espressif32
board = lolin32
framework = arduino
monitor_speed = 115200
lib_deps = U8g2@2.26.1
lib_deps =
U8g2@^2.27.6
256dpi/MQTT@^2.4.7

View File

@@ -0,0 +1,50 @@
#define _SECRET_CREDENTIALS
// Copy this file to secret_credentials.h and adjust for
// your needs and environment.
// !!! NEVER COMMIT YOUR SECRETS !!!
const char *wifiSsid = "MyWiFi";
const char *wifiPassword = "mypassword";
// ThingsPeak Channel
// set key to NULL or empty string to disable ThingsPeak ingest:
const char *thingspeakApiKey = "MYAPIKEY";
// MQTT Broker
// set host to NULL or empty string to disable MQTT publishing:
const char *mqttHost = "my.mqtt.server";
int mqttPort = 1833;
// set MQTT server's root CA cert to NULL or empty string to disable MQTT TLS/SSL:
const char *mqttTlsServerRootCert = R""""(
-----BEGIN CERTIFICATE-----
MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G
A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp
Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1
MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG
A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL
v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8
eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq
tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd
C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa
zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB
mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH
V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n
bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG
3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs
J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO
291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS
ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd
AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
-----END CERTIFICATE-----
)"""";
const char *mqttUser = "user";
const char *mqttPassword = "mypassword";
const char *mqttTopic = "home/radioactivity";

View File

@@ -10,6 +10,13 @@
// use dummy credentials to make it compilable without secrets
const char *wifiSsid = "unset-wifi-ssid";
const char *wifiPassword = "unset-password";
const char *thingspeakApiKey = "unset-thinkspeak-api-key";
const char *thingspeakApiKey = ""; // empty to disable thinkspeak
const char *mqttHost = ""; // empty to disable MQTT
int mqttPort = 1833;
extern const char *mqttTlsServerRootCert = ""; // empty to disable TLS
const char *mqttUser = "user";
const char *mqttPassword = "unset-password";
const char *mqttTopic = "home/geiger/radioactivity";
#endif

View File

@@ -1,4 +1,6 @@
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <MQTT.h>
#include "GeigerData.h"
@@ -6,10 +8,16 @@
const char *thingsPeakUrl = "api.thingspeak.com";
bool connect()
WiFiClient mqttWifiClient;
WiFiClientSecure mqttWifiClientSecure;
MQTTClient mqttClient;
bool connectWiFi()
{
uint16_t retries = 3;
while (WiFi.status() != WL_CONNECTED && (--retries) > 0)
WiFi.persistent(false);
uint16_t retries = 10;
while (WiFi.status() != WL_CONNECTED && (retries--) > 0)
{
Serial.print("Trying to connect to ");
Serial.print(wifiSsid);
@@ -35,7 +43,7 @@ bool connect()
return WiFi.status() == WL_CONNECTED;
}
void disconnect()
void disconnectWiFi()
{
Serial.println("Disconnecting WiFi");
WiFi.disconnect(true, true);
@@ -43,20 +51,31 @@ void disconnect()
void initIngest()
{
connect();
connectWiFi();
}
void loopIngest()
{
if (mqttClient.connected())
{
mqttClient.loop();
}
}
void deinitIngest()
{
if (WiFi.status() == WL_CONNECTED)
{
disconnect();
disconnectWiFi();
}
}
void ingest(GeigerData &geigerData, uint16_t intervalSamples)
void ingestToThingspeak(GeigerData &geigerData, uint16_t intervalSamples)
{
if (!connect())
if (!connectWiFi())
return;
if (thingsPeakUrl == NULL || thingsPeakUrl[0] == 0)
return;
WiFiClient client;
@@ -66,7 +85,7 @@ void ingest(GeigerData &geigerData, uint16_t intervalSamples)
Serial.print(thingsPeakUrl);
Serial.println(" failed");
// disconnect from WiFi to trigger fresh connect on next ingest
disconnect();
disconnectWiFi();
}
else
{
@@ -123,3 +142,70 @@ void ingest(GeigerData &geigerData, uint16_t intervalSamples)
client.stop();
}
}
bool connectMqtt()
{
if (!connectWiFi())
return false;
if (mqttHost == NULL || mqttHost[0] == 0)
return false;
if (!mqttClient.connected())
{
const bool tls = mqttTlsServerRootCert != NULL && mqttTlsServerRootCert[0] != 0;
Serial.print("Connecting to MQTT host ");
Serial.print(mqttHost);
Serial.print(":");
Serial.print(mqttPort);
Serial.print(" user ");
Serial.print(mqttUser);
if (tls) {
Serial.print(" with TLS ");
mqttWifiClientSecure.setCACert(mqttTlsServerRootCert);
mqttClient.begin(mqttHost, mqttPort, mqttWifiClientSecure);
} else {
Serial.print(" without TLS ");
mqttClient.begin(mqttHost, mqttPort, mqttWifiClient);
}
if (mqttClient.connect("esp32-geiger-counter", mqttUser, mqttPassword))
{
Serial.println(" successful");
}
else
{
Serial.println(" failed");
// disconnect from WiFi to trigger fresh connect on next ingest
disconnectWiFi();
return false;
}
}
return true;
}
void disconnectMqtt()
{
mqttClient.disconnect();
}
void ingestToMqtt(GeigerData &geigerData, uint16_t intervalSamples)
{
if (connectMqtt())
{
const unsigned long pulses = geigerData.getPreviousPulses(1,
intervalSamples);
const unsigned long cpm = (unsigned long)(pulses / ((float)intervalSamples * geigerData.sampleSeconds / 60.) + 0.5);
const float uSph = geigerData.toMicroSievertPerHour(pulses,
intervalSamples);
char payload[129];
sprintf(payload, "{\"pulses\":%lu, \"cpm\":%lu,\"uSph\":%.3f,\"secs\":%d}",
pulses, cpm, uSph, (int)intervalSamples);
if (!mqttClient.publish(mqttTopic, payload))
{
mqttClient.disconnect();
}
}
}

View File

@@ -7,12 +7,15 @@
#include "GeigerData.h"
// ~400µs high pulses from Geiger tube on GPIO 18
#define PULSE_PIN 18
#define PULSE_GPIO GPIO_NUM_18
#define PULSE_PIN 15
#define PULSE_GPIO GPIO_NUM_15
// switch input for WiFi on (low) and off (high)
#define WIFI_SWITCH_PIN 4
// blinky LED
#define BLINKY_LED_PIN 18
// Keep 600 samples of 1s in history (10 minutes),
// calculate radiation for russian STS-6 ("CTC-6") Geiger tube
GeigerData geigerData(600, 1, STS6_CPM_PER_USPH);
@@ -58,7 +61,7 @@ void setup()
initDisplay();
// blinky
pinMode(LED_BUILTIN, OUTPUT);
pinMode(BLINKY_LED_PIN, OUTPUT);
// Geiger pulse input
pinMode(PULSE_PIN, INPUT);
@@ -79,7 +82,7 @@ void loop()
{
// blinky
digitalWrite(LED_BUILTIN, blinky);
digitalWrite(BLINKY_LED_PIN, blinky);
blinky = !blinky;
// reset watchdog
@@ -93,11 +96,13 @@ void loop()
if (wifiSwitchOn())
{
loopIngest();
ingestCountdown--;
if (ingestCountdown <= 0)
{
ingestCountdown = ingestInterval;
ingest(geigerData, ingestInterval);
ingestToThingspeak(geigerData, ingestInterval);
ingestToMqtt(geigerData, ingestInterval);
}
}
else