Help Grandma Hear Her Doorbell! - Page 1
Forum section: electronics / general

author: Salome2
author_rank: Regular Contributor
timestamp: September 11, 2024, 04:31:19 pm
content: Please give me your ideas on how you experts would solve this problem.I am getting stuck on how to recognize the doorbell waveform to ring an extended doorchime.(Should I post this as a new post?-------------------------------------------------------------------------------------------Granny is nearing 87 and nearly deaf as a loaf of bread.Her helper persons arrive at her apt building but often cannot get in because Granny can't hear the existing doorbell or even her Smartphone. She can't sleep with her hearing aid on and often struggles to get them properly on her ears!Her doorbell works 100%, it is part of an intercom in the corridor of her apt, about 30-feet from her bedroom door, 70-ft to the kitchen. I would not like to try to mount the new doorbell ringer switch outside at the doorbell panel or tamper with in anyway the existing intercom/doorbell.So I bought a much louder wireless door chime that works well, Granny says she can hear it well when it is placed next to her bed or even in the kitchen. It's even loud enough there for her to hear with the radio on.Now, all I need to do is detect the old doorbell ring to ring the new extended distance door chime.To do this, I need to build a circuit use as little power as possible to continuously monitor and detect a doorbell ring by using a small electrolet mic that will be glued to the doorbell/intercom near the front door of her apt.I recorded the existing doorbell chime on my IPhone and played the sound back to the electrolet mic and got a good scope picture of the doorbell chime waveform.I chose a PIC16F18456 chip to detect the doorbell sound signature because I have it on hand. This chip can run its 12-bit A2D peripheral while in sleep mode and the ADC has threshold detection to trigger an interrupt to awaken the MCU up at a set threshold value.The idea here is to use the least amount of battery power possible, so that it would take many months to a year or so to replace/recharge the battery powering my design.The electrolet mic uses only 133uA and the A2D by itself only uses 160uA running in MCU sleep mode.I can use, for instance any small footprint battery, but I do have a 23A 9-V Lithium Roundcell 300mAH and also a 3.7V 2200mAH flat SmartPhone battery also on hand.What I see viewing the chime waveform at the mic output:Doorbell tones are bursts of a cone-shaped waveform showing a distinct chain of a 2-mSec period waveform, its highest amplitude peaks every 2-mSec (even with an async 4-th harmonic mixed in) to make a chime sound. Its just a continuous distorted 2-mSec sinewave.The ring waveform chime is a continuous stream of a repeating 2-mSec waveform that slowly decays in amplitude until the 1/2 amplitude point is reached in about 1.8-Secs followed by a 300mS pause.Two doorbell tones each button-press. Holding down the front door button keeps repeating the doorbell signal.What can I write in embedded C code to accurately detect only the original ringtone without false triggering or missing any doorbell ring? With the lowest power used?

author: shabaz
author_rank: Frequent Contributor
timestamp: September 11, 2024, 05:28:06 pm
content: Hi,Personally I would not even bother with a microcontroller.I'd consider (say) a BJT amplifier for the electret mic, followed by an integrator (could even be as simple as a diode rectifier and a capacitor with resistor across it), or use a low-power dual op-amp for it all perhaps. And a CMOS Schmitt trigger gate.The above would be aimed at just detecting any loud noise that lasts long enough for the Schmitt trigger to fire. If the mic is placed very close to the existing chime speaker (could experiment with a tube or something around the mic), then that should be the loudest sound picked up anyway.

author: AVI-crak
author_rank: Regular Contributor
timestamp: September 11, 2024, 07:33:57 pm
content: An anecdote from childhood:Petyka asks Vasily Ivanovich for money for experiments. Three days later, Vasily Ivanovich finds him drunk in the barn, a notebook with notes lying next to him:“Experience one: take a cockroach, tear off two legs, whistle, the cockroach runs away.Experience two: take a cockroach, tear off four legs, whistle, the cockroach runs away.Experience three: tear off all the legs of the cockroach, whistle, the cockroach in place.Conclusion: a cockroach without legs cannot hear.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 11, 2024, 08:11:51 pm
content: Quote from: AVI-crak on September 11, 2024, 07:33:57 pmSounds like half of current scientific publication.

author: Salome2
author_rank: Regular Contributor
timestamp: September 11, 2024, 08:52:04 pm
content: Tovarishch AVI-crak, Is cockroach Ukraine?Shabas..is your circuit for detecting cockroach also?Your approach is maybe a possible solution, and my comment is not to offend you, but to add some humor.Your circuit probably has many uses and it lacks power usage calculation and circuit detail, and the devil is in the details. I think a MCU-based solution is viable and can be precisely tuned to detect the first bell ring. From what I guess, the simpler no-MCU approach would require tuning.I would have to hire a cockroachto go down and keep pressing the bell button to best test and tune your idea to work without fail.

author: shabaz
author_rank: Frequent Contributor
timestamp: September 11, 2024, 08:56:51 pm
content: @Salome2How is that helpful? I suggest you delete your comment.

author: shabaz
author_rank: Frequent Contributor
timestamp: September 11, 2024, 08:59:19 pm
content: Quote from: Salome2 on September 11, 2024, 08:52:04 pmReported.

author: Benta
author_rank: Super Contributor
timestamp: September 11, 2024, 09:05:49 pm
content: @Salome2, why make the doorbell louder?A standard solution for hearing-impaired people is a Flasher, which is easily installed.In fact, you'll probably get it installed for free, if you file a request at the council (or wherever in Sweden).

author: Benta
author_rank: Super Contributor
timestamp: September 11, 2024, 09:13:40 pm
content: Quote from: shabaz on September 11, 2024, 08:56:51 pmI have to agree. First Salome2 asks a question, shabaz gives a serious answer, then a russian troll jumps in and Salome2 plays along.Very strange behaviour indeed. Røvsvenskere!

author: Salome2
author_rank: Regular Contributor
timestamp: September 11, 2024, 09:15:41 pm
content: Benta, Thank you for reminding me about my Troll Subsestence but I enjoyed the Russian tease! I deserve it! I enjoyed it!Your light solution, this may be a solution, this idea is certainly a flash in the pan, but a flasher cannot be seen by a sleeping person or while in another room.Grandma is prone to be napping in the morning if she is forced to wake up. She usually only begins her day after 1:30 pm when she usually goes to bed by 10 pm.Unfortunately, she is very traumatized by having to be awake so early in the morning and she has trouble trying to staying awake to welcome her helper people who by their job schedule will choose to call on her at 8-am or even at 11-am ..so she often falls back to sleep. She is a light-enough napper to be easily awoken by a loud doorbell chime ring.Asking the commune to help with a flasher or any other special help can take months for someone to remedy a problem.

author: Benta
author_rank: Super Contributor
timestamp: September 11, 2024, 10:49:22 pm
content: In that case, why not a wrist/ankle vibrator? (Smartwatch, perhaps?)There are so many possibilities out there apart from just turning up the volume.

author: tggzzz
author_rank: Super Contributor
timestamp: September 11, 2024, 11:46:26 pm
content: It might be useful to consider another "use case": granny can't get to the door because of any/all of being too slow, has fallen, has pressed an "emergency assistance" pendant.In the UK I believe this particular device has no insurance implications, since it is regarded as being as good as the traditional Yale door lockhttps://keysafe.co.uk/products/supra-c500-pro-key-safe

author: Salome2
author_rank: Regular Contributor
timestamp: September 12, 2024, 02:12:19 am
content: tggzzz, this is not about my inquiry here. Me and Granny have made up our minds on what to do. Don't confuse us with facts.Benta, thanks again for your advice.The idea about an enhanced doorbell hack to solve this problem works best because it is non-intrusive. It doesn't require Granny to wear an arm or ankle bracelet to bed like she was a closely monitored parolee. My solution should be quickly realized without more research, while a Commune solution may take weeks to months to send someone to try to solve this problem in a way that is not at all acceptable to Granny.With my idea, Granny doesn't have torememberto place or wear any device. This idea will not work for her. She suffers from poor cognitive capability associated with her age and has trouble now understanding how even very simple things work and also she has trouble remembering things. I have spent hundreds of hours showing her how to do things and she now cannot remember anything or even me showing her how to do things.She would easily fall asleep and forget to have her head turned(like if she was lying down in bed or fell asleep at a table) to always face a flashing light while she sleeps.Other solutions, like "Key Safe" require every helper person to have an additional special gadget and this is problematical with her and some of her helper persons. She has a pill-lady to make sure her pills are arranged in labeled boxes. She has a cleaning lady to help her with cleaning. She has a shopping assistant lady that helps her order food and sundries once a week. She has food deliveries once a week.Even if each helper person had their own key to open the front door and the door of her apartment, they would like to know that when they climb up five flights of stairs that someone is home when they have to break in her apt.I have successfully already tried the extended loud chime alarm solution with her andshe is very picky, but likes this idea, she easily notices it.This is what works for her to allow her to hear doorbell rings.This idea is not a practical design in production product development, it is just a one-off solution to help Granny.It is certainly overkill for a MCU to be used in this way, and while this problem can be solved with many other alternative solutions, this is not what I am posting about.I am asking for help about solving this doorbell problem using a MCU, not soliciting what would seem as more attractive solutions, nor I do not want to discuss the aptness of finding alternative commercially and economic alternatives.Me and Granny have already made up our minds that my idea works!Please, i am just interested in figuring out how to recognize the existing doorbell ringing by writing code to precisely and with the lowest power usage, reliably extend her doorbell's range.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 12, 2024, 02:41:04 am
content: So the core of the matter is to develop sound recognition for the particular sound of the existing door bell, while preferably be as immune as possible to any other kind of sound, I suppose.There are several ways of tackling this, one would be to start with the recognition problem using a PC and develop this on PC. Make several recordings of the door bell and analyze them with Python or your prefered language, then see how you can adapt this to a MCU (so it would have to be relatively simple). Use simple DSP algorithms.One other approach, even if possibly overkill (or not?) could be to use some MCU able to run Tensorflow, and generate a model for recognizing this particular sound. That seems doable, but if you're not familiar with Tensorflow, there'll be some learning curve. Benefit, it can be called "AI" and will teach you some of that, if you're not familiar yet.Another option would be to consider one of those "voice recognition" ICs, which may work well enough for recognizing some other sounds, like this:https://www.wtsoundic.com/voice-recognition-ic/Although, the simplest approach is probably to detect activity of the door bell by placing a device nearby (doesn't need to be connected to it) that would sense some EMI that is probably emitted by it when it rings.You could start by experimenting to see if it's workable: place some coil nearby the door bell unit, connect it to a scope, make the door bell ring and see if you can detect something useful. If so, you can then design some conditioning amplifier and link that to a MCU, if you want flexibility, or it could just trigger some other device that produces a loud sound, or flashes of light, or something.Hope there's an idea that may help.

