to summarize , a preferred embodiment of a dog bark limiter of the present invention provides convenient manual adjustability of the applied stimulus level to be applied to the neck of the dog by means of a switch . the bark limiter also includes low power circuitry that improves the electrical stimulation scheme to provide adequately high open circuit voltage between the stimulus electrodes in a small , lightweight collar - mounted animal training product at both high and low selected stimulus levels . the described bark limiter includes a motion detector that detects characteristic motion of the dog &# 39 ; s neck produced as a result of barking and in response automatically powers up the circuitry from a very low power stand by operating condition . a technique of “ valid ” bark detection using software wherein a capture and compare routine is executed in software executed by a microcontroller to accomplish the function of , in effect , generating a frequency spectrum of the received sound and comparing it with a predetermined frequency spectrum to determine if the sound constitutes a “ valid ” bark . a “ bark counter ” function is provided that counts the number of valid barking episodes by the dog . a self - test mode is provided to self - test or verify operability of the neck motion sensor and the sound vibration sensor . whenever an electrical stimulus is applied to the dog &# 39 ; s neck , then a 4 second “ relaxation ” delay is allowed to elapse before any further stimulus can be applied , in order to prevent a stimulus - caused barking cycle from being established . referring to fig1 , 2 , 3 a and 3 b , bark limiter 1 includes a housing 2 having a lower section 2 a and an upper section 2 b . the top surface 9 of upper housing section 2 b is slightly concave , to better accommodate the curvature of a dog &# 39 ; s neck . a pair of collar - retaining loops 3 are attached to opposite ends of upper housing section 2 b , as shown . a typical dog collar ( not shown ) is passed through loops 3 around the bottom surface of housing 2 to fasten bark limiter 1 to the dog &# 39 ; s neck . two stimulus electrodes 5 are threaded into receiving holes 8 ( fig2 ) in the upper surface 9 , and their conductive tips are pressed against the dog &# 39 ; s neck to make electrical contact therewith when the collar is tightened . as indicated in fig2 , stimulus electrodes 5 are removable . in accordance with one aspect of the present invention , a preferably non - conductive stabilizing post of the same height as stimulus electrodes 5 is rigidly attached to upper surface 9 , and is offset from a straight line between stimulus electrodes 5 so the stabilizing post 7 and the two stimulus electrodes 5 define a triangle . this prevents the conductive electrode tips of stimulus electrodes 5 from “ rocking ” against the dog &# 39 ; s neck and avoids or at least reduces the occurrence and severity of sores on the dog &# 39 ; s neck that are sometimes caused by the pressure of the stimulus electrodes against the dog &# 39 ; s skin . the stabilizing post 7 in conjunction with the stimulus electrodes 5 b and 5 c provides stable contact of all three with the dog &# 39 ; s neck and allows the direction of the collar to be reversed so that stabilizing post 7 and stimulus electrodes 5 b and 5 c make contact with different areas on the dog &# 39 ; s neck , which reduces the occurrence and of and severity of neck sores . a dome - shaped membrane 6 that preferably is integrally formed with the upper housing section 2 b is disposed on upper surface 9 and constitutes part of an improved vibration sensor 30 , which is subsequently described in more detail with reference to fig5 . a membrane switch 17 extends through an opening in upper surface 9 . the dog owner can repetitively depress membrane switch 17 to select one of five stimulus intensity levels . the selected intensity level is indicated by illumination of one of the five indicators identified by reference numeral 10 . membrane switch 17 also can be depressed for a 4 second interval to set bark limiter 1 to a test mode , subsequently described . the above features , except the stimulus electrodes 5 b and 5 c , on the upper surface 9 of upper housing 2 b are all integrally formed as a single unit . referring to the exploded views of fig3 a and 3b , lower housing section 2 a is attached to upper housing section 2 b by means of two screws 12 . a printed circuit board 15 a contained within housing 2 is attached to upper housing section 2 b by means of two screws 16 . a 3 volt lithium battery 13 is attached to the bottom of printed circuit board 15 a by means of a pair of clips 14 . the membrane switch unit 17 is attached to the upper surface of printed circuit board 15 a and extends through a hole in upper surface 9 . a metal trace 17 a is contacted to provide a switch closure when the upper surface of membrane switch unit 17 is depressed . an output transformer 18 , a microcontroller 19 , and five light emitting diodes d 1 – 5 are mounted on the upper surface of printed circuit board 15 . as shown in fig3 b , a piezoelectric transducer 21 is supported on output transformer 18 , and is contacted by a “ nipple ” 11 ( fig5 ) formed on the underside of dome - shaped membrane 6 . piezoelectric transducer 21 can be a model p / n : 7bb - 20 - 6 available from murata electronics north america , inc . the intensity indicators 10 - 1 , 2 , 3 , 4 , 5 become illuminated by light emitting diodes d 1 – 5 , respectively , as membrane switch 17 is successively depressed . an internal led reflector element 20 , shown in fig4 a and 4b , is mounted on the upper surface of printed circuit board 15 so that the five recesses 25 thereof cover light emitting diodes d 1 – 5 , respectively . notches 26 facilitate attachment of led reflector 20 to printed circuit board 15 . led reflector 20 allows the intensity indicators 10 , which appear as the numerals 1 – 5 , respectively , in fig3 a and 3b on the front of upper housing section 2 b to be clearly illuminated through the thin side wall of upper housing 2 b to appear when the corresponding light emitting diodes d 1 – 5 are turned on . the five leds correspond to indicators 10 - 1 , 2 , 3 , 4 , 5 to indicate which stimulation level has been selected by means of the membrane switch 17 , and also indicate whether the bark limiter 1 is in a test mode . holding switch membrane 17 depressed for 4 seconds sets the bark limiter 1 into its test mode , and the various leds d 1 – 5 blink , depending on the neck motion and barking by the dog . the led corresponding to the intensity level selected by means of membrane switch 17 is the one which blinks . the arrangement of membrane switch 17 and the led display arrangement including the lens reflector 20 minimizes the possibility of water leakage into the housing of the bark control device . referring to fig5 , the dome - shaped structure of acoustic membrane 6 and the location and structure of nipple 11 pressing against the central , most sensitive portion of the surface of piezoelectric transducer 21 are shown . referring to fig6 - 1 and 6 - 2 , the circuitry of bark limiter 1 is provided on the upper surface of printed circuit board 15 a ( fig3 a ), and includes vibration sensor assembly 30 which includes above mentioned dome - shaped membrane 6 , piezoelectric transducer 21 , and the above - mentioned nipple 11 formed on the underside of membrane 6 in order to efficiently transmit vibrations from membrane 6 to piezoelectric transducer 21 . one of the electrodes of piezoelectric transducer 21 is connected to ground and the other is coupled by capacitor c 4 and resistor r 10 to the (−) input of an operational amplifier 31 . the (+) input of operational amplifier 31 is connected to the junction between resistor r 12 and resistor r 13 . the other terminal of resistor r 12 is connected to ground , and the other terminal of resistor r 13 is connected to one terminal of resistor r 4 and to the ra 0 input on lead 19 of microcontroller 33 . the other terminal of resistor r 4 is connected to the battery voltage vbat . the output of operational amplifier 31 is connected by conductor 32 to the ra 2 input on lead 1 of microcontroller 33 and also is connected to one terminal of capacitor c 2 and one terminal of resistor r 5 . the other terminals of resistors r 5 and capacitor c 2 are connected to the (−) input of operational amplifier 31 . the ra 2 input of microcontroller 33 is connected to one input of an internal comparator , the other input of which is connected to the ra 0 terminal of microcontroller 33 , in order to produce an internal square waveform to be used as an input to the internal microprocessor portion of microcontroller 33 , to allow the frequency of the square waveform to be determined . the capacitor c 2 functions as a low pass filter that sets the upper cutoff frequency of operational amplifier 31 . the resistors r 5 and r 10 to determine the gain of operational amplifier 31 . voltage monitor circuit 34 in fig6 - 1 and 6 - 2 produces a low output voltage if vbat is less than approximately 2 volts , and the junction between resistors r 3 and r 22 , which are coupled in series between vbat and the output of voltage detector 34 , applies a reset signal to the microcontroller reset input mclr on lead 4 thereof if vbat is below approximately 2 volts . a resistor r 4 , in combination with resistors r 13 and r 12 , forms a threshold circuit that establish a threshold voltage to be applied to the internal comparator of microcontroller 33 via its ra 0 input . the output of the internal comparator of microcontroller 33 is produced on lead 2 of microcontroller 33 , which is externally connected to the ccp 1 input on lead 2 of microcontroller 33 . the ccp 1 input of microcontroller 33 is used in the subsequently described compare - capture mode of operation , to measure the periods of the square waveforms on the ccp 1 input . this allows the signals produced by vibration transducer 30 and amplified by operational amplifier 31 to be captured within an approximately 120 millisecond interval , and in effect , assembled into a frequency spectrum including sixteen 40 hz windows in the range from 150 hz to 800 hz , which can be used to determine if the present sound is a valid bark . actuation of the motion sensor 40 in fig6 - 1 and 6 - 2 results in a signal applied to lead 7 of microcontroller 33 to indicate whether the dog &# 39 ; s present neck motion is of the kind characteristically caused by barking . microprocessor 33 automatically switches from low - power standby operation at 37 khz to normal operation at 4 mhz if this signal indicates that the dog has begun barking . the rb 2 , 4 , 5 , 6 , and 7 outputs of microcontroller 33 selectively turn on leds d 1 – 5 , respectively , in response to the pressing of membrane switch 17 . however , if microcontroller 33 is reset as a result of vbat being less than 2 . 2 volts , microcontroller 33 produces high impedance outputs , and in that case , resistors r 23 and r 24 pull the gate voltages of mosfets q 5 and q 6 to vbat thereby turn them on and allow the battery to discharge completely through light emitting diodes d 4 and d 5 , turning them both on until the battery is completely dead . if leds d 4 and d 5 emit light simultaneously , that indicates that the battery is discharged and needs to be replaced . the ra 6 output on lead 17 of microcontroller 33 is coupled to the base of an npn transistor q 1 having its emitter connected to ground and its collector coupled by a resistor r 6 to the base of a pnp transistor q 2 having its collector connected to vbat and its emitter connected by conductor 38 to one terminal of the primary winding of output transformer 42 . the base of transistor q 2 also is coupled by a resistor r 2 to vbat . the ra 7 output on lead 18 of microcontroller 33 is coupled to the base of an npn transistor q 3 which has its collector coupled by resistor r 7 to vbat and its emitter connected to the base of an npn transistor q 4 . the emitter of transistor q 4 is connected to ground and its collector is connected to conductor 38 . the other terminal of the primary winding of output transformer 42 is connected to vbat . the secondary winding terminals 5 b and 5 c are connected to the two stimulus electrodes 5 . transistor q 4 , when turned on , produces a constant collector current for the entire amount of time that transistor q 4 is turned on . if all of the collector current of transistor q 4 flows through the primary winding of transformer 42 , that results in delivery of a maximum amount of energy to the primary winding of transformer 42 and therefore in a maximum amount output energy delivered to the stimulus electrodes 5 by the secondary winding of transformer 42 . however , if transistor q 2 is turned on after the peak vp of the flyback spike that occurs in the waveform of the voltage v 38 on conductor 38 immediately after transistor q 4 is turned off , then some of the decaying current in the primary winding of transformer 42 is shunted , causing v 38 to rapidly fall to zero . this reduces the amount of energy delivered to the primary winding of transformer 42 for each pulse of the waveform v 39 applied to the base of transistor q 4 by microcontroller 33 , and therefore also reduces the amount of stimulus energy delivered through stimulus electrodes 5 to the dog &# 39 ; s neck . microcontroller 33 operates to produce a burst of pulses which are applied to the base of transistor q 4 via the darlington circuit configuration including transistor q 3 . each burst is approximately 0 . 5 seconds in duration , and each pulse width is approximately 0 . 9 to 1 . 0 milliseconds in duration . the intensity of the stimulation applied to the dog &# 39 ; s neck is controlled by synchronously turning on shunt transistor q 2 to divert a controlled amount of the collector current of transistor q 4 away from the primary winding of transformer 42 . this approach has the advantage of shunting some of the current in the primary winding of transformer 42 after the peak of the flyback spike of v 38 through shunt transistor q 2 to the battery supplying vbat . during each turn - on pulse applied to the gate of mosfet q 4 , its drain current is constant , and the magnitude of that drain current is what determines the peak value of the flyback voltage on conductor 38 and consequently also mainly determines the open circuit voltage produced between stimulus electrodes 5 by the secondary winding of output transformer 42 . since q 2 is not turned on until after the peak of the flyback pulse of v 38 , the peak value of the flyback voltage pulse is substantially independent of the selected stimulus level , and therefore the desired large open circuit output voltage produced by transformer 42 also is substantially independent of the selected amount of stimulus energy to be applied via output transformer 42 to the animal &# 39 ; s skin . referring to fig7 a , in this diagram shunt transistor q 2 is , for convenience , shown as a simple switch controlled by the q 2 base drive signal v 37 and primary current transistor q 4 which also is shown as a simple switch controlled by the q 4 base drive signal v 39 . the impedance between stimulus electrodes 5 b and 5 c , including the impedance of the dog &# 39 ; s neck and the contact resistances associated with the tips of electrodes 5 b and 5 c , is indicated by the impedance zl . referring to fig7 b , the signal v 39 includes a burst of constant - width pulses generated by microcontroller 33 , and , for each pulse , turns transistor q 4 on at a time ta and turns transistor q 4 at a time tb . the signal v 37 includes a burst of variable width pulses , if desired , to control the amount of energy delivered to the primary winding of transformer 42 by operating shunt transistor q 2 to shunt the primary winding during a selectable part of the decaying portion of the flyback spike of the voltage v 38 on conductor 38 . the pulse of v 37 , if present , turns primary winding switch transistor q 2 on at a time tc and turns it off at the following time ta . fig7 c – g show the characteristics of the transformer primary winding “ flyback ” voltage waveform produced on conductor 38 as a result of the combined operation of the shunt path circuitry including transistors q 1 and q 2 and the primary winding current circuitry including transistors q 3 and q 4 in response to microcontroller 33 . as shown in fig7 c – g , the peak voltage vp of each flyback spike 50 of v 38 is relatively independent of whether shunt transistor q 2 is not turned on in order to allow maximum energy to be delivered to the primary winding , and also is relatively independent of the amount of time that shunt transistor q 2 is turned on after the peak of each flyback spike 50 in order to reduce the amount of energy delivered to the primary winding of output transformer 42 . the segments 50 d in fig7 d – g indicate that turning on the shunt transistor q 2 causes the subsequent portion of v 38 to rapidly fall to zero , thereby reducing the amount of energy delivered to the primary winding of transformer 42 , and therefore reducing the amount of energy delivered by the secondary winding to the dog &# 39 ; s neck . in fig7 c , the steep leading edge of flyback spike 2 to the occurs when transistor q 4 is turned off at time tb . shunt transistor q 2 is not turned on , so portion 50 c of flyback spike 50 is allowed to decay all away to zero with no shunting , which corresponds to the maximum stimulus intensity setting . in fig7 d , shunt transistor q 2 is turned on at a time tc equal to t1 , which rapidly decreases v 38 to zero at time t1 , so less energy is to delivered to the primary winding than in fig7 c . in fig7 e , shunt transistor q 2 is turned on sooner than in fig7 d , at time tc equal to t2 , so less energy is delivered to the primary winding than in fig7 d . in fig7 f , shunt transistor q 2 is turned on sooner than in fig7 e , at time tc equal to t3 , so less energy is the total delivered to the primary winding than in fig7 e . in fig7 g , shunt transistor q 2 is turned on sooner than in fig7 f , at time tc equal to t4 , so even less energy is delivered to the primary winding than in fig7 f . thus , in one embodiment of the invention two control signals are in effect applied by microcontroller 33 to control the energizing of the primary winding of the output transformer , including the constant - width turn - on pulse signal applied to the gate of mosfet q 4 to establish the constant open circuit voltage produced between the stimulus electrodes , and also including a shunt control signal which controls the synchronous turn - on of shunt transistor q 2 after the occurrence of the peak value of the flyback voltage on conductor 38 in order to control the amount of energy delivered to the primary winding of the transformer , and therefore the amount of rms stimulus energy delivered the dog . this is in contrast to some of the assignee &# 39 ; s prior collar - mounted electronic animal training devices and numerous other prior art animal training devices in which the desired stimulation intensity is varied only by changing the widths of the current pulses driven through the primary winding of the output transformer . the microcontroller 33 used in the improved bark limiter 1 of the present invention preferably is a pic16f628 available from microchip technology incorporated , which includes several signal conditioning operational amplifiers , and operates so as to perform the same functions of executing the program represented by the flowchart of fig9 a – e . the details of microcontroller 33 are shown in fig8 - 1 and 8 - 2 . as shown in fig8 - 1 and 8 - 2 , microcontroller includes a flash memory 33 a , a random access memory 33 b for storing file registers , and a non - volatile eeprom 33 c for storing the operating program and valid bark detection algorithms . microcontroller 33 also includes the above - mentioned comparator 33 d which generates the signal data in , and also includes a vref circuit 33 e that produces 1 of 16 voltage levels provided as inputs to the comparator input if the comparator input is configured so that a vref input is needed . by way of definition , the terms “ controller ” and “ micro - controller ” are used herein is intended to encompass any microcontroller , digital signal processor ( dsp ), state machine , logic circuitry , and / or programmed logic array ( pla ) that performs functions of microcontroller 33 as described above . motion sensor 40 can be a model # sq - sen - 001p ultra compact tilt and vibration sensor , available from signalquest inc . motion sensor 40 is of a mechanical ball - in - tube construction , and includes a conductive ball that makes contact with appropriate electrodes in response to motion of the dog &# 39 ; s neck in order to send the “ wake - up ” signal microcontroller 33 . motion patterns that are characteristic of barking can be detected using motion detector 40 , and furthermore , a captured digitized barking or vocalization signal can be utilized to provide a frequency spectrum that represents a “ valid ” bark in order to provide more accurate bark detection that has previously been achieved . the vibration detection operation , motion detection operation , and valid bark determination based on the frequency spectrum of the dog &# 39 ; s vocalization are combined to determine whether an aversive stimulus signal should be produced between electrodes 5 b and 5 c . the motion detection is used primarily as part of detection of a valid bark , and is used secondarily to accomplish awakening bark limiter 1 from its sleep mode . either the subsequently described “ valid bark ” detection based on the frequency spectrum of signals received from vibration sensor 30 or motion signals based on movement of motion detector 40 could be considered the primary bark detection function and the other could be considered to be the secondary bark detection function . the bark limiter could be awakened or powered up in response to barking , and the aversive stimulus could then be triggered by detection of neck motion , or vice versa . bark limiter 1 has an external power switch function that is performed by membrane switch 17 , and also can be automatically turned on or “ awakened ” by motion sensor 40 in response to the dog making the kind of characteristic head movement that corresponds to barking by the dog . motion sensor 40 “ wakes up ” the bark limiter 1 from a low power stand by condition and stimulates microcontroller 33 to begin looking for a “ valid ” barking signal / sound . in the low power condition , microcontroller 33 runs at 37 khz . once it is awakened , microcontroller 33 runs at 37 khz , and if any barking signals are detected , microcontroller 33 operates at 4 mhz to process that information , and then returns to a 37 khz speed . the on mode includes both the sleep mode and the es level change mode . the off mode allows the bark limiter 1 to be awakened as a result of a switch trigger signal produced by depressing switch 17 , and if that occurs , the program executed by microprocessor 33 checks to determine if switch 17 is depressed for least 0 . 1 seconds , and if it is not , automatically goes back into the sleep mode . if bark limiter 1 is in both the on mode and the sleep mode , and a signal is received from motion sensor 40 , it immediately checks for a bark signal from vibration sensor 30 while microprocessor 33 is internally operating at 4 mhz , and if there is no bark signal from vibration sensor 30 , and the internal clock signal is reduced to 37 khz , waits for a period of 2 seconds , and then reenters the sleep mode . thus , a user can determine if bark limiter 1 is in its on mode by subjecting bark limiter 1 to sufficient motion to cause motion sensor 40 to produce a motion signal and noticing if the light emitting diodes blink several times . the two field effect transistors q 5 and q 6 connected in series with leds d 4 and d 5 , respectively , are used to indicate that the battery voltage is too low when the voltage monitor circuit produces a voltage below 2 . 2 volts . when the microcontroller 33 is reset , all of its outputs go to a high impedance state , and leds d 4 and d 5 are turned on . they continue drawing current until the battery is completely dead . since the operation of the microcontroller is not assured for supply voltages below 2 . 2 volts , it is set to a “ nonoperative ”, high output impedance condition so to avoid any possibility of unintended stimulation of the dog if the battery voltage is too low . the present invention provides an improved technique of bark detection with software by using the internal “ capture / compare module ” of the pic16lf627 microcontroller 33 to determine what vocalization by the dog constitute “ valid ” barks . during a 120 ms ( or similar ) capture time interval , the periods of the various bark signal frequencies are measured and counted . a window of acceptable frequencies in the range of , for example , 150 hz – 800 hz , is created by the software . this interval or “ window ” is divided into 16 “ buckets ” into which the counts of 16 evenly divided frequency ranges are stored . when a bark / sound signal is received , the periods of the bark frequencies are measured during the 120 ms capture interval . the period of the frequency component of the received bark / sound signal is measured , and if the measured period falls within one of the 16 buckets , i . e . frequency ranges , then a software counter assigned to that bucket is incremented . for each complete bark signal / sound captured , the counter totals are compared to predetermined threshold levels ( representing a predetermined “ valid bark ” frequency spectrum ) for each corresponding bucket , respectively in order to determine whether the bark / sound constitutes a “ valid ” bark . a software “ bark counter ” is executed by microcontroller 33 to count the number of times the dog is stimulated in response to detection of a valid bark while bark limiter 1 is mounted on the dog . the bark counter contents can be determined by the trainer or dog owner when the collar is removed and turned off . the bark counter content is determined by counting the number of times the middle number three indicator led 3 blinks after a switch 17 has been held pressed for more than 3 seconds . the present invention also provides a lightweight bark limiter 1 in a small package which is usable on small dogs yet is capable of providing much higher stimulus levels than the small , lightweight bark limiting devices of the prior art . the membrane switch 17 allows convenient manual selection the stimulation level to be applied to dog &# 39 ; s neck . the internal reflector 20 allows the light emitted by the leds to effectively pass through the translucent housing material . this is to avoid the need to “ light up ” the entire housing and focuses the illumination on the windows for the intensity indicator leds avoids the need for the expense of placing the leds close to the edge of the housing and also avoids the need for the expense of providing thinner walled windows to be molded into the housing for the led light to shine through . the combination of the translucent housing and the reflector lens 20 provides the substantial benefit of making it easier to make the entire bark limiter leakproof while also providing a convenient means for indicating its operating state or condition . a 30 second interval is established when the desired electrical stimulus level is changed or if the bark limiter 1 is turned on . during the 30 second interval , the only thing that can happen is for the user to select the desired stimulus level or to turn bark limiter 1 off . during that 30 second interval the lights blink every second . if the user selects a particular stimulus level , it the 30 second timer is reset . fig9 a shows how bark limiter 1 is awakened from its “ sleep ” mode in response to a motion - indicating interrupt signal from motion detector 40 . if a motion signal is received by microcontroller 33 , the program goes from decision block 71 to block 75 and checks to determine if any signal is being received on conductor 32 in response to vibration sensor 30 . in decision block 76 , the program executes the subroutine of fig9 c to determine if the spectrum of sound signals received from vibration sensor 30 is the spectrum of a “ valid bark ”. if this determination is affirmative , the program goes to the routine of fig9 b to generate an aversive electrical stimulus ( e . s .) signal between stimulation electrodes 5 b and 5 c . referring to fig9 b , in block 51 the program executed by microcontroller 33 determines the selected stimulation level , i . e ., determines the electrical stimulus time delay value that results in one of the waveforms shown in fig7 c – g that has been set by means of switch 17 and stores it in the non - volatile memory 33 e ( fig8 - 1 and 8 - 2 ). as indicated in block 52 , microcontroller 33 sets v 37 and v 39 to high levels in block 52 in order to switch on the primary winding current in transformer 42 , and then in block 53 starts a software timer “ es ( electro - stimulus ) timer ” to the value “ e . s . time delay ” determined in block 51 . the program then goes to decision block 54 and continues to “ loop ” as long as the count of “ es timer ” of block 53 has a value less than “ e . s . time delay ”. after the selected time delay interval has elapsed , the program goes to block 55 b and sets the signal ra 7 on lead 18 of microcontroller 33 to a low level , which causes v 39 to go to a low level and causes the flyback transition 50 b of fig7 a – g to occur . after a delay tc has elapsed , as indicated in decision block 55 a , the program sets the level ra 7 on lead 18 of microcontroller 33 to a high - level , v 37 to a low level , and turns transistor q 2 on . every stimulation pulse produced by microcontroller 33 on the base of transistor q 3 has a duration of 3 . 2 milliseconds . for every stimulus signal produced by microcontroller 33 , block 56 of the program of fig9 b causes the stimulus output signal produced by microcontroller 33 on its lead 2 to be at a low level until the 3 . 2 milliseconds has elapsed . the program then goes to decision block 57 and determines if the number of stimulus pulses produced by microcontroller 33 is less than or equal to 160 ( which corresponds to approximately half a second of electrical stimulation applied between electrodes 5 b and 5 c ), and if that determination is affirmative , the program goes back to the entry point of block 52 and continues to repeat the foregoing sequence until a negative decision is made in block 57 . the program then increments the software bark counter , as indicated in block 57 a , and then goes to block 58 and then , as indicated in block 58 , starts a 4 second panic guard routine to prevent “ panic barking ” that can be caused by the electrical stimulus experienced by the dog , and then the program causes microcontroller 33 to go into its sleep mode , as indicated in block 59 . referring again to fig9 a , if the decision of block 76 is that no valid bark is occurring , the program goes to block 77 and causes the led corresponding to the selected stimulation level to flash twice , and then goes to decision block 78 and determines if a signal from motion detector 40 indicates that a significant neck motion is occurring . if this determination is affirmative , the program returns to the entry point of block 75 to determine if a bark signal is being received from vibration sensor 30 . if the determination of block 78 is negative , the program goes to blocks 79 and 80 and determines if a 2 second interval elapses without neck motion being detected , and if this happens , the program causes microcontroller 33 to go into its sleep mode , as indicated in block 81 . if the determination of decision block 71 is negative , the program goes to decision block 72 and determines if switch 17 is depressed . if switch 17 is not depressed , the program causes microcontroller 33 to go into its sleep mode . if decision block 72 determines that switch 17 is depressed , the program responds in block 74 by determining and storing the new desired stimulus level established by repetitive depressing of switch 17 . specifically , in block 74 the program determines if switch 17 is depressed for more than 1 second , and if this is the case , increments the stimulation level setting from the present level setting ( 1 – 5 ) to the next level setting and saves the new stimulus level setting . the routine performed in decision block 76 of fig9 a is shown in fig9 c . referring to fig9 c , in block 190 the program switches the internal oscillator clock frequency of microcontroller 33 from 37 khz to 4 mhz and then goes to block 191 and starts a 120 millisecond timer , to create a 120 millisecond window within which a “ valid bark ”, if present , is to be “ captured ”. the program then goes to decision block 192 and tests the output of the 120 millisecond timer , and after the 120 millisecond window elapses , the program goes to block 192 a and runs a subroutine to determine if the vocalization detected is a valid bark . this is accomplished by comparing the number of times the frequency of the detected vocalization is captured in each frequency range or “ bucket ” within the 120 millisecond window with a predetermined number of times for each bucket of a known “ valid bark ” frequency spectrum . the program then goes to block 193 and switches the internal oscillator clock frequency of microcontroller 33 back to 37 khz to provide low power on mode operation . the program then returns to the entry point of decision block 76 of fig9 a . if block 192 determines that the 120 milliseconds timer is still counting , the program then goes to decision block 195 and determines if there is a change in the level of the signal on leads 2 and 10 of microcontroller 33 to indicate that a pulse is present . if this determination is negative , the program reenters the entry point of decision block 192 , but if the presence of the pulse is detected , the program goes to block 196 and measures the duration of the pulse , and in block 197 increments the frequency spectrum “ bucket ” or counter which corresponds to the period ( i . e ., frequency ) measured in block 196 . the program then reenters decision block 192 and continues the process until the 120 millisecond timer elapses . the pulse referred to is generated on lead 2 of microcontroller 33 from an internal comparator therein and is provided as an input to lead 10 of microcontroller 33 , which is the “ capture and compare ” ( ccp 1 ) input of microcontroller 33 , and automatically starts a timer at the beginning of the pulse and stops the timer at the end of the pulse , so the frequency of the signal coming from vibration sensor 30 is thereby determined and can be used to select the appropriate frequency spectrum bucket to be incremented in order to acquire the frequency spectrum of the present bark signals received from vibration sensor 30 by one input of the internal comparator referred to . lead 2 of microcontroller 33 is the output of that comparator . the reference applied to the other input of the internal comparator is established by the voltage on lead 19 by the resistive voltage divider circuitry shown in fig6 - 1 and 6 - 2 . whenever bark limiter 1 enters the on mode , it checks for neck motion , and if neck motion is detected , the program executed by microcontroller 33 checks for a valid bark . if there is neck motion but no valid bark , the program checks for incrementing of the selected stimulus level by means of switch 17 . if no incrementing of the stimulus level by means of switch 17 is occurring , the program causes bark limiter 1 to go into the sleep mode . note that the off mode of bark limiter 1 is different than the above - mentioned sleep mode . in the off mode , the program checks only to determine if membrane switch 17 is being depressed to turn bark limiter 1 on . the off mode only serves as a mode that will be mostly the same as the sleep mode , in order to conserve battery life and also in order to allow bark limiter 1 to be removed from an animal in such a way that the motion sensor does not initiate an on mode . the off mode also can be used as a safety feature , in the sense that bark limiter 1 can be turned off when the collar strap is being adjusted or when the bark limiter 1 is being put on or removed from the dog so that there will be no possibility of electrical stimulus being accidentally applied to the dog . referring to fig9 d , assuming that bark limiter 1 is in its off mode as indicated in block 140 , the program enters decision block 141 and determines if switch 17 has been pressed , and if this determination is negative , the bark limiter remains in its off mode . if switch 17 is pressed , decision block 141 causes the program to enter decision block 142 to determine if switch 17 has been depressed for more than 100 milliseconds , and if this determination is negative , bark limiter 1 remains its off mode . after switch 17 has been held depressed for more than 100 milliseconds , the program goes to decision block 143 and determines if switch 17 has been depressed for less than four seconds , and if this determination is negative , the program sets bark limiter 1 to its test mode and executes blocks 144 through 168 , as subsequently explained . however , if switch 17 has been depressed for less than four seconds , the program goes to block 145 and starts a 30 second delay time with the electro - stimulus capability of bark limiter 1 disabled . the program then goes to decision block 148 and sets bark limiter 1 to its on mode . in block 144 , the program goes into its “ test ” mode , and that condition is indicated by leds 1 – 5 sequentially turning on and off so as to “ sweep ” in a sequence that indicates initiation of the self - test mode . the program then starts a 15 second timer , as indicated in block 165 , and then goes to decision block 166 which detects whether the 15 second timer has elapsed , in which case bark limiter 1 is put into its on mode , as indicated in block 148 . if the 15 second timer has not elapsed , then the program goes to decision block 167 and determines if any signal is being produced by vibration sensor 30 , and if this determination is negative , the program reenters decision block 166 . if a signal is being received from vibration sensor 30 , the program goes to block 168 and flashes led 3 for 100 milliseconds , and then reenters decision block 166 . self - testing can be accomplished by scratching membrane 6 ( fig1 ) vibration sensor 30 during the 15 second duration of the test mode in order to cause led 13 to flash in block 168 , proving the operability of vibration sensor 30 . referring to fig9 e , after a back and forth sweeping pattern of the illumination by light emitting diodes 1 – 5 , different than their sweeping pattern of illumination for initiation of the test mode , to indicate that bark limiter 1 is about to enter its off mode , the program then goes to block 161 and causes led d - 3 to flash a number of times equal to the cumulative count in the bark counter to indicate how many stimulation episodes have occurred and resulted in incrementing the stimulation counter referred to in block 57 a in fig9 b . while the invention has been described with reference to several particular embodiments thereof , those skilled in the art will be able to make the various modifications to the described embodiments of the invention without departing from its true spirit and scope . it is intended that all elements or steps which are insubstantially different from those recited in the claims but perform substantially the same functions , respectively , in substantially the same way to achieve the same result as what is claimed are within the scope of the invention . for example , a tapped transformer could be utilized and part of the primary winding current could be shunted through the secondary winding , for example , by providing a tap on the primary winding and shunting the primary winding through that tap instead of through the main terminal of the primary winding . alternatively , another winding could be provided with a stimulation level control current in the direction opposite to the direction of the main primary winding current so as to effectively cancel part of the primary winding current . another possibility for controlling current induced into the secondary winding after the peak flyback voltage of the primary winding would be to use a relay instead of transistor q 2 to shunt current from the primary winding .
an electronic apparatus for training an animal is supported against the animal &# 39 ; s skin , and includes stimulus electrodes for electrically contacting the skin . a controller including output terminals producing aversive stimulus control signals , a first switch coupled to a winding to produce therein a burst of first current pulses in response to a first signal produced by the controller and a second switch coupled to the first switch operative to synchronously shunt predetermined trailing portions of the first current pulses away from the winding in response to a second signal produced by the controller to reduce the amount of energy delivered to the winding by the switching transistor without substantially changing a peak value of a flyback voltage across the winding . the controller sets various values of time intervals during which portions of the first current pulses are shunted away from the winding in order to set various corresponding intensities of aversive stimulus .