View previous topic :: View next topic |
Author |
Message |
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Wed Jun 15, 2022 5:20 pm Post subject: Electronic Mole Scare Device :D |
|
|
Sometimes we have to do something for the house...
I bought two mole repellents cheaply on an auction site. They are advertised as follows : Quote: | So that the mole does not get used to the frequencies, time intervals and length of sound change. |
It turns out that none of this is true. You can see on one photo what is inside. It's an ordinary buzzer you can buy cheaply so the frequency of sound is constant.
I it's 404Hz where moles don't like higher frequencies.
In addition, there is built on two transistors simplest bistable interruptor so the spacing is constant and the length of sound is constant.
In the photo with the dog you can see that these deterrents need to be sealed with tape.
I didn't do it the first time and it was flooded by water... that's why I had to build my own electronic module.
The cross on the lid is to make it easier to find in the grass after some time.
I used Attiny2331, although some Tiny13 would suffice, as I have plenty of them.
As a sound transducer I used a laptop speaker because I have a whole bunch of different old laptops for parts and these speakers are small and have enclosures.
In order not to use an amplifier, I connected the speaker like a D-CLASS amplifier directly to the micro.
My deterrent draws a new frequency, a new length of sound and a new pause time. So that the mole does not get used to it.
You can experiment with the values.
Battery power consumption is as follows : During sound ~24mA and during pause 9uA
The batteries when I put them in the winter were 1.59V. After six months they are 1.48V
Nevertheless, I am considering building such a deterrent into a solar lamp with a rechargeable battery.
Now the effectiveness. The moles have moved to my neighbours
Code: | $regfile = "attiny2313.dat" ' the used chip
$crystal = 1000000 ' frequency used
$hwstack = 40
$swstack = 0
$framesize = 24
$baud = 38400
Config Portd = &B0000_1100 : Portd = 255 'D2 &D3
Sw Alias Pinb.0 : Portb = 255
Dim Period As Word , Adc_val As Word
Dim On_off As Byte , Sound_on As Byte , Sound_time As Byte , Idle_time As Byte
Dim T0_ticks As Byte , 100ms As Byte
Config Timer0 = Timer , Prescale = 1024 , Compare_a = Disconnect , Compare_b = Disconnect , Clear_timer = 1
Compare0a = 96 '100ms @1MHz/1024
On Compare0a Timer0_isr
Enable Compare0a
Set Acsr.acd 'disable AD
Stop Watchdog
Enable Interrupts
Do
If 100ms = 0 Then
100ms = 9
If Idle_time = 0 Then 'we reboot or its time
Sound_on = 1 'sound will be played
T0_ticks = 0 'reset time counter to be compared
Do 'draw new time for pause
Idle_time = Rnd(99) '99 maximum
Loop Until Idle_time > 9 '9 minimum
Else
Decr Idle_time 'countdown
End If
End If
Do 'draw freq everytime for better randomness
Period = Rnd(60)
Loop Until Period > 3
Do
Sound_time = Rnd(30) 'draw period for sound
Loop Until Sound_time > 15
'-------[PLAYING HERE]--- (24mA)
While Sound_on = 1 'this flag will be cleared in ISR
Portd = &B0000_1000
Waitus Period
Portd = &B0000_0100
Waitus Period
Wend
'------------------------
Portd = 255 'playing end
Config Powermode = Idle 'go to sleep (~9uA)
Loop
End
'ISR is needed to jump from While-Wend to measure time
Timer0_isr: '100ms
If Sound_on = 1 Then
Incr T0_ticks
If T0_ticks = Sound_time Then 'compare with drawn time
Sound_on = 0
End If
Else
If 100ms > 0 Then Decr 100ms
End If
Return |
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5922 Location: Holland
|
Posted: Wed Jun 15, 2022 7:14 pm Post subject: |
|
|
nice project EDC . Thanks for sharing.
Yes the house is a source for many projects.
yes the advertisement is different than the device, that happens a lot. in fact i am amazed by the fact that some ads are even allowed since they never can bring what the promise. but that is another story.
Quote: | Now the effectiveness. The moles have moved to my neighbours Very Happy |
haha, yes so a job well done. _________________ Mark |
|
Back to top |
|
|
mmarlette
Joined: 30 Nov 2007 Posts: 311 Location: Delano, MN
|
Posted: Thu Jun 16, 2022 1:03 pm Post subject: |
|
|
EDC,
VERY nice project! Have a mole issue as well.
Can you share the Bill of Materials / project files for case, PCB etc?
Would like to give your device a try!
If not that is ok, I understand, and thanks for sharing!
Regards,
Mark |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Thu Jun 16, 2022 1:09 pm Post subject: |
|
|
It cost me nothing.
Speaker i have already from old laptops, uC I got from colegue who stop som production so I have more than 20 of it more
Batteriess are quite expensive so my next design will be on LiOn akku which I also have plenty. This should work on 3,6V I think.
For enclosure you can use even butter box (after use) |
|
Back to top |
|
|
mmarlette
Joined: 30 Nov 2007 Posts: 311 Location: Delano, MN
|
Posted: Thu Jun 16, 2022 1:12 pm Post subject: |
|
|
Even butter...opps better... hahaha, thanks for the info!!! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|