author: Salome2
author_rank: Regular Contributor
timestamp: September 12, 2024, 02:57:09 am
content: SiliconWizard..Thanks a million for responding to my posted topic!The original ringer is part of an intercom/doorbell/headset/door-opening solution inside and near Gramma's apt front door.It creates the doorbell ring using the loudspeaker within..no EMI.I have no experience with Tensorflow and no experience with AI. I have tried to understand the advanced post-calculus concept of tensors, without any success!However, I have already found a way to pick up the existing doorbell ringing sound using a small electrolet mic and it works well to output about .5 to 1V P-P signal ready to be precisely detected by a nearby black box that has the battery powered MCU that is wired to the new doorchime hand dongle switch to trigger the new very loud door chime at a great distance from the door. I have already posted a description of the old alarm sound waveform.Besides, my goal to have the lowest power consumption to achieve long battery operation would not be possible at this day and age to use AI to solve this problem. Most importantly, AI would require much more battery power. The 16F18456 chip I found to use doesn't even have a built-in hardware multiplier.Are we adding overkill to overkill?I do have many years of playing around with C to write embedded code to do various things. Any idea of using AI would require me to study for mths to become a beginner having any ability to use this knowledge.By that time, Granny may have shuffled off her mortal coil..so to speak.

author: ledtester
author_rank: Super Contributor
timestamp: September 12, 2024, 03:16:54 am
content: A couple of ideas...1. Perhaps use a piezo as the microphone. If it is in contact with the bell or the bell enclosure it might better discriminate the bell versus other noises.2. To conserve even more power maybe put the MCU into deep sleep and have it wake up with a circuit like this:http://www.discovercircuits.com/DJ-Circuits/hourmeter.htmA CMOS gate requires just a few microamps to operate.

