Timer alarm - Page 1
Forum section: electronics / beginners

author: darinsquared
author_rank: Contributor
timestamp: November 30, 2019, 02:40:28 pm
content: I am trying to devise a way to set up an alarm that is based on no motion. Basically the opposite of a motion sensor light. I know how to build this with a PIR sensor but I want the time before the alarm sounds longer than a typical PIR sensor allows. I want 4-5 minutes of no motion to trigger an alarm. I would think using a capacitor and 555 timer in some form.

author: Wimberleytech
author_rank: Super Contributor
timestamp: November 30, 2019, 03:43:01 pm
content: Quote from: darinsquared on November 30, 2019, 02:40:28 pmBefore digging into the specific implementation, is this the concept you are trying to achieve?Every time the sensor detects motion, it resets the timer. Only when the sensor does not generate an output for 5 minutes, does the timer output to the buzzer. The buzzer needs to have its own timer so that when activated, it stays on for a desired length of time.In terms of implementation, this is trivial with an arduino.

author: darinsquared
author_rank: Contributor
timestamp: November 30, 2019, 04:10:07 pm
content: Quote from: Wimberleytech on November 30, 2019, 03:43:01 pmBasically correct. I have aging parents and I want to set an alarm in the kitchen so that when they are cooking they can physically start the alarm when they are cooking. When they leave the kitchen and no motion is detected for 5+ minutes an alarm will sound to remind them some thing is on the stove.I prefer straight electronics over Arduino. Ideally there would be a relay on the power supply to the stove that would cut out when there is no motion for extended period.

author: jhpadjustable
author_rank: Frequent Contributor
timestamp: November 30, 2019, 04:14:36 pm
content: It's also nearly trivial with a 555. You need only provide your own transistor for retriggering. Bringing the "H" input low brings the output high and resets the timer. You'll also need to bring your own inverter if your PIR module output goes high when presence is detected.

author: Wimberleytech
author_rank: Super Contributor
timestamp: November 30, 2019, 04:30:27 pm
content: Quote from: darinsquared on November 30, 2019, 04:10:07 pmLOL, this is a very good idea. I am an aging parent (Grrr!!!!!) and more than a few times I have left something cooking on the stove. Right now, I have a timer next to the burners...when I start something, I set the timer to warn me. It works, but I like your idea as well. jhpadjustable posted a simple solution. Cascade with another 555 to keep the timer running long enough for your parents to hear it.You are a fine son!

author: JuanGg
author_rank: Regular Contributor
timestamp: November 30, 2019, 04:31:07 pm
content: You can even do it with a comparator and maybe with a couple transistors, although in this case it may not be practical given the 5 min interval. You'd need quite a bit of capacitance to get the desired time constant, and still have a small enough resistor to give the transistor the necessary base current to activate the relay.Juan

author: darinsquared
author_rank: Contributor
timestamp: December 01, 2019, 02:50:10 pm
content: Quote from: jhpadjustable on November 30, 2019, 04:14:36 pmPardon my ignorance but I do not comprehend the use of an inverter.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 01, 2019, 03:18:21 pm
content: Quote from: darinsquared on December 01, 2019, 02:50:10 pmIf your PIR detector pulses "high" on detection, you will have to invert that signal so that it pulses "low" on detection--thus an inversion, or inverter.

author: Zero999
author_rank: Super Contributor
timestamp: December 01, 2019, 07:46:30 pm
content: Yes, a comparator or 555 will work but 5 minutes is a little long, so how about the good old 4060? Replace the switch with a diode, connected to the PIR.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 01, 2019, 08:11:39 pm
content: All of these ideas are fine, by as I said in my original response, an Arduino solution is incredibly simple.

