Flick da Bird: Bird scarer using lawn sprinklers


Every summer, I empty a couple of hundred dollars of lawn seed, top soil and fertilizer on our back lawn.

Every summer, every sparrow and wood pigeon enjoys the free buffet until not one single seed is left.

Every summer, I waste time on futile experiments trying to explain to birds that they need to “🦆off”

Every summer, (except one :the nets year”. see below) by dog takes the side of the birds choosing the animals and not me: “Whatever goes upon two legs is an enemy. Whatever goes upon four legs, or has wings, is a friend”. George Orwell, Animal Farm.

This year I think I have have won!

The winner: Use the water sprinklers

Bought one of these a while ago: Smart Sprinkler Controller .Its a wifi connected, Alexa and Google Home -aware controller for an home garden irrigation system. I installed sprinklers in lawn a while ago, the type that pop up out of grass. I had spent some time writing my own control system by found this on Aliexpress and took the easy route.

A commonality to various generic smart stuff we have in house is they use the “Smartlife” phone app (or a likley skinned version thereof). It turns out these are all really Tuya controlled devices – Tuyu is a smart/IOT ecosystem that you can piggy back on if you are developing smart devices.

If you register with Tuyu’s developer platform, you can link your Smartlife account and Tuya account …. giving you (programmatic) access to the devices.

flickdabird.py

I fiddled around a bit trying to wire directly into the Tuyu api, with direction from this post but ended up using the tuyutiny python library to connect into the Smart Sprinkler Controller. The tuyutiny library is cool and easy to use:

The code below randomly (between 1min and 5min default) turns a random sprinkler value on and off for a short burst (2sec default) while script running. I have a master valve too which turns on when script started and turns off can exited.

import tinytuya
from tinytuya import OutletDevice
import time
import random


LOOKUP = {
    101 : "MASTER",
    102 : "GRASS_BACK",
    103 : "GRASS_FRONT",
    104 : "GRASS_CENTER",
}

MASTER = 101
GRASS_BACK = 102
GRASS_FRONT = 103
GRASS_CENTER = 104
SWITCHES = [GRASS_BACK, GRASS_FRONT, GRASS_CENTER]
#LOWER_BEDS_AND_FLAX = 105

def get_device() -> OutletDevice:# Connect to Device
    return tinytuya.OutletDevice(
        dev_id='<ENTER DEVICE ID>',
        address='Auto',      # Or set to 'Auto' to auto-discover IP address, or run tinytuya scan
        local_key='<ENTER KEY>', 
        version=3.3)

def cycle_switch(device: OutletDevice,dps_index):
    print(f"[{time.strftime('%H:%M:%S')}] Turning {LOOKUP[dps_index]} ON...")

    try:
        device.turn_on(switch=dps_index)
    except Exception as e:
        print(f"Error turning on {device.id}: {e}")

    # Wait 1 second
    time.sleep(3)

    print(f"[{time.strftime('%H:%M:%S')}] Turning {LOOKUP[dps_index]} OFF...")
    
    try:
        device.turn_off(switch=dps_index)
    except Exception as e:
        print(f"Error turning off {device.id}: {e}")


def main():
    device = get_device()
    device.turn_on(switch=MASTER)
    print("Starting loop. Press Ctrl+C to stop.")
    try:
        while True:
            # 1. Pick one random device from the list
            target_device = random.choice(SWITCHES)
            
            cycle_switch(device,target_device)

            # 2. Calculate random delay (half-minute to 5 minutes)
            # 5 mins = 300s, 10 mins = 600s
            delay = random.randint(60, 300)
            
            # readable time for next run
            next_run = time.time() + delay
            print(f"Waiting {delay} seconds. Next run at {time.ctime(next_run)}")
            
            # 3. Sleep
            time.sleep(delay)

    except KeyboardInterrupt:
        device.turn_off(switch=MASTER)
        print("\nScript stopped by user.")

if __name__ == "__main__":
    main()

Failed bird scarers experiments

Nets

Covering the seeds with bird nets seemed the obvious one. Except a sparrow can find and easily get into any gap (between the net and the ground). They show no proclivity at getting out. The dog, typically on the side of the sparrows, found the little critters imprisoned under a net too tempting. The result? A dog hooning around garden stuck in the net. All quite distressing.

Mechanical rotator

Made from a motor from a garage door opener. It rained. Motor shorted.

Pin wheel fans

Bought 20 or so from the dollar shop. Wind did not blow. Birds ignored them

Fake plastic predators

Plastic owl with a bobble head and plastic eagle which looks like a pigeon. Utterly useless.

Predator noises (earlier this summer)

Playing youtube videos of owl, eagle and sparrow hawk noises through a speaker. Just annoying for me, not for the sparrows – unfazed.

Camera detections and roaming GPS-RTK automated buggy

A panning dual camera system which detects birds on lawn using ML, maps position in image to 2d positional space on lawn and sends an automated drill-battery powered, self charging buggy out to see off bird. Oh, the buggy had GPS-RTK aka mm-precision positioning on board.

I shall say little more of that project! It went the way of the Boeing 2707 “Concorde”, the Landkreuzer 1000 tonne tank and the Ford Nucleon.