author: Salome2
author_rank: Regular Contributor
timestamp: September 12, 2024, 03:34:23 am
content: ledtester, I already have an electrolet 1/2-in diam mic that works well to pick up the original doorbell sound.I don't need to try to find and mount a piezo device.The 16F18456 I have in stock sleeps in extremely low power mode, while its 12-bit ADC peripheral can stay alive and the ADC module allows continuous ADC operation and has a threshold determined interrupt to wake up the rest of the MCU.

author: ledtester
author_rank: Super Contributor
timestamp: September 12, 2024, 04:46:24 am
content: I'm just throwing out some other ideas. Piezo disks are very commonplace -- almost anything that makes a beep these days does so with them, e.g. kitchen timers, electronic wristwatches, smoke detectors, window alarms, ...My understanding is that piezo disks are much more sensitive to vibrations transmitted by physically touching the vibrating body than via through the air. It might be possible for you to detect the bell ringing by simply seeing if the vibration detector circuit I linked to above is triggered for more than a certain length of time. Vibrations from the floor and walls will reach the piezo but they will probably not be as intense or as long as the what the bell produces.As for going the DSP route, perhaps you could identify salient frequencies in the bell's sound and use the techniques in this post to detect them:https://www.eevblog.com/forum/rf-microwave/looking-for-a-receiver-for-5-khz/msg5501425/#msg5501425

author: Halcyon
author_rank: Unknown
timestamp: September 12, 2024, 08:13:08 am
content: Quote from: shabaz on September 11, 2024, 08:59:19 pmI don't understand the issue?