author: golden_labels
author_rank: Super Contributor
timestamp: December 01, 2019, 08:35:00 pm
content: darinsquared:After building the primary version according to your initial idea, which you should do first before perfecting the device for various reasons (below), consider extending it by requiring some additional action after 15–20 minutes. Within a 5 minute period a PIR sensor can be triggered even without anyone around. In particular in kitchen environment, with both steam and radiation heating surfaces all over the place.As for the reasons to first build the potentially worse solution: trying to make a perfect thing usually ends in not producing it at all. Fight the urge, uncontrolled perfectionism is really a horribly thing. Second: it is unlikely that everything will work ideally upon the first run. It is easier to debug and tweak a simpler device, and it makes little sense to build extensions upon a platform that is not stable yet.Wimberleytech:As a software developer, I prefer to approach problems from the digital end of things too and sometimes I think that analog guys are way too much attached to their continuous domain solutions. But in this case I am forced to agree with them: it has a lower risk of failure, it is much much simpler, it is easier to debug/repair. On top of that the solution using specifically Arduino is pointlessly expensive: Arduino is good as an educational platform, but it is not a great choice for practical purposes if someone has knowledge of electronics and can handle a soldering iron.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 01, 2019, 08:59:56 pm
content: Quote from: golden_labels on December 01, 2019, 08:35:00 pmI respectfully disagree.1) I am an analog guy.2) As I posted, the arduino solution requires almost no effort. (I have not done the exercise myself to check for gotchas, but I will).3) Arduinos are cheap. Depending on where you are...under $8. Yes, a 555 and a couple of caps and resistors are cheaper--I grant you that.4) Arduinos are reliable. Can you site a reference that supports this reliability concern?5) I have used Arduinos to make a reliable "bucket-level-detector" for my tractor. Works fine in a relatively harsh environment.6) Yes, it is fun to solder up a 555 dip package on a perf board and hang some resistors and caps around it with wires here and there to connect to the PIR and buzzer. My lab is full of that stuff. Well...maybe put it on a pcb, no? OK, I do that too...fab my own pcbs when I want to stain my hands with ferric chloride, or slap one together and send it to expresspcb (that aint cheap).I still stand by my position that an arduino solution would be nice.Please rebut my points as I am happy to be proven wrong.

author: james_s
author_rank: Super Contributor
timestamp: December 01, 2019, 09:25:40 pm
content: I would probably use an 8 pin microcontroller, I've used the attiny series on a number of occasions. There's a tiny85 Arduino core but a project like this is trivial to do in any language, even raw assembly wouldn't be too hard.Nothing wrong with the analog approach either though, or an oscillator driving a counter, this is one of those trivial projects where all kinds of different methods will get the job done.Of course it also depends on the aging parents remembering to activate the device when they start cooking, so it might ultimately be more effective to have a functional smoke alarm in the kitchen.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 01, 2019, 10:04:07 pm
content: QuoteI built it. It works as expected. Simple, as expected.Once you are in "code" land you can address issues (such as the one pointed out by james_s) with clever algorithms and perhaps other sensory inputs.

author: golden_labels
author_rank: Super Contributor
timestamp: December 01, 2019, 10:05:06 pm
content: Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmI would, if they would even refer to what I’ve said.Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmI can’t disprove that.Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmExcept writingand testingsoftware. I stress the second part.Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmBy mentioning Arduino I meant it in comparison not only to the analog solution, but to digital alternatives. They’re much more expensive than even the corresponding microcontrollers themselves — not to mention anything needed for that task. Even with in the software domain this can be done at under 15% of Arduino’s cost.Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmI have never said Arduinos are not reliable. I claim that the software solution islessreliable. That arises from orders of magnitude higher complexity of both the underlying technology and the design, harder testing, less previous testing and higher chance of making a mistake in the first place.(1)Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmI was never talking about the environment. And if you did, I am happy you made something working. But your success doesn’t prove in any way that there are no better solutions or that someone else may repeat that with similar outcome.Quote from: Wimberleytech on December 01, 2019, 08:59:56 pmWe do not know what the author has. We are on the electronics forum, so — unless clearly stated otherwise — it is a sane assumption that if someone wants to build an electronic solution, they will have to build a circuit on a PCB. Isn’t it?Consider it a kind of a joke (I don’t suggest doing that), but with the 555 circuit presented above, you can go without a PCB: dead bug potted in epoxy or lowe temperature hot glue.____(1)The easiness of turning an idea into software and its seemingly shallow learning curve misleads many people into false feel of comfort, despite their software is far from being reliable.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 01, 2019, 10:22:54 pm
content: golden_labels:Fine. I did build it inside of 20 minutes using stock code.Yes, deadbug and hot-glue can be made to work...ugh.As for me being an analog guy...true...there was no way for you to rebut that, sorry for suggesting. But FYI, I co-authored an analog book 30 years ago that is still in print and in 3rd edition in both english and chinese...so...yeah I am an analog guy (OLD analog guy to be accurate)

