Snakes are highly sensitive to ground vibrations, interpreting them as signs of nearby predators or large animals. This natural behavior can be leveraged to create a humane deterrent system: instead of relying on chemicals or barriers alone, we can generate irregular seismic signals that encourage snakes to move away.
This project explores how to build a low‑cost, programmable vibration driver using an ESP8266 microcontroller and ESPHome firmware. By switching a 12 V hammer actuator in randomized bursts, the system produces unpredictable vibration patterns that mimic footsteps or animal movement. The result is a practical demonstration of how embedded systems, simple electronics, and open‑source firmware can be combined into a real‑world solution.
Why Random Bursts?
A steady metronome‑like vibration quickly becomes background noise. Random clusters of strikes, separated by unpredictable pauses, feel more “alive” and unsettling. This project uses ESPHome on an ESP‑01S relay board to generate those bursts automatically.
Why 12 V Matters
One important design choice was to keep the system at 12 V DC. Many garden devices unfortunately operate directly from 230 V mains, which introduces unnecessary electrical hazards in outdoor environments. By standardizing on 12 V, the system remains low‑voltage and touch‑safe, significantly reducing the risk of shock during installation, maintenance, or accidental contact.
Hardware Setup
- ESP‑01S WiFi relay board with external voltage regulator 12V -> 5V.
- 12 V Selenoid Lock, used as hammer actuator mounted to a metal stick pushed into the ground
- Shared 12 V supply: powers both the hammer and the relay board
The relay switches the hammer coil, while ESPHome firmware handles the random timing.
ESPHome Configuration
Here’s the YAML configuration that runs the random burst script at boot, with a manual switch to enable/disable it:
esphome:
name: esphome-relay2
friendly_name: esphome relay2 snake hammer
on_boot:
priority: -10
then:
- if:
condition:
switch.is_on: random_enabled
then:
- script.execute: random_burst
esp8266:
board: esp01_1m
switch:
- platform: gpio
pin: GPIO0
name: "Relay2"
inverted: true
id: relay2
- platform: template
name: "Random Burst Enabled"
id: random_enabled
optimistic: true
restore_state: true
turn_on_action:
- script.execute: random_burst
turn_off_action:
- script.stop: random_burst
script:
- id: random_burst
mode: restart
then:
- while:
condition:
switch.is_on: random_enabled
then:
- lambda: |-
int burst = random(2, 5); // 2–4 strikes
for (int i = 0; i < burst; i++) {
id(relay2).turn_on();
delay(200); // hammer ON
id(relay2).turn_off();
delay(random(300, 1000)); // random pause
}
- delay: !lambda "return random(5000, 15000);" // random gap before next burst
How It Works
- Burst clusters: 2–4 relay activations per cycle
- Random intra‑burst delay: 300–1000 ms between strikes
- Random inter‑burst gap: 5–15 s before the next cluster
- Control switch: Exposed in Home Assistant and the ESPHome web UI, so the system can be disabled remotely
Results
The hammer delivers irregular seismic signals through the ground near entry points. Combined with perimeter lighting and physical barriers, this creates a layered deterrent system. It’s not a silver bullet, but it reduces surprise encounters and adds peace of mind.
Final Thoughts
This vibration deterrent system is no longer just a concept on paper — it is currently undergoing real‑world testing. The ESPHome‑driven relay board and hammer actuator are deployed and running continuous randomized bursts, allowing me to observe how the design performs outside of the lab. Early results are promising, but the ongoing field trials will provide the most valuable insights: durability of the hardware, consistency of the randomization, and, most importantly, the behavioral response of snakes to irregular seismic signals.
By documenting this project as it evolves, I aim to demonstrate not only the technical implementation but also the practical effectiveness of combining embedded systems with behavioral cues in a real environment. This piece highlights the journey from idea to deployment — and the testing phase is where theory meets reality.