author: wofritz
author_rank: Contributor
timestamp: September 12, 2024, 08:14:20 am
content: I use the attached simple circuit to connect a cheap wireless door bell to my existing old fashion 8V AC door bell.

author: Salome2
author_rank: Regular Contributor
timestamp: September 12, 2024, 11:08:36 am
content: wofritz, Thank you. your idea is simple, fully meets the requirement for an intrusive wiring way to solve this problem if I was dealing with a legacy wall AC powered HV doorbell circuit. This certainly not the case with me.But as I mentioned in my post, I don't want to have to take a risk in dissembling the intercom/bell/door-opener Sw/Handset device and play around with the wiring within.So, this leaves me with a solution involving a small mic to be adhesively attached to the intercom etc box and already I can see this idea works fine.The problem then only remains to pgm the MCU to precisely and accurately detect the original working first bell ring audio signal without failure.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 12, 2024, 09:06:49 pm
content: To be fair, if your microphone is right against the intercom box,the sound it'll pick up from the door bell should be much, much higher in amplitude than anything else. So simple thresholding of the RMS value (can be just a simple average of the rectified signal here) may be perfectly fine.But as it probably produces specific frequencies, further analyzing the signal to make reasonably sure it's the door bell can be added to the thresholding.If you use a not-too-competent MCU, rather than using a full FFT, you can use the Goertzel algorithm to detect one or two frequencies of interest to discriminate the signal with a pretty reasonable accuracy. It's lightweight.https://en.wikipedia.org/wiki/Goertzel_algorithm

author: vk2jdh
author_rank: Newbie
timestamp: September 15, 2024, 08:20:04 am
content: This is the simplest solution , no processor needed, comes in a kit.https://learn.sparkfun.com/tutorials/sound-detector-hookup-guide

author: Salome2
author_rank: Regular Contributor
timestamp: September 15, 2024, 08:50:59 am
content: SiliconWizard, using FFT or Goertz algorithms seem horribly too complex for me. I ain't that smart!Horribly too complex for me. I ain't that smart as far as I can C!I will try My Bubba's Method instead.------------------------------vk2jdh: About the recommended soundboard, Sparkfun says:We do not currently have an estimate of when this product will be back in stock. Notify MeNote: If this item is available for backorder it is subject to price changes at any time; additionally, we are unable to guarantee time frame for shipping or availability.Grammy can't wait!Another issue is power consumption and the ideal is the least battery drain, the better. No mention of current use for this board is given.My ideas so far is to simply measure the raw waveform to identify a chime sound as different from voices or other noises.If I use AC coupling to directly feed an 12-bit ADC input on the 16F18456 if I could try to set the built-in ADC threshold interrupt feature to trigger at least 50 mV above this baseline.Almost all of the time the MCU is in deep sleep mode consuming only a few uA until a threshold in signal amplitude is reached.The ADC module in continuous run mode awakes the MCU by the built-in ADC threshold interrupt feature.This means the MCU uses only about 160uA until an ADC threshold interrupt signaled by any sound exceeding 200mV awakes the MCU to begin further analysis of the incoming waveform.If I take the continuously running ADC to detect the start of a doorbell ring signal, then I can start a MCU counter to delay until the expected end of the tone burst and then I can take several time spaced ADC readings to verify that the output expected amplitude falls back again to around 30mV P-P(the noise floor) for the next 120mS or so.The period of a doorbell burst must match the measured period seen on the scope. If this match is detected, then the MCU will trigger the new chime dongle hand switch to achieve several time-spaced simulated presses using an optocoupler and then the new chime will be heard and Grammy will answer the door. The MCU should trigger the chime signal perhaps up to 3 to 4 times to make sure Granny hears it.I could go further, and after detecting a candidate signal, measure zero-crossing of the mic signal to detect the number of 2-mS intervals between peaks and look for a majority of 2-mS intervals (versus non 2-mS periods) between baseline biased level zero-crossings.The programming problem right now is learning how to turn off everything to get the MCU to only activate the ADC module in deep sleep and how to again awaken the MCU when a threshold ADC interrupt starts the apple cart rolling again.There are so many registers to set!Must also decide what is the optimal Fosc to use for the least battery use and how to deal with using a possible 4.2V li-Ion as an unregulated power source and yet have a consistent reference for the ADC module without the battery use penalty of using a LDO 3.3V regulator as the ADC positive reference. The MCU FVR might be a solution here at 1.024 or 2.048-V.

author: JoeyG
author_rank: Regular Contributor
timestamp: September 15, 2024, 10:32:02 am
content: [Piezo+high impedance threshold+mcu GPIO wakeup] would probably have much less current than [microphone + analog circuit + mcu ADC]Both still connect to mcu but analog circuits tend to have much more current draw overall.Just my 2 cents worth

