OVVO Camping
Blog
Hardware & IoT 10 min read Federico Cassani17 June 2025

How to automate campground entry with an IoT controller

An IoT controller can automate barriers, lights, outlets, and sensors at your campground. Here is how to connect it to management software via MQTT, with practical code examples.

IoT controller automation IoT MQTT DIY

An IoT controller combines wireless connectivity with programmable inputs and outputs. Its capabilities depend on the selected board, firmware, power supply, and the connected equipment, so each installation should be assessed for the intended use.

What can be automated with an IoT controller at a campground

  • Entry barrier: a 5V relay connected to the barrier’s pulse input. When the management software receives a valid reservation, it sends an MQTT command → the IoT controller closes the relay for 200ms → the barrier opens.
  • IP intercom: SIP integration with a VOIP number; the guest calls → staff answer through the app → the barrier is opened remotely.
  • Energy consumption meter for a pitch: SCT-013 sensor (current transformer) on the utility pedestal’s power supply. The IoT controller reads kWh in real time and sends them to the management software for automatic billing.
  • Weather station: BME280 sensor (temperature, humidity, pressure) + rain sensor. Data is available on the campground dashboard and for automations (automatically close umbrellas if wind exceeds 50 km/h).
  • Irrigation control: multiple relays for park zones. Program operation based on soil moisture (capacitive sensor) and weather forecasts.
  • Greywater/blackwater level sensor: HC-SR04 ultrasonic sensor on the tank. Push alert when it reaches 90% capacity.

System architecture

The standard protocol for connecting an IoT controller to management software is MQTT (Message Queuing Telemetry Transport). It works as follows: an MQTT broker (Mosquitto, installed on a Raspberry Pi or in the cloud) acts as a central hub. The IoT controller subscribes to a topic (e.g., campground/barrier/entry/command), and when it receives the message 'open', it activates the relay.

sketch.ino / main.cpp
// IoT controller — apertura sbarra via MQTT
#include <WiFi.h>
#include <PubSubClient.h>

const char* SSID     = "CampeggioPineta_IoT";
const char* PSK      = "password";
const char* BROKER   = "192.168.1.100";
const int   RELAY    = 26;  // GPIO collegato al relè

WiFiClient net;
PubSubClient mqtt(net);

void callback(char* topic, byte* payload, unsigned int len) {
  String msg((char*)payload, len);
  if (msg == "apri") {
    digitalWrite(RELAY, HIGH);
    delay(300);              // impulso 300ms
    digitalWrite(RELAY, LOW);
  }
}

void setup() {
  pinMode(RELAY, OUTPUT);
  WiFi.begin(SSID, PSK);
  while (WiFi.status() != WL_CONNECTED) delay(500);
  mqtt.setServer(BROKER, 1883);
  mqtt.setCallback(callback);
  mqtt.connect("sbarra-ingresso");
  mqtt.subscribe("campeggio/sbarra/ingresso/cmd");
}

void loop() {
  if (!mqtt.connected()) mqtt.reconnect();
  mqtt.loop();
}

The code above is simplified. In production, add: automatic WiFi reconnection, a watchdog timer, TLS/SSL on the MQTT broker, and a feedback topic confirming that the opening was completed.

Integration with Ovvo Camping

Ovvo Camping includes an internal MQTT broker. From the administration interface, you can map any MQTT topic to management software events: guest arrival, check-out, manual opening from reception, and emergency override. No server-side coding is required: only configuration through the web interface.

Security: what not to do

  • Do not use MQTT without authentication on a public WiFi network: anyone could open the barrier.
  • Do not connect the relay directly to 230V: always use an opto-isolated relay and a certified power supply.
  • Do not expose the MQTT broker to the internet without TLS: use a VPN or a secure tunnel.
  • Do not leave WiFi credentials hardcoded in the source code: use the IoT controller’s NVS (Non-Volatile Storage).

Ovvo Camping supports integration with IoT controllers. Our team can help you configure the firmware and test the system before final installation.

Want to implement this at your campground?

Ovvo Camping supports many features described in this article. Talk to us to identify those relevant to your property.

Request a free demo
Chat with us