Ice Tube - progressive alarm algorithms

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Ice Tube - progressive alarm algorithms

Post by wbp »

I've been working on a "progressive" alarm for the Ice Tube clock. I'm wondering if anyone else has thought about this. The general idea is to start out with single beeps at a long interval, 10 or 15 seconds, then speed it up. I have one travel alarm that starts out with a single beep at 5 seconds, then goes to 2 beeps, then 3, then 4, and finally 5 for continuous beeping. That's OK but I wanted to try something fancier.

Right now I have this sequence:
4 beeps at 16 second intervals
4 beeps at 8 seconds
4 beeps at 4 seconds
and so forth down to around 5 beeps a second.

I think it works pretty good. I guess I could put the tuning parms in the menu but that seems like more trouble than it's worth.

Anyone else have any ideas on this?

William

User avatar
wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube - progressive alarm algorithms

Post by wbp »

There doesn't seem to be very much interest in this topic...

Here's what I finally settled on for my alarm beeping:

1) single beep at 15 second intervals for 60 seconds
2) double beep at 10 second intervals for 40 seconds
3) three beeps at 5 second intervals for 30
4) four beeps at 5 seconds for 20
5) five beeps at 5 seconds for 10
6) continuous beeping

Seems to work pretty good. Oh, and I also added code to silence the alarm after 30 minutes - it used to just keep on beeping!

William

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: Ice Tube - progressive alarm algorithms

Post by brucef »

I was going to chime in earlier but I just couldn't imagine needing that level of prompting to get up in the morning! I had an old clock that would click quietly once about 30 seconds before it started making its ugly raspy alarm noise. That click was all the progressive alarming I needed to make me jump out of bed before it started pealing in earnest.

Anyway, I have an Ice Tube and I don't use the alarm at all. If I did, I'd want to customize it to be as quiet as possible to start, and I really like your idea of having it shut up after 30 minutes - sometimes you might not be there when it starts ringing and I wouldn't want to annoy the neighbours with a non-stop alarm clock. That cutoff should be a default feature.

User avatar
wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube - progressive alarm algorithms

Post by wbp »

Bruce, I agree with you about wanting the alarm to start out as quiet as possible! Unfortunately, I don't know if it's possible to make the Ice Tube's beeper any quieter than the two volume levels already in the code. (I admit to not having studied this enough to understand the way its done).

Several people have hooked up sound generators to their clocks, but I wanted to try to work with what was already there...

William

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: Ice Tube - progressive alarm algorithms

Post by brucef »

wbp wrote:Bruce, I agree with you about wanting the alarm to start out as quiet as possible! Unfortunately, I don't know if it's possible to make the Ice Tube's beeper any quieter than the two volume levels already in the code.
Hmm... well, looking quickly at the code, I think you'd have to mess around with how alarmdiv and ALARM_DIVIDER are used in the SIG_OVERFLOW0 handler. Essentially look at the current code as starting at 2 Hz and 50% duty cycle, and have it start more quietly just by tweaking the duty cycle?

Code: Select all

#define ALARM_FREQUENCY 200  // alarm pulse frequency in 100'ths of a second
#define ALARM_STEP 10  // # of 100'ths of a second added to the alarm 'on' time after each beep
uint16_t alarmcount = 0  // counter for 100'ths of a second while alarm is ringing
uint16_t alarmduty = 0  // range 1 to ALARM_FREQUENCY, duty cycle of alarm beeping

// ... when alarming is set, alarmduty is reset to ALARM_STEP
// and alarm is started, so we start in the 'on' phase of the beep cycle

// then in SIG_OVERFLOW0:

if (alarming && !snoozetimer) {
    ++alarmcount;
    if (alarmcount >= alarmduty) {
      alarmcount = 0;
      if (alarmduty < ALARM_FREQUENCY-ALARM_STEP) {
          alarmduty += ALARM_STEP;
    } else {
      return;
    }
...
If I coded that right, it would give you 40 seconds between chirping and full on blaring. I don't think I'd go that aggressive, myself, but it's some sort of a starting point.

Alternately it may be possible to make the piezo quieter by messing with the PWM duty cycle. I haven't played around with piezos enough to know how well that would work.

Anyway, an interesting problem to think about, but I still think you got the most important mod already in turning the alarm off after a fixed period of time.

User avatar
wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube - progressive alarm algorithms

Post by wbp »

I revised my code a bit more. What I've got now starts out with a single beep at a 20 second interval. After each interval, I subtract 2 seconds and add one more beep. The frequency increases slightly for each beep in a cycle. After 10 cycles (about 2 minutes) it goes into continuous beeping. The beep rate is 5 hz with 50% duty cycle. I could make a short video and post it if anyone is interested. I'm going to give it a week of actual use and if I'm happy with it I'll post the update in a new thread here. Anyone who wants to "beta test" is welcome to ask for a copy.

William

User avatar
jarchie
 
Posts: 615
Joined: Sun Jun 24, 2012 2:16 pm

Re: Ice Tube - progressive alarm algorithms

Post by jarchie »

This seems to be a fairly old thread, but some people someone may still be interested...

As Bruce suggested, it is indeed possible to implement fine-grained volume control by using PWM on the pizo element. For an example, check out the pizo_setvolume() and pizo_buzzeron() functions in pizo.c:

https://github.com/johngarchie/xmas-icetube

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”