author: Salome2
author_rank: Regular Contributor
timestamp: September 15, 2024, 10:42:55 am
content: JoeyG: I agree, but to get this project working, I will use the mic I have on hand. I don't have any piezo's.

author: ledtester
author_rank: Super Contributor
timestamp: September 15, 2024, 02:30:41 pm
content: Quote from: Salome2 on September 15, 2024, 08:50:59 amMy advice is to first get the detection algorithm working and then worry about power consumption - which is something we definitely can help out with.

author: Salome2
author_rank: Regular Contributor
timestamp: September 15, 2024, 02:43:38 pm
content: E Z 4 U 2 say.

author: Postal2
author_rank: Frequent Contributor
timestamp: September 15, 2024, 04:39:35 pm
content: I have experience with a deaf grandmother and a doorbell. I used a telephone bell from an ancient telephone in an ebony case with huge bell cups.Perhaps this knowledge will help you choose the timbre.

author: SteveThackery
author_rank: Super Contributor
timestamp: September 15, 2024, 05:33:37 pm
content: Back in the 1980s I designed a device for almost the exact same thing: in my case the detection of a telephone bell.The exact details escape me, but it was all done without a microcontroller in sight. A crystal microphone was placed near the phone (crystal because they have a usefully high output but are "peaky" in their response, which is ideal for the job).The microphone signal was amplified and put through a bandpass filter centred around a frequency that was very strong in the bell sound but above normal voice pitch (maybe 1kHz or 2kHz - I can't actually remember).The next stage was to convert the filtered sound signal into DC. I used the signal to trigger a retriggerable monovibrator of some kind, such that while the bell was ringing it produced a DC output signal, which disappeared almost immediately the bell stopped ringing.This signal went into a very basic RC integrator, the output of which ramped up over around half a second (I think). After half a second the DC voltage was enough to trigger a 555 timer, set as a monostable which - via a relay - rang the repeater bell. The 555 timer allowed the repeater bell to ring for as long as necessary to get attention.The bandpass filter stopped the circuit being triggered by normal speech sounds or dog barks. The integrator in the signal path avoided false triggering on very brief, but wideband, sounds such as a clap or a door slam. The bell sound had to be of sufficient volume, in the correct frequency range, and sustained over a minimum period.The circuit worked perfectly and never suffered a false trigger (that I know of).

author: Salome2
author_rank: Regular Contributor
timestamp: September 16, 2024, 02:24:40 am
content: ledtesterAt last I've got my old IPhone to transfer files to my PC.Looking close at the picture attached, you can see that my previous description of the waveform were about as accurate as recent reports of immigrants woking local yokel's dogs.In this photo, the time/div is 500mS/div and the amplitude is 100mV/div. The IPhone sound playback is low in volume.I might expect that attaching this same mic to the existing doorbell contraption would produce a much larger mic output but I donno, didn't bring my big scope with me when I recorded the doorbell rings! Might be two pushes or just holding down the outside push-button.Note the short no-tone silent period between chime bursts. I think this snapshot shows two outside doorbell pushes. I can't be sure because the cockroach I hired didn't quite follow my requests to ring shouting out the window.

author: Salome2
author_rank: Regular Contributor
timestamp: September 27, 2024, 02:27:15 pm
content: Please give me your ideas on how you experts would solve this problem.I am getting stuckon how to recognize the doorbell waveform to ring an extended doorchime.My idea was based on sampling the waveform picked up by the mike but the 12-bit ADC of pic16F18456 is not fast enough to do this!(Should I post this as a new post?

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 27, 2024, 07:44:24 pm
content: Quote from: Salome2 on September 27, 2024, 02:27:15 pmAccording to the datasheet, the ADC of the PIC16F18456 can sample at up to 140 ksps. How can it be not fast enough? Puzzled.

author: Salome2
author_rank: Regular Contributor
timestamp: September 27, 2024, 09:15:47 pm
content: SiliconWizard, thanks so much for your help.Here's my under-developed understanding, so far:1)For the ADC to run in sleep mode, ADC Clock must only use slow FRC which results in not the fastest ADC conversion speed possible. The min Tad period is >500nS and the FRC clock period is 1-6 uSec(2-uS ?). An ADC 12-bit conversion takes 25 Tad's or so when including minimal acquisition time.2)I I may be my wrong about "too slow" when my strategy was to write code to compare the ADRES to a threshold value indicating a possible start of a bell tone burst. This assumes I can start an ADC cycle at the right time to trap this event.The optimal goal would be to have three ADC readings around the peak of the waveform such that M1 < M2 >M4 where M1,M2 and M3 are as close together as possible.3)I am still trying to understand the operation of this complex ADC module, which seems by design to be optimized to precise very slow events most accurately and also allow easy touch-control.4) I am now aware the ADC CALC feature allows a threshold comparison to set an interrupt if Threshold Upper Level (ADUTH) is compared to an ADC result(but this seems to occur during the PRECHARGE phase of at least a second conversion??).Perhaps I can manually assert ADRES from the scope display,5) My idea is to trap the amplitude of a bell tone burst by catching the maxima of the first pulse by ADUTH of a possible tone burst which is always at the beginning of a stream of a 2-mSec continuously repeating pattern, but the maxima of the first pulse transition only lasts at most a few tens of uS but this maxima would be hard to catch with a slow A2D attempting multiple conversions.From looking carefully at my scope waveform:Once the magnitude of the very start of the first tone burst pulse is known (at a threshold of ~50mV amplitude), I can see whether I am trapping a burst bell event or just noise by starting a counter that then takes an A2D readings next at the known end of the tone burst(at ~700mSec), and at which point the bell sound waveform is is followed by a 130mSec baseline(no-sound output)level before the next bell tone burst. Always two bell bursts per front button push.If these events match I can assume an automatic second tone burst must follow and when I repeat this test on the second burst, know that I can be sure enough that I have succeeded in trapping a tone-burst event and trigger a remote wireless chime receiver box.That's my plan..am I barking up the wrong tree?Perhaps best to use one of the MCU's comparators while MCU is in sleep mode instead to best catch the start of a possible tone burst?