author: darinsquared
author_rank: Contributor
timestamp: December 01, 2019, 11:06:26 pm
content: Quote from: Wimberleytech on December 01, 2019, 08:11:39 pmThat is a great idea for people without an irrational fear of programing. But I should challenge myself.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 01, 2019, 11:14:09 pm
content: Quote from: darinsquared on December 01, 2019, 11:06:26 pmMy first program was in Fortran 77 on an IBM/Amdahl 360 using punch cards. For years I had an irrational fear of the damn things. No more!

author: golden_labels
author_rank: Super Contributor
timestamp: December 01, 2019, 11:40:07 pm
content: Quote from: Wimberleytech on December 01, 2019, 10:22:54 pmHow is your WDT handler signalling failure and, if it does that in a fail-safe manner by beeping, how do you solve the possibility that it may occur in a middle of an already running beep?Don’t bother answering the above question. Before one does even fully understand the question, the 555 circuit is already shown to be right.You got your point: possibly you have proven that it is possible to implement that. I have no slightest idea why you wanted to prove that, as no one ever said otherwise.I do not have an irrational fear of programming. I have a rational respect for the risk involved and realization that I am merely a human.

author: jhpadjustable
author_rank: Frequent Contributor
timestamp: December 01, 2019, 11:46:31 pm
content: This being a safety application, I 100% understand if someone doesn't want to bother about with programming, let alone gather all the tooling for it on top of the interfacing and so on. There are times to stretch and there are times to K.I.S.S. and get it done in the way you're surest-footed.

author: james_s
author_rank: Super Contributor
timestamp: December 02, 2019, 12:34:50 am
content: I'm not sure I'd worry too much about it being a safety application, currently there is nothing, having anything that reminds them sometimes even if it is not 100% effective is better than nothing.

author: jhpadjustable
author_rank: Frequent Contributor
timestamp: December 02, 2019, 08:35:21 am
content: Oh, right, my mistake. I had taken the ideal, "a relay on the power supply to the stove that would cut out when there is no motion for extended period," for the minimum. So much for not stretching!

author: Zero999
author_rank: Super Contributor
timestamp: December 02, 2019, 09:45:18 pm
content: I'm also an analogue, more than software person. I'm not scared of code. It just doesn't interest me so much.Yes, all of the options discussed above will work. If I had to pick one, it would be a simple 6 or 8 pin microcontroller, probably programmed in good old assembler.I don't see how a 555 timer is any more reliable than a simple microcontroller. The 555 timer has its quirks. It's prone to false triggering and resetting, due to glitches in the supply voltage which can be caused when the output pin changes state, which results in huge current spikes. I know software can be prone to bugs, but that tends to be the case for complex systems, running on a deep software stack, containing many potentially buggy libraries and drivers. Such a simple program, running on a basic microcontroller, should be fairly reliable, given sufficient debugging. It will have less components, than an analogue design, therefore fewer parts to go wrong. We also mustn't forget that the timer is only a small part of the system. There are other parts such as the: power supply, PIR sensor, relay and alarm which have the potential to fail.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 03, 2019, 04:26:41 pm
content: OK golden_labels, you have bested me. I declare you the winner.

