Introduction: Infrared Motion Sensor Horn

About: I am a designer with creative and restless soul. I like to make things may it be graphic design / wood / or electronics

Hi everyone,

This is not a step by step guide,

as there are many great tutorials out there, this one helped me getting started LINK


Instead I will talk about:

  • Issues faced
  • limitations of sensor and
  • possible solutions in hope you will not get disappointed by results of your hardwork.

Back Story:

We have severe stray cats pooping problem on roof top garden (if you can say it that), since we go up in evening for cold breeze, that became an inconvenience. I believe they are 3 cats in total, which have taken the challenge to poop, no matter how many times you scared them.


IDEA:

is to use this infrared motion sensor to detect movement and honk the motorcycle's horn, this is not only caution them but also alert us that mission pooping cat is under progress XD.

This sensor is prone to:

  • False positives
    a moving plant / cloud or anything that dis-balance the hot and color areas, can trigger the sensor. Ideal for indoor use
    • Possible Solution
      Upon doing some research, many professional places this sensor is used, do Double Knock testing, which is, they use this sensor is combination with other sensing technology, like video camera. so this sensor alerts the system, which than double checks with camera, and proceeds accordingly.

      since that was not possible in my case, I used the same sensor for double checking. like this:
      1. upon first trigger, sensor beeps once very small

      2. the micro controller starts counting time from first trigger

      3. if next next trigger is in 15 seconds of first (minus the sensor on time + sensor delay in between triggers to stabilize, we cannot control that)

      4. Sensor beeps 3-4 times
      5. if no second trigger in 15 seconds (editable in code), timer resets and cycle restarts
  • Goes blind in daylight (if using outdoor)
    • Unfortunately I was not aware of that and only found it later, so I have to manually switch off - I can leave it running, but better to turn off to avoid any flase positive, just in case
    • If I am to make this again, I will put an LDR so microcontroller turns it off during day time.

Step 1: Schematic and Code

Microcontroller:

Since the function is straight forward, if sensor is high > run the alarm, I have decided to use ATTiny13a. Which is cheap and has only 8 pins.

Also to learn and move away from arduino I have coded this is C language

(because I want to move to arm microcontrollers, since they are much more powerful in same price)

Schematic contains 3 parts, a MCU, regulator and Mosfet based horn driver. simple :)

PDF of schematic is attached for ease of viewing.

Code files attached

Step 2: Casing

Since its going to be an outdoor device, placed in soil, where the cats love to do, you know what :P

Casing needs to be rugged. PVC is one of best quick solution. I used 2 inch pvc for main body, in which the bike horn fits perfectly.

One inch pvc stand, and a joint which houses the motion sensor.

Color it as per your liking or leave it alone, upto you.

and you are done :D

also included 3d files for reference i made before making casing.

Microcontroller Contest

Participated in the
Microcontroller Contest