author: Gyro
author_rank: Super Contributor
timestamp: September 28, 2024, 11:19:58 am
content: Are you doing this as an educational / coding exercise?If not, you simply need to amplify and clip the microphone signal input. You could then just feed it into a GPIO (or ADC if you really prefer) and verify the time between transitions (+/- a few %) with a detection threshold of a however many cycles (you have plenty). You seem to be making heavy weather of it.

author: Salome2
author_rank: Regular Contributor
timestamp: September 28, 2024, 01:36:38 pm
content: Gyro, thanks for this idea.No education for me! Ignorance is bliss. I'm doing it all for Granny.A need to clip the mic signal is something I haven't considered useful.I am interested in ID'ing a valid belltone burst waveform versus just noise pickupand the waveform is a mixture of at least two frequencies with different amplitudes, but would clipping and counting transitions help me by yielding a consistently singular constant sum of all transitions result over varying battery voltages and mic amplitude?When you introduce the idea of clipping, then low noise levels will be able to very often trigger a 700 mS count of transitions, and this meansa lot of battery use. To compensate for noise sensitivity, I would have to set a threshold for clipping somewhat higher than most noise and this threshold would have to be adj. for mic distance from the intercom to the black box, and also adj. for battery voltage, but this must not result in noise rejection so high as to not always detect a doorbell burst waveform.It would be a circuit design challenge to design a very low power circuit to serve opposing goals of having a high noise threshold and yet have high amplification necessary to achieve clipping over a range of battery voltages(unless the undesirable adding a micropower comparator chip?) Using an external or a built-in comparator of the MCU would mean the MCU is to be awake to do the data processing.With my current idea, the first test of ID'ing that fails ends the bell tone event trapping and MCU goes deaf as Granny and beddy-bye again for the CPU for about 700mS. This deaf period still allows a second bell tone burst to be detected after the CPU first having a nap.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 28, 2024, 06:55:43 pm
content: One simple approach would be to just implement a crude envelope detector, threshold the envelope to get the width of the tone bursts and discriminate against just that, without any frequency analysis. The probability that just random noise would trigger it is pretty low.

author: tooki
author_rank: Super Contributor
timestamp: September 28, 2024, 07:25:08 pm
content: This discussion reminds me of a related challenge, namely that of fire alarms for the deaf. Many people simply sleep through flashing light, especially if sleeping face down. (Not to mention the existence of people who are deaf and blind.)One really interesting solution, which doesn't appear to be available for sale anymore, is the wasabi-based alarm, which sprays wasabi essence into the air. (Our sense of smell is actually disabled while sleeping, so we cannot smell smoke as such. But wasabi is an irritant, and apparently a very effective one.)https://blog.nms.ac.uk/2018/08/29/why-would-you-want-a-wasabi-fire-alarm/https://www.popularmechanics.com/technology/a7253/our-favorite-ig-nobel-the-wasabi-fire-alarm/With that said, bed shakers are a perhaps more sensible soundless alarm for many users.

author: tggzzz
author_rank: Super Contributor
timestamp: September 28, 2024, 07:56:46 pm
content: Use one of these existing commercial devices:https://www.connevans.co.uk/catalogue/215/Doorbells---chimes---wirefreeI used something similar, but used my existing button to power the radio button, which then caused the alerting device to sound and flash. Yes, I did add a couple of wires to my existing button.

