         // send over MQTT
         char message[16];
         snprintf(message, sizeof(message), "%d cpm", cpm);
-        mqtt_send(TOPIC_GEIGER, message);
+        mqtt_send(TOPIC_GEIGER, message, true);
+
+        // verify network connection and reboot on failure
+        if (WiFi.status() != WL_CONNECTED) {
+            Serial.println("Restarting ESP...");
+            ESP.restart();
+        }
     }
 
     // keep MQTT alive

        Serial.print(" to ");
        Serial.print(topic);
        Serial.print("...");
        int result = mqttClient.publish(topic, value, true);
        Serial.println(result ? "OK" : "FAIL");
    }
}

void loop()

    attachInterrupt(digitalPinToInterrupt(PIN_TICK), tube_impulse, FALLING); 
}

static bool mqtt_send(const char *topic, const char *value, bool retained)
{
    bool result = false;
    if (!mqttClient.connected()) {
        Serial.print("Connecting MQTT...");
        mqttClient.setServer(MQTT_HOST, MQTT_PORT);
        result = mqttClient.connect(esp_id, topic, 0, retained, "offline");
        Serial.println(result ? "OK" : "FAIL");
    }
    if (mqttClient.connected()) {
        Serial.print("Publishing ");
