Platformio Custom Build
- Platform.io is the development and build SDK for ESPGeiger.
- Platform.io is configured to install any requirements and build firmware for each of the build targets.
- Builds of configured releases are done automatically by GitHub Actions.
Build Options
The following build flags can be added to your environment’s build_flags to customise behaviour.
Output Modules
| Flag | Description |
|---|---|
-D MQTTOUT | Enable MQTT output. |
-D MQTTAUTODISCOVER | Enable Home Assistant MQTT auto-discovery. Requires MQTTOUT. |
-D RADMONOUT | Enable Radmon.org submission. |
-D GMCOUT | Enable GMC World Map submission. |
-D THINGSPEAKOUT | Enable ThingSpeak submission. |
-D WEBHOOKOUT | Enable custom Webhook output. |
-D SERIALOUT | Enable serial CPM/uSv output. |
-D WEBAPIOUT | Enable ESPGeiger Stations (WebAPI) sharing. |
-D GEIGER_SDCARD | Enable SD card data logging. |
-D SDCARD_EXTENDEDLOG | Add extra columns (free memory) to the SD card CSV output. Requires GEIGER_SDCARD. |
-D PULSE_OUT | Enable Pulse Out (per-pulse GPIO for piezo, speaker, LED). Ships in every stock ESP build except espgeigerhw, espgeigerlog, espgeigerlog_serial, espgeigerlog_test, espgeigerlog_udp and esp8266_pulsemin. |
-D ALERT_OUT | Enable Alert Out (rising-edge alert GPIO). Ships in every stock ESP build except espgeigerhw, espgeigerlog, espgeigerlog_serial, espgeigerlog_test, espgeigerlog_udp and esp8266_pulsemin. |
-D AUDIO_TICK | Enable Audio Tick (synthesised click via I2S amplifier, ESP32 only). |
-D AUDIO_TICK_BCLK=N, AUDIO_TICK_WS=N, AUDIO_TICK_DOUT=N | Default I2S pins (41, 42, 40). |
-D AUDIO_TICK_PINS_BLOCKED | Fix the I2S pins: no pin settings on the Config page. |
-D AUDIO_MUTE_PIN=N | A button to GND that mutes and unmutes all audio (0 on the XH-S3E). Default -1, none. |
Display & LEDs
| Flag | Description |
|---|---|
-D SSD1306_DISPLAY | Enable SSD1306 OLED display. |
-D MAX7219_DISPLAY | Add the LED displays (MAX7219 7-seg, Round and Matrix, TM1637) as Display type choices. |
-D OLED_SDA=N | Set the default OLED I2C SDA pin (default 4). Also exposed as a runtime pref unless OLED_PINS_BLOCKED is set. |
-D OLED_SCL=N | Set the default OLED I2C SCL pin (default 5). Also exposed as a runtime pref unless OLED_PINS_BLOCKED is set. |
-D OLED_PINS_BLOCKED=true | Hide the OLED SDA/SCL pins from the runtime prefs UI. Use on builds with fixed hardware where the pins must not be reconfigured. |
-D DISPLAY_TYPES=0xNNN | The Display types built, bit n = type n (0x201 = SSD1306 + 128x32). Default: every type the build supports, or only OLED_TYPE with OLED_PINS_BLOCKED. One type hides the Display type setting. The LED types (5-8) need MAX7219_DISPLAY. |
-D OLED_FLIP=true | Default for the display flip setting (display.flip, turns it 180 degrees). |
-D GEIGER_BLIPLED=N | A dedicated count LED on this pin, flashed on each count (15 on ESPGeiger-HW). Without it counts flash the status LED, unless DISABLE_INTERNAL_BLIP. |
-D GEIGER_NEOPIXEL | Enable WS2812X NeoPixel status LED. |
-D NEOPIXEL_PIN=N | Set the NeoPixel data pin (default 15). |
-D GEIGER_PUSHBUTTON | Enable push button for OLED page switching and display wake. |
-D PUSHBUTTON_PIN=N | Set the push button pin. Default 0 (BOOT) on ESP32, -1 (off) on ESP8266; base:esp32c3_main sets 9. |
-D PUSHBUTTON_PIN2=N | A second button that does the same as the first (39 on the XH-S3E). Default -1, none. |
-D BTN_PIN_BLOCKED | Fix the button pin: no Button pin (btn.pin) setting. |
-D LED_SEND_RECEIVE=N | Set the status LED pin (default 2 on ESP8266 and ESP32, -1 on C3, S2 and S3). |
-D LED_PIN_BLOCKED | Fix the status LED pin: no pin or polarity setting. Always on ESP8266. |
-D NEOPIXEL_PIN_BLOCKED | Fix the NeoPixel pin: no Pin setting. |
Geiger Counter Type
The geiger counter type and serial type are defined in platformio.ini for use in environment configurations:
[geiger_type]
pulse = 1
serial = 2
udprx = 8
test = 128
testpulse = 129
testserial = 130
testpulseint = 133
[serial_type]
gc10 = 1
gc10nx = 2
mightyohm = 3
espgeiger = 4
template = 5
These can be referenced in your environment’s build_flags as:
build_flags =
-DGEIGER_TYPE=${geiger_type.pulse}
-DGEIGER_SERIALTYPE=${serial_type.gc10}
| Flag | Description |
|---|---|
-D GEIGER_TYPE=N | Set the geiger counter type (bitfield - bit 0 = pulse, bit 1 = serial, bit 2 = internal PWM, bit 3 = UDP receiver, bit 7 = test). 1 Pulse, 2 Serial, 8 UDP receiver (the _udp envs), 128 Test, 129 Test Pulse, 130 Test Serial, 133 Test Pulse PWM. Values ≥ 128 are test builds. Required: the build stops without it. |
-D GEIGER_SERIALTYPE=N | Set the default serial counter type for serial builds. The serial type can be changed at runtime from the Config page. 1 GC10 (9600 baud), 2 GC10-Next (115200 baud), 3 MightyOhm (9600 baud), 4 ESPGeiger (115200 baud), 5 Template (115200 baud, the number after CPM, else the first number). |
Geiger Counter Input
| Flag | Description |
|---|---|
-D GEIGER_RXPIN=N | Set the geiger counter input pin (default 13 on ESP8266 / ESP32, 4 on ESP32-C3). GPIO 11-17 are reserved for internal flash on C3-MINI-1 modules. |
-D GEIGER_TXPIN=N | Set the transmit pin for test builds (default -1). |
-D GEIGER_DEBOUNCE=N | Set the default pulse debounce time in microseconds (default 200). This can also be configured at runtime from the web interface on builds that use software interrupt counting. |
-D GEIGER_RATIO=N | Set the default CPM to µSv/h conversion ratio (default 151.0). |
-D GEIGER_MODEL="name" | Set the geiger counter model name. |
-D GEIGER_MODEL_FIXED | Hide the user-editable geiger_model pref from the Config page. Use on purpose-built kits where the tube is fixed in firmware via GEIGER_MODEL. |
-D RXPIN_BLOCKED | Prevent the RX pin from being changed via the web interface. |
-D TXPIN_BLOCKED | Prevent the TX pin from being changed via the web interface. |
-D DISABLE_SERIALRX | Disable the serial command interface on the hardware UART. |
-D COUNT_SELFTEST | At boot, pull the input low once as the detector would and check the count interrupt fires; the log says GeigerPulse: Self test OK or FAILED. For boards with an open-collector input stage. |
Data Smoothing
By default, the 5-minute and 15-minute CPM values use exponential moving average (EMA) smoothing. This provides smooth, responsive readings with minimal memory usage.
| Flag | Description |
|---|---|
-D GEIGER_SMOOTH_AVG | Use rolling average buckets instead of EMA for the 5 and 15-minute CPM values. Uses more memory but gives equal weighting to all readings in the window. |
-D GEIGER_EMA_FACTOR=N | Set the EMA smoothing factor (default 30, matching a 5 and 15 minute average). Lower values respond faster, higher values are smoother. |
The 1-minute CPM follows the CPM Mode setting.
ESP32 Hardware Counter (PCNT)
On ESP32, ESP32-S2 and ESP32-S3 (the C3 has none), the hardware pulse counter (PCNT) is used by default for pulse-type geiger counters: it counts in hardware, without an interrupt per pulse. Pulse builds also carry the interrupt counter; the Count with setting picks one at boot.
| Flag | Description |
|---|---|
-D IGNORE_PCNT | Leave PCNT out and always use software interrupt counting. |
-D NO_PCNT_ENV | Default Count with to Interrupt and keep that in the saved settings (the _no_pcnt envs, retired in 0.15). |
-D PCNT_FILTER=N | Set the initial PCNT glitch filter value at compile time. Filters pulses shorter than N APB clock cycles. This can also be configured at runtime from the web interface. |
-D PCNT_PULLUP_PIN | Default the PCNT input to the internal pull-up instead of floating. For open-drain outputs. |
-D PCNT_PULLDOWN_PIN | Default the PCNT input to the internal pull-down instead of floating. For active-high modules without their own idle pull. |
-D NO_PCNT_ALIAS | The image also carries the matching _no_pcnt env’s name, so a device running that env takes this one on its Update page (esp32_pulse, esp32s3_pulse, esp32_cajoe_iotgm). |
MQTT Options
| Flag | Description |
|---|---|
-D MQTT_MEM_DEBUG | Include additional memory statistics in the MQTT status JSON: largest free block, and fragmentation on ESP8266 or lowest free heap on ESP32. |
-D DISABLE_MQTT_CPS | Leave out the legacy stat/CPS topic. cps stays in tele/sensor. |
-D MQTT_HASS_REFRESH_S=N | Seconds between Home Assistant discovery publishes while connected (default 3600). A reconnect publishes them again only once this is due. |
UDP / OSC Output
See UDP / OSC Output for the full protocol. Tunables for the producer (UdpBlip) and receiver (UdpRx):
| Flag | Default | Description |
|---|---|---|
-D UDPBLIP_DEFAULT_GROUP="239.x.x.x" | "239.255.86.86" | Default multicast group. Used by producers and by receivers unless UDPRX_DEFAULT_GROUP overrides. |
-D UDPBLIP_DEFAULT_PORT=N | 57340 | Producer’s default UDP port and the fallback for a bad port setting. |
-D UDPBLIP_STATS_INTERVAL_MS=N | 30000 | Interval between telemetry bursts (/rad cadence; /hv rides alongside, /sys fires every other cycle). |
-D UDPBLIP_STATS_JITTER_MS=N | 7500 | First-emission GRNG offset range so fleet boots don’t synchronize. |
-D UDPBLIP_FAIL_BACKOFF=N | 8 | Consecutive send failures before entering the cool-off state. |
-D UDPBLIP_FAIL_COOLDOWN_MS=N | 10000 | How long to sit in cool-off before resetting _fail_count and re-trying sends. Independent of telemetry cadence. |
-D UDPBLIP_CLICK_MIN_INTERVAL_MS=N | 50 | Minimum ms between /click packets. Deferred clicks accumulate in the cumulative counter so the receiver gap-fills via delta. 0 disables the cap (push-per-pulse). Default 50 ms = 20 pps cap (~1200 CPM before coalescing), ~0.6 % CPU at saturation. |
-D UDPBLIP_CLICK_BURST_TOKENS=N | 5 | Token-bucket depth. Idle time earns one token per CLICK_MIN_INTERVAL_MS, capped here. Lets a sudden cluster of clicks after a quiet period fire as separate packets (visible blips on the receiver) before the steady-state throttle kicks in. 1 disables bursts. |
-D UDPRX_DEFAULT_GROUP="239.x.x.x" | (inherits UDPBLIP_DEFAULT_GROUP) | Override receiver’s multicast group only if it should listen on a different group than local producers send to. |
-D UDPRX_DEFAULT_PORT=N | (inherits UDPBLIP_DEFAULT_PORT) | Receiver’s default UDP port. |
-D UDPRX_PRODUCER_SLOTS=N | 8 | Producer tracking table size (sum mode). |
Test Build Options
| Flag | Description |
|---|---|
-D GEIGER_TEST_FIXEDCPM | Lock the test output to a single CPM value instead of cycling through 30/60/100/120. |
-D GEIGER_COUNT_TXPULSE | Count the pulses generated on the TX pin locally. Note: if RX and TX pins are connected together, counts will be doubled. |
-D DISABLE_GEIGER_POISSON | Evenly spaced test pulses instead of random (Poisson) ones. Also leaves out the maths library, about 1.5 KB. |
-D GEIGER_TEST_FAST | Run the test output at 100 times its CPM. |
High-Voltage Generator (HV)
The HV codepath splits into two independent capabilities, gated separately so that boards with PWM-only or with full ADC feedback both compile cleanly.
| Flag | Description |
|---|---|
-D ESPG_HV | Enable PWM HV generator (module hv), espghw.freq / espghw.duty prefs, the /hv page. Set them from the console with set espghw.freq 6000. With ESPG_HV_ADC the hv console command prints the live reading. |
-D EG_TIMER1_PWM | EGTimer1 PWM output. ESP8266 ESPG_HV builds need it. |
-D ESPG_HV_ADC | Enable ADC HV feedback divider: ratio/offset calibration prefs, live HV readout on /hv, /info, /status, OLED and as the hv field on every output module (WebAPI, MQTT, Webhook, SerialOut). Requires ESPG_HV. |
-D GEIGER_PWMPIN=N | Set the HV PWM output pin. Default 12 on ESPGeiger-HW, otherwise -1 (HV off until the pin is set). Requires ESPG_HV. |
-D GEIGER_VFEEDBACKPIN=N | Set the HV voltage feedback ADC pin (default A0 on ESP8266, 36 on ESP32). Requires ESPG_HV_ADC. |
-D GEIGERHW_FREQ=N | Set the default HV PWM frequency in Hz (default 6000). Requires ESPG_HV. |
-D GEIGERHW_DUTY=N | Set the default HV PWM duty, out of 1023 (10-bit). Default 280. Capped by GEIGERHW_MAX_DUTY (600 on ESPGeiger-HW). Requires ESPG_HV. |
-D GEIGERHW_ADC_RATIO=N | Set the ADC voltage divider ratio for HV reading (default 1035). Requires ESPG_HV_ADC. |
-D GEIGERHW_ADC_OFFSET=N | Set the ADC offset for HV reading calibration (default 0). Requires ESPG_HV_ADC. |
-D GEIGERHW_MAX_V=N | Top of the HV target setting, in volts (default 700; 500 on ESPGeiger-HW). |
-D GEIGERHW_OV_V=N | Over-voltage cut-off in volts: HV is held off above it (default 0, off; 530 on ESPGeiger-HW). The hidden espghw.ov_v pref can lower a build’s cut-off, and sets one where the build has none. Requires ESPG_HV_ADC. |
When ESPG_HV is defined without ESPG_HV_ADC (a board that drives HV via PWM but has no real feedback divider), the espghw prefs also show in the regular /param UI, the /hv page still exists but has no readout, and no hv field is emitted on any output.
Product Identity
Identifies a specific product family. Implies a known set of capability flags as defensive defaults (see ESPGeiger/src/App/AppConfig.h) so a custom build that defines only the product flag still gets the right behaviour.
| Flag | Implies | Description |
|---|---|---|
-D ESPGEIGER_HW | ESPG_HV, ESPG_HV_ADC, GEIGER_BLIPLED=15 (unless LED_SEND_RECEIVE is set: counts then flash that LED), board name ESPG-HW; ESP8266 only, an ESP32 build stops with an error | ESPGeiger-HW kit (HV generator with real ADC feedback divider, count LED on GPIO15). Add GEIGER_MODEL_FIXED yourself if the tube is fixed. |
-D ESPGEIGER_LT | board name ESPG-LT (ESPG-LOG with GEIGER_SDCARD) | Identify the build as an ESPGeiger Lite/Log device. |
SD Card
| Flag | Description |
|---|---|
-D GEIGER_SDCARD_CS=N | Set the SD card SPI chip select pin (default 16). Requires GEIGER_SDCARD. |
-D GEIGER_SDCARD_SCK=N | SD card on its own SPI pins, with GEIGER_SDCARD_MOSI=N and GEIGER_SDCARD_MISO=N (ESP32 family). Without it the chip’s default SPI pins are used. |
-D SDCARD_LOG_UNIXTIME | Write the CSV time column as Unix seconds instead of YYYY-MM-DD hh:mm:ss. |
Miscellaneous
| Flag | Description |
|---|---|
-D DISABLE_BLIP | Disable the LED blip on each detected pulse. |
-D DISABLE_INTERNAL_BLIP | Disable the internal status LED blip on each detected pulse. |
-D NTP_SERVER="server" | Set the default NTP server (default pool.ntp.org). |
-D NTP_TZ="tz" | Default timezone as an Olson name, e.g. Europe/London. Default Etc/UTC; an unknown name runs as UTC. |
-D RTC_CHIP | Look for an RTC chip on the I2C bus on ESP8266 and classic ESP32 builds too (C3, S2 and S3 builds with the bus always do). |
-D DISABLE_ENVSENSOR | Leave out the environment sensor drivers. On builds without an OLED the I2C bus and RTC support go too, about 13 KB on an ESP8266. |
-D DISABLE_LOG_TS | No time stamp at the start of log lines. |
-D CONSOLE_LINE_MAX=N | Longest console command line, in characters (default 255, the most). |
-D OTA_POLL_INTERVAL_MS=N | How often to poll the ArduinoOTA UDP socket, in ms (default 100). Shorter = faster OTA start response, more CPU cost. |
SdFat (SD card builds)
Applied globally in [com-esp] so they affect every SD-enabled build:
| Flag | Description |
|---|---|
-D MAINTAIN_FREE_CLUSTER_COUNT=1 | SdFat keeps its free-cluster count up to date as it writes. ESPGeiger counts the FAT itself, in the background, at mount and when the card looks full. |
-D SDFAT_FILE_TYPE=1 | FAT16/FAT32 only (no exFAT). Saves ~15-20 KB flash; we use FAT32 exclusively. |
-D USE_LONG_FILE_NAMES=0 | Disable LFN support. Saves ~5 KB flash. All our filenames are 8.3-compliant (YYYYMMDD.CSV, YYYYMM/, TEST.TMP). |
Build Environments
Build environments are defined in environments.ini. Each environment extends a base configuration and adds target-specific flags.
Base Configurations
| Base | Platform | Description |
|---|---|---|
base:esp32_main | ESP32 | Base ESP32 build (esp32dev board). Bundles SSD1306 OLED support (auto-detected at boot). |
base:esp32d1_main | ESP32 | ESP32 with RXPIN set to GPIO23 |
base:esp32s2_main | ESP32-S2 | ESP32-S2 build (esp32-s2-saola-1 board, native USB). Bundles SSD1306 OLED support; defaults SDA=8 / SCL=9. |
base:esp32s3_main | ESP32-S3 | Base ESP32-S3 build (esp32-s3-devkitc-1 board). Bundles SSD1306 OLED support. |
base:esp32c3_main | ESP32-C3 | Base ESP32-C3 build (RISC-V, no PCNT). Bundles SSD1306 OLED support; defaults SDA=5 / SCL=6. |
base:esp8266_main | ESP8266 | Base ESP8266 build (NodeMCU v2) |
base:esp8266_oled | ESP8266 | ESP8266 with SSD1306 OLED display |
base:esp8266_neopixel | ESP8266 | ESP8266 with NeoPixel |
base:espgeigerlite | ESP8266 | ESPGeiger Lite/Log base with OLED, NeoPixel, PushButton |
base:espgeigerhw | ESP8266 | ESPGeiger-HW base with OLED, PushButton, HV control |
base:xh_s3e | ESP32-S3 | XH-S3E board: fixed OLED, NeoPixel, buttons and I2S Audio Tick pins |
base:esp32s3_audio | ESP32-S3 | Generic ESP32-S3 with Audio Tick, I2S pins set on the Config page |
These bases handle the platform setup, library dependencies and core feature flags. You mix and match by choosing a base that has the hardware features you need, then adding your counter type and any additional flags.
Production Environments
All ESP32 family envs below bundle SSD1306 OLED support (auto-detected at boot). Only the ESP8266 family keeps separate _oled variants because the slower core wants to skip the OLED render path entirely when no panel is connected.
| Environment | Platform | Counter Type | Features |
|---|---|---|---|
esp32_pulse | ESP32 | Pulse (PCNT) | OLED auto-detected |
esp32_pulse_no_pcnt | ESP32 | Pulse (interrupt) | OLED auto-detected, defaults to interrupt; retired in 0.15 |
esp32_cajoe_iotgm | ESP32 | Pulse (PCNT) | RXPIN 26, for Cajoe IoT GM |
esp32_cajoe_iotgm_no_pcnt | ESP32 | Pulse (interrupt) | RXPIN 26, defaults to interrupt; retired in 0.15 |
esp32_hv | ESP32 | Pulse (PCNT) | HV generator + ADC feedback |
esp32c3_pulse | ESP32-C3 | Pulse (interrupt) | RXPIN 4, NeoPixel pref, OLED auto-detected |
esp32s3_pulse | ESP32-S3 | Pulse (PCNT) | RXPIN 13, OLED auto-detected |
esp32s3_pulse_no_pcnt | ESP32-S3 | Pulse (interrupt) | RXPIN 13, defaults to interrupt; retired in 0.15 |
esp32s2_pulse | ESP32-S2 | Pulse (PCNT) | RXPIN 13, OLED auto-detected |
esp32s3_audio_pulse | ESP32-S3 | Pulse (PCNT) | I2S audio tick |
esp32s3_audio_serial | ESP32-S3 | Serial | I2S audio tick |
xh_s3e_pulse | ESP32-S3 (XH-S3E) | Pulse (PCNT) | RXPIN 13, OLED, NeoPixel, I2S audio tick, board pins fixed, counter pins settable |
xh_s3e_serial | ESP32-S3 (XH-S3E) | Serial | RXPIN 13, TXPIN 14, OLED, NeoPixel, I2S audio tick, board pins fixed, counter pins settable |
esp8266_pulse | ESP8266 | Pulse | |
esp8266_pulsemin | ESP8266 | Pulse | Minimal build, no cloud services |
esp8266oled_pulse | ESP8266 | Pulse | OLED |
esp8266_hv | ESP8266 | Pulse | HV generator + ADC feedback (Timer1 PWM) |
esp8266oled_hv | ESP8266 | Pulse | OLED, HV generator + ADC feedback (Timer1 PWM) |
esp8266_serial | ESP8266 | Serial | Runtime-selectable serial type |
esp8266oled_serial | ESP8266 | Serial | OLED |
esp32_serial | ESP32 | Serial | Runtime-selectable serial type |
esp32c3_serial | ESP32-C3 | Serial | |
esp32s2_serial | ESP32-S2 | Serial | RXPIN 13, TXPIN 14 |
esp32s3_serial | ESP32-S3 | Serial | RXPIN 13, TXPIN 14 |
esp32_udp | ESP32 | UDP receiver | Tubeless receiver |
esp32c3_udp | ESP32-C3 | UDP receiver | Tubeless receiver |
esp32s2_udp | ESP32-S2 | UDP receiver | Tubeless receiver |
esp32s3_udp | ESP32-S3 | UDP receiver | Tubeless receiver |
xh_s3e_udp | ESP32-S3 (XH-S3E) | UDP receiver | Tubeless receiver, OLED, NeoPixel, I2S audio tick |
esp8266_udp | ESP8266 | UDP receiver | Tubeless receiver |
esp8266oled_udp | ESP8266 | UDP receiver | Tubeless receiver, OLED |
espgeigerhw | ESP8266 | Pulse | OLED, PushButton, HV control |
espgeigerlite | ESP8266 | Pulse | OLED, NeoPixel, PushButton |
espgeigerlog | ESP8266 | Pulse | OLED, NeoPixel, PushButton, SDCard |
espgeigerlog_serial | ESP8266 | Serial | OLED, NeoPixel, PushButton, SDCard |
espgeigerlog_udp | ESP8266 | UDP receiver | OLED, NeoPixel, PushButton, SDCard |
Test Environments
| Environment | Platform | Test Type | Features |
|---|---|---|---|
esp8266_test | ESP8266 | Internal counter | |
esp8266oled_test | ESP8266 | Internal counter | OLED |
esp32_test | ESP32 | Internal counter | OLED auto-detected |
esp32s2_test | ESP32-S2 | Internal counter | OLED auto-detected |
esp32s3_test | ESP32-S3 | Internal counter | OLED auto-detected |
esp32c3_test | ESP32-C3 | Internal counter | OLED auto-detected |
xh_s3e_test | ESP32-S3 (XH-S3E) | Internal counter | OLED, NeoPixel, I2S audio tick |
esp8266_testpulse | ESP8266 | Pulse output | TXPIN 12 |
esp8266oled_testpulse | ESP8266 | Pulse output | TXPIN 12, OLED |
esp32_testpulse | ESP32 | Pulse output | TXPIN 14, OLED auto-detected |
esp8266_testpulseint | ESP8266 | PWM pulse output | TXPIN 12 |
esp8266oled_testpulseint | ESP8266 | PWM pulse output | TXPIN 12, OLED |
esp32_testpulseint | ESP32 | PWM pulse output | TXPIN 14, OLED auto-detected |
esp8266_testserial | ESP8266 | Serial emulated | TXPIN 12, type selectable at runtime |
esp32_testserial | ESP32 | Serial emulated | TXPIN 14, OLED auto-detected, type selectable at runtime |
espgeigerlite_test | ESP8266 | Internal counter | OLED, NeoPixel, PushButton |
espgeigerlite_testpulse | ESP8266 | Pulse output | OLED, NeoPixel, PushButton |
espgeigerlog_test | ESP8266 | Internal counter | OLED, NeoPixel, PushButton, SDCard |
espgeigerlog_testpulse | ESP8266 | Pulse output | OLED, NeoPixel, PushButton, SDCard |
espgeigerlog_testpulseint | ESP8266 | PWM pulse output | OLED, NeoPixel, PushButton, SDCard |
espgeigerlog_testserial | ESP8266 | Serial emulated | OLED, NeoPixel, PushButton, SDCard |
Making Custom Environments
Most common configurations are already covered by the pre-built environments listed above. These are built automatically by GitHub on each release and are available via the Web Installer. Custom environments are only needed if you have non-standard hardware or want to enable a specific combination of features not covered by an existing build.
PlatformIO is configured to automatically load any file matching *_env.ini in the project root. To create a custom environment, add a new file such as custom_env.ini. This file will not be tracked by git, keeping your custom configuration separate from the project.
Example: ESP8266 with serial counter, NeoPixel and OLED
Say you’ve built your own hardware with an ESP8266, a serial Geiger counter, a NeoPixel LED and an SSD1306 OLED display. You want the serial input on GPIO13 and a push button on GPIO14. The OLED goes on the default I2C pins, SDA 4 and SCL 5, so keep the serial input off those.
Start by choosing the right base. base:esp8266_neopixel gives you ESP8266 with NeoPixel support. Then add the OLED, counter type and pin configuration on top:
[env:my_serial_neopixel_oled]
extends = base:esp8266_neopixel
lib_deps =
${base:esp8266_neopixel.lib_deps}
${libraries.u8g2}
build_flags =
${base:esp8266_neopixel.build_flags}
${u8g2_flags.build_flags}
${serial_nmi.build_flags}
-D SSD1306_DISPLAY
-D OLED_SDA=4
-D OLED_SCL=5
-DGEIGER_PUSHBUTTON=true
-DPUSHBUTTON_PIN=14
-DGEIGER_TYPE=${geiger_type.serial}
-DGEIGER_RXPIN='13'
-DGEIGER_MODEL='"MySerial"'
${serial_nmi.build_flags} reads the serial counter on the timer NMI instead of SoftwareSerial, as the shipped ESP8266 serial builds do.
With no BTN_PIN_BLOCKED flag the button pin is also a setting, Button pin (btn.pin) on the Config page, with PUSHBUTTON_PIN as its default. -1 turns the button off.
After flashing, select your serial counter type (GC10, GC10Next, MightyOhm, ESPGeiger or Template) from the Config page under Input > Serial type.
The key points when building a custom environment:
- Pick the closest base that has the hardware features you need. If you need NeoPixel, start with
base:esp8266_neopixel. If you just need OLED, usebase:esp8266_oled. For a bare board, usebase:esp8266_mainorbase:esp32_main. - Add library dependencies for any features not in the base. For example, adding OLED to a NeoPixel base requires
${libraries.u8g2}inlib_depsand${u8g2_flags.build_flags}inbuild_flags. - Set your counter type with
GEIGER_TYPE. For serial builds, the specific serial protocol is selected at runtime from the Config page. - Configure your pins to match your hardware wiring.
- Common output modules (MQTT, Radmon, GMC, ThingSpeak, Webhook) are enabled globally in
platformio.iniunder[com-esp]and will be available in all custom environments.
ESP32 Partition Table
The 4 MB ESP32, ESP32-C3 and ESP32-S2 envs use partitions/esp32_4mb.csv. Keep custom images under 1280 KB (1310720 bytes) so boards that haven’t moved to it yet can still take them.