author: Salome2
author_rank: Regular Contributor
timestamp: September 29, 2024, 12:17:06 pm
content: tggzzz, I tried to get cockroaches to shake Granny's bed when the doorbell rings, but as hardworking as they are, it does no good when she is in the TV room napping. She would go postal over a wasbi solution! I would get my head handed to me if I tried wasabi spray..Granny, like a lot of Scandinavians, don't like any hot sauce!Silicon Wizard, After reading the specsheet for hours, I am just now getting to try getting some of the PIC16F18456 peripherals to work.I will try to make an envelope detector, but right now, I am relaxing at bit after so much study of the specsheet and I am sitting on the front steps waiting for the mailman to come by to give me a few hints.

author: Bryn
author_rank: Regular Contributor
timestamp: September 29, 2024, 12:42:43 pm
content: What's this talk about cockroaches all of a sudden? Yes, I saw one nonsensical post about it and I'm surprised it had caught on... and I'm as equally surprised that the OP went along with itAnyway, good luck with making the new doorbell for her. I'm sure she'll appreciate it in the long run

author: tggzzz
author_rank: Super Contributor
timestamp: September 29, 2024, 12:53:47 pm
content: Quote from: Salome2 on September 29, 2024, 12:17:06 pmOK; you're a troll.Anybody with a tiny bit of imagination would think of either getting one for each room or moving one between two rooms.

author: Salome2
author_rank: Regular Contributor
timestamp: September 29, 2024, 01:55:28 pm
content: The problem with some of you guys..no sense of humor!I am trying to get the PIC16F18456 comparator to function as I would want to catch the peak amplitude from the amplified mike to trigger the PIC16F18456 comparator, but so far no luck. I connect thecomparator minus input to FVR Buffer set at 2.048Vand feed the amplified VCol DC coupled output of the mike amp directly to the comparator + input, but when I feed the + input with a 1.5V Peak signal, nothing happens.Only if I bang the small mike with my finger tip nail do I see a comparator spike from 0 to Vdd.I have a 200K pot connected from ground to the base of the 1-transistor pre-amp andhave set VCol at 1.8V quiescent, so I would expect a 1.5V swing to trigger(which I cansee clearly on the scope) the comparator when the inv. input is held at 2.048V by the FVR.The Vcol swing should certainly trigger the comparator.I have verified the waveform to be as described at AN3 comp + input.I am monitoring the comp 1 output mapped to RC5 TRISC5=0 ANSEL5=0 so RA5 is set as a digital output.Here's my setup so far!//Note. Normal MCU PIC16F18456(no sleep, etc) operation with Fosc=16MHz VBat=4.2V. MCU Vdd=VBat//-----------------------------void init_Cmp1(void){FVREN=1; //Enable FVRCDAFVR1=2; //FVR=2.048V to comparatorCM1CON0bits.EN=1; //Enables Comparator 1CM1NCHbits.NCH=6; //Comp Neg Inp connects to FVR Buffer 2CM1PCHbits.PCH=1; //Comp Pos Inp connects to CM1IN1+ AN3CM1CON0bits.POL=0; //If C1VP>C1VN the output=1CM1CON0bits.OUT=0; //Noninverted polarityCM1CON0bits.HYS=1; //25mV hysteresisCM1CON1bits.INTP=1;//Interrupt triggered by 0-->1C1IE=0; //Disable Comparator 1 IntTRISA3=1; //Comparator + input connected to RA3/AN3ANSA3=1;RC5PPS=0x11; //Comparator 1 output mapped to RC5}//---------------If I connect the cmp neg inp to an external pin and adj. this pin voltage with a pot adj. over 0-5V, I can find a cmp Vneg inp ~<2V setting that works!Something is wrong with the FVR or connecting the cmp Neg Inp to FVR,I checked my settings several times against as shown above, but cannot find anything wrong!Can anyone tell me what's nfg with using the FVR?Note: I realize you would find it much more easy to help me if you had the 16F18456 specsheet, but its 9-meg!..too big to attach!

author: Salome2
author_rank: Regular Contributor
timestamp: September 29, 2024, 02:35:51 pm
content: tggzzzI have already installed(put on a table in the bedroom and kitchen)wireless doorchime receiversand of course, they work perfect when Imanuallypush the wireless hand switch..but the point is, the whole idea is get my black box MCU gizmo to detect the existing doorbell sound and trigger the hand buttondoorchimeswitch using an optocoupler when it detects a doorbell ring.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 29, 2024, 08:14:42 pm
content: Quote from: Salome2 on September 29, 2024, 12:17:06 pm

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 29, 2024, 11:57:59 pm
content: Quote from: Salome2 on September 29, 2024, 01:55:28 pmSorry if I'm missing something here as I haven't looked at the datasheet in details, but if you set the threshold to 2.048V (- input), how can the comparator trigger with a 1.5V peak signal (+ input)?

