Stone Marten Repellent V2

by RobBest in Circuits > Microcontrollers

15 Views, 1 Favorites, 0 Comments

Stone Marten Repellent V2

P1080621.JPG

This is a slightly and fully DIY version of a previous Stone Marten Repellent that I created. This version has some additional power management features. The reason for it is that this version is used in a location where there is sufficient sunlight, which was not the case for the previous version.

This Stone Marten Repellent is based on a PIC16F15313 Micro Controller that uses an on board Numeric Controlled Oscillator (NCO) to generate an ultrasonic signal in the range of 20 kHz to 50 kHz. That signal then goes to a Piezo Tweeter. And while developing this Repellent I added some extra power management modes.

The housing a fully DIY version, made from Plexiglass.

Supplies

You need the following electronic components for this project:

  1. 1 PIC Micro controller 16F15313
  2. 1 74HC14
  3. 1 Schottky Diode 1N5817
  4. 1 Piezo Tweeter PW3825
  5. 2 ceramic capacitors of 100 nF
  6. Resistors, 1 * 22k, 2 * 10k, 2 * 4k7, 1 * 330 Ohm, 1 * 10 Ohm
  7. 1 Green LED
  8. 1 Battery Holder
  9. 1 Jumper
  10. 4 NiMH AA rechargeable batteries, type ‘Always Ready’
  11. 1 solar panel of 7 Volt, 120 mA

The Design

schematic_diagram.png
P1080594_Text.JPG

I created a using a PIC Micro Controller, programmed with the JAL programming language. The design properties are:

  1. Built around a PIC16F15313 Micro Controller
  2. Using a 74HC14 as output buffer for higher audio output
  3. No flashing LEDs
  4. Using rechargeable batteries
  5. Large solar panel, size 11 x 11 cm, 7 Volt 120 mA
  6. Several power management functions
  7. Option for night mode
  8. LED indicates activity and operating mode

The picture shows the schematic diagram.

With jumper JP1, the night mode can be selected. In order to reduce power consumption the measurement of the battery voltage, done using resistors R1 and R2, is controlled by pin RA4 of the PIC. This pin is only activate during the measurement. When the device is inactive, pin RA5 switches to input. Resistor R4 will then pull-up this line so that the signal on the Piezo Tweeter is low during the inactive period.

The picture shows how I assembled the components on a breadboard.

The Specification

This design has the following specification:

  1. Supports a frequency range between 20 kHz – 50 kHz
  2. Starts a tone randomly at 20 kHz or at 50 kHz
  3. Uses randomly two different sweep speeds
  4. Sweep time is 1 second or 2 seconds for one sweep. Since the sweep goes from one frequency to the other and back again, the total sweep time per cycle is 2 or 4 seconds.
  5. Does this a random number of times, between 3 times and 7 times
  6. Repeats continuously or after 30, 60, 128 or 256 seconds, depending on the operation mode
  7. Uses a Piezo Tweeter
  8. In direct sunlight the solar panel supplies a 150 mA charging current
  9. LED blinks indicate operating mode: Continuous, High (4), Normal (3), power save (2), power low (1)

I had chosen for a random pattern in the tone, like not always starting with the lowest tone and changing the speed in which the tone goes from low to high or the other way around. Next to that, the tone generation cycle repeats are also random and depending on the operating mode.

The power saving modes, are indicated by the LED:

  1. In normal operation mode the LED blinks 3 times before it starts the random tone patterns. The pattern repeats after 64 seconds or 128 seconds.
  2. If the battery voltage drops below 4.4 Volt (so 1.1 Volt per battery) the device switches to a low power mode. In this mode the pattern will repeat after 256 seconds and the LED will blink 2 times.
  3. If the battery voltage drops below 3.6 Volt (so 0.9 Volt per battery) the batteries are empty. The LED will still blink once time every 256 seconds but no tone is produced.
  4. If the device is in direct sunlight there may be enough power to shorten the repeat time to 32 seconds or 64 seconds (high mode) and the LED will blink 4 times. However, if the battery voltage becomes higher than 5.2 Volt (so 1.3 Volt per battery), a continuous operating mode is activated. This means that the tones are created without a pause. In this mode the device consumes more power. The LED will be continuously on when this mode is active. Note that the PIC can handle a maximum operating voltage of 5.5 Volt.


Some Measurements

Waveform_hc04_measurement_current.bmp
Repeat_Pattern.bmp

I obtained the following measurements:

  1. Measurements done at 5 Volt (4 AA rechargeable batteries)
  2. When inactive, consumes 25 uA
  3. When active, consumes around 25 mA
  4. Signal on Piezo Tweeter 5 Volt peak to peak

The screenshot from the oscilloscope shows the signal from the 74HC14 (top) and on the Piezo Tweeter after the 10 Ohm resistor (bottom).

The other screenshot shows the active period and the repetition. The top signal shows the signal for the Piezo Tweeter. As can be seen the active period varies due to number of repeats and the duration of one sweep. The bottom signal shows the signal for the LED and is used as trigger. The picture also shows that the time between two periods which varies. After the first trigger, the next period starts after two minutes while the next period after that starts after one minute.

The shortest active period is 3 repetitions x 2 seconds = 6 seconds. The longest active period is 7 repetitions x 4 seconds = 28 seconds.

The Software

The software is written in the JAL programming language. Globally it does the following:

  1. Uses the PIC’s Numeric Controlled Oscillator (NCO) for tone generation
  2. Sweep tone is created using a Timer interrupt routine running at 2 kHz or 4 kHz
  3. One sweep takes – randomly – one second or two seconds
  4. Measures the battery voltage using an Analog to Digital Converter (ADC)
  5. Determines the operation mode and power management
  6. Measures the solar panel voltage using the ADC to detect night mode
  7. Device activated only when solar panel voltage lower than 2.0 Volt
  8. Goes to sleep when inactive. Device consumes 25 uA in sleep mode
  9. Wakes up from sleep using the Watch Dog Timer (WDT)

The used Micro Controller has 2k of Flash memory (ROM) and 256 bytes of RAM. The program uses 692 bytes of Flash memory and 46 bytes of RAM.

The JAL program file and the HEX file for programming the PIC are attached.

If you are interested in using the PIC Micro Controller with JAL visit the JAL website

The Housing

P1080578.JPG

The housing is made of Plexiglass, glued together with hard plastic glue as shown in the following picture. The electronics is placed as a sandwich at the bottom of the housing with the battery on top. The solar panel is glued at the top of the housing in its own casing and with a cover plate to protect it from rain. The Piezo Tweeter and the LED are not yet assembled and the components are not yet connected. This is done after the Repellent was painted.


The Device in Action

Stone Marten Repellent Video V2

In the following video the device was installed outside where there was more sunlight and with the battery voltage slightly above 5.2 Volt. When it switches on, it starts in continuous operating mode but after some time the battery voltage drops below 5.2 Volt, after which it switches over to the high operating mode, as can be seen by the fact that the LED blinks. Note that you can hear clicking when the Piezo Tweeter starts, also after the LED has blinked, the tones are generated a random number of times, which can also be heard by these clicks, before it stops.