author: golden_labels
author_rank: Super Contributor
timestamp: December 04, 2019, 04:22:04 am
content: It is sad that people get so deeply emotionally involved and hurt as a reaction to a simple event of someone else noticing possible problems with their solution — not even claiming that they’re outright wrong or their it is crap, but just that it may be lying at a position worse in some scale than some other option.No one has won, because there never was any fight. Though you may perceive it in a different way. After all I’m not totally immune to XKCD 386 myself.

author: SmallCog
author_rank: Frequent Contributor
timestamp: December 04, 2019, 08:53:16 am
content: I'm a simple guy who likes simple things. A few weeks back I needed to turn a pump on for Xminutes then have it off for Yminutes and I doodled things with 555's and hummed and haa'd about code and an arduino.In the end I grabbed this off of ebay because it was the simplest option. I have it in a recurring program mode but one of the other programs would suit your purposes. I think I paid a bit less than that, just an example of the item and not an endorsement of the particular seller.https://www.ebay.com.au/itm/Universal-DC12V-20A-1500W-Timing-Timer-Digital-Display-Time-Delay-Cycling-Module/401833436197?hash=item5d8f23a425:g:MigAAOSwwgddLDo~I'd suggest wiring the PIR to trigger the momentary reset switch, and using the P1-0 program. Every time the PIR detects motion it will restart the countdown, if the countdown ever reaches 0 then the relay will be energised and stay energised until it's reset.You could wire a buzzer or flasher or both via this relay. Could also wire another one of these timer modules as well...These modules start running as soon as they're powered and the second module could "escalate" the situation. If the first timer has reached 0 and the siren/light hasn't attracted someone attention then the second timer will eventually reach 0. When it does it'll energise its relay, which can be attached to a (decent, properly wired) relay or contactor to interrupt power to the stove.You may wish to have this interrupting relay set up as a latching relay, with a reset button to re-energise the stove rather than it coming back on as soon as movement is detected - depending upon your folks circumstances.No matter which way you go, good on you for giving your folks the ability to maintain their independence safely. I'll never forget the stench of my Nan's attempt at microwaving a pasty for 3 hours...

author: darinsquared
author_rank: Contributor
timestamp: December 05, 2019, 02:27:35 pm
content: Quote from: Wimberleytech on November 30, 2019, 03:43:01 pmI started playing around with Arduino after this post. I am struggling to find code that supports the delayed response to initiating the buzzer.Its not trivial for me.

author: Wimberleytech
author_rank: Super Contributor
timestamp: December 05, 2019, 02:55:24 pm
content: Quote from: darinsquared on December 05, 2019, 02:27:35 pmIf you understand how the 555 solution works, simply digitize all of the functions. The RC is just a counter. The PIR input resets the counter. If the counter reaches a threshold, trigger the buzzer.If this is too hard to understand, then just use a 555.

author: SteveSi
author_rank: Contributor
timestamp: December 06, 2019, 10:14:01 am
content: Just get an Amazon Echo Dot and teach them to use it - they are incredibly useful in this situation.'Alexa - start a 5 minute timer'After x minutes they will hear it go off and it continues to sound until they come and say 'Alexea - cancel timer'.You can also use it for calling them using another Echo or your smartphone and they don't even need to answer - you can just listen in and hear what (if anything) is going on or shout out to get their attention. If you get an Echo Show, then you can also see what is going on at any time.I used these in my mothers house because she had the onset of dementia. We found it incredibly useful.It also plays the radio (no fiddling for a station) and you can set wake-up alarms. I also set a 'wake up and go to bed' alarm for 11pm because she fell asleep in the chair at night a lot and woke up at 3am/5am! Also a '6.30p.m. time for tea' alarm. You can use its shopping list feature too which is useful, and you can set reminders (Alexa - remind me at 9a.m. Friday that Judy is coming at 11a.m.).