author: Salome2
author_rank: Regular Contributor
timestamp: September 30, 2024, 02:08:09 am
content: SiliconWizard, Thanks for appreciating my sense of humor!The output of the mic 1-transistor amp is direct coupled to the Cmp Neg Inp so the 1.5V P-P max signal has a d.c. baseline that can be set from 0 to Vbat and presently set at the transistor's collector V of ~1.8V.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 30, 2024, 07:30:29 am
content: Ok then.I had to take a more detailed look at the datasheet for the register definitions and take a guess from your posted code and the way Microchip usually defines registers in their header files.So, my best guess at this point is with the initialization of the FVR buffer. First two lines:Code:FVREN=1; //Enable FVRCDAFVR1=2; //FVR=2.048V to comparatorMicrochip has those confusing definitions (and multiple ways of accessing register fields, probably for legacy reasons). I recommend using a consistent way of accessing those bit fields - will make your life easier and avoid some mistakes. But I'm guessing that you may have found this excerpt above in some example code.My suggestion is to change the two above lines to:Code:FVRCONbits.CDAFVR = 2;FVRCONbits.FVREN = 1;(hopefully those are correct - I don't have the compiler installed or at least the support header files for this MCU, so if that doesn't compile, you'll probably figure it out easily. For instance, if the 'FVREN' field does not exist, try just 'EN' instead.)The most probable reason this would work, but not your 2 lines above, is with the "CDAFVR1=2;" line. From what I get (from usual Microchip "legacy" stuff), CDAFVR1 is (again, most likely, but not 100% sure) bit 1 of the CDAFVR field of the FVRCON register, and not the whole CDAFVR[1:0] field (there must be a definition for CDAFVR0, which will confirm that). So if you assign 2 to it, it's the same as assigning 0 to bit 1 (2 = 0 mod 2). And that's the same as having CDAFVR[1:0] = 00 (as I suppose the reset value of bit 0 is also 0), which is "buffer off".And, I prefer enabling the FVR after setting the gain, but that wouldn't change much in practice.

author: Mia Barn
author_rank: Newbie
timestamp: October 02, 2024, 07:24:15 pm
content: Hey, what about using a PIC16F18456 microcontroller with microphone and battery?i dont know if it will solve the issue or is it what you are searching for but I've seen a project similar to your grandma's helping project so I thought it would be helpful to share it with you.

author: Salome2
author_rank: Regular Contributor
timestamp: October 03, 2024, 03:14:26 am
content: SiliconWizard, thanks for your input onwhy the FVR is not connecting to Cmp Neg Inp.Maybe seeing the datasheet will help!Perhaps a register value should be represented as, i.e.CM1NCHbits.NCH=6; //Comp Neg Inp connects to FVR Buffer 2 //maybe doesn't work!CM1NCHbits.NCH=0x110; //Comp Neg Inp connects to FVR Buffer 2; //maybe should instead work?To help anyone help me, attached are the PIC16F18456 Datasht pgs of interest.

author: Salome2
author_rank: Regular Contributor
timestamp: October 03, 2024, 03:23:46 am
content: Mia, yes it would be helpful, if you did share this!

author: JoeyG
author_rank: Regular Contributor
timestamp: October 03, 2024, 04:16:12 am
content: DTMF Tone Detection on PIC18https://sites.google.com/site/hobbydebraj/goertzel-algorithm-dtmf-detectionIt discusses the MIPS required. ExtractMIPS requirement: -PIC18F4520 runs at a max frequency of 40MHz and internally, the clock is divided by 4 to get 10MIPS.The implementation of Goertzel acquires a buffer of 100sample, sampled at a rate of 5908Hz.Time to acquire 100 samples = 100 * (1/5908) = 16.92millisecTime to perform Goertzel decoding (measured by toggling a GPIO on oscilloscope) = 9.40millisecMIPS required = (9.40/16.92) * 10 = 5.55MIPS.Alsohttps://www.embedded.com/the-goertzel-algorithm/Alsohttps://netwerkt.wordpress.com/2011/08/25/goertzel-filter/PIC12 in assembly languagehttps://www.instructables.com/DTMF-Touch-Tone-Decoder-Using-Microchip-PIC-Microp/

author: Salome2
author_rank: Regular Contributor
timestamp: October 04, 2024, 09:26:00 am
content: JoeyG, Thanks a million for presenting working C code to do Goertzel!The highest freq. in touchtone is 1633Hz while my freq. of interest to detect is 2kHz and I trying to understand how to make the c code modification without success.A major consideration in the doorbell detector is battery usage. The 16F18456 doesn't have any hardware multiplier, which makes it 10x slower to do math than using any 18F MCU, and so the 16F18456 would use 10x the power and 10x the time?