Newest firmware / firmware tweaks for ice tube clock

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
MrGlass
 
Posts: 90
Joined: Tue Jun 03, 2008 3:50 am

Newest firmware / firmware tweaks for ice tube clock

Post by MrGlass »

I was given an Ice Tube clock at BsideLV, on the condition that I tweet pictures and do cool stuff with it. I built it 2 days later at the Defcon hardware hacking village (took a while, but no problems!), tweeted my picture(http://yfrog.com/0y65mmj), but still feel like I need to do something cooler to repay my debt.

I want to see what I can do in terms of hacking with the clock, but I need to figure out a good firmware to base it off of before I get started. I read through a different thread that apparently used to have a comparison of firmwares out there, but it was removed. So, here are some of the tweaks I want to make to my clock:

1. Blinking on power resume - I understand its to indicate that the time might be off, but ive never seen that happen from keeping the clock unplugged for a short time. It really annoys me. Maybe i can add in a feature that detects if its been unplugged & the time is 000000
2. Big snooze button - someone else mentioned this on a different thread. I need a snooze button I can wack when half asleep.
3. Autodim - I dont need it so bright normally, and I feel like I'm gonna wear out the tube quickly. I want to have it be dim normally, and glow at full for 10 seconds after I hit my big snooze button.

I also want to modify the length of snooze, but I figure that will be easy to change in the firmware. So, does any firmware have support for these, how should I start, etc?

User avatar
stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Newest firmware / firmware tweaks for ice tube clock

Post by stinkbutt »

There are a variety of firmware mods that are available right now for the clock. They're compared here.

My God, that's awkward. Making a link out of the word "here" is so 1999, Heather. I feel dirty.

As for actually finding one of the three firmwares, just search for the author's name in the forums.
MrGlass wrote:1. Blinking on power resume - I understand its to indicate that the time might be off, but ive never seen that happen from keeping the clock unplugged for a short time. It really annoys me. Maybe i can add in a feature that detects if its been unplugged & the time is 000000
2. Big snooze button - someone else mentioned this on a different thread. I need a snooze button I can wack when half asleep.
3. Autodim - I dont need it so bright normally, and I feel like I'm gonna wear out the tube quickly. I want to have it be dim normally, and glow at full for 10 seconds after I hit my big snooze button.

I also want to modify the length of snooze, but I figure that will be easy to change in the firmware. So, does any firmware have support for these, how should I start, etc?
I've only worked with Digisage's version, but I can tell you the following based on your questions.

1. I dunno
2. Big snooze button's a bit of a pain. I thought perhaps a capacitive touch sensor would do the trick, but either you're going to use the spare pin on the 168 meaning you won't be able to auto dim, or you're going to solder in parallel to one of the buttons on the back. And it's not clear if the case would be too noisy, electrically, to make a capacitive touch sensor work. Plus you're gluing a big ugly strip of plastic & metal to a clear plastic case. UGGO.

Other people have suggested a tilt sensor (grab the clock & shake it), a pressure-sensitive resistive strip, and a voice sensor (I don't think the latter would work very well - You are alarming at the time; lots of noise.)

3. Dimming's pretty easy to control using Digisage's version of the code - He's removed some ugly code in the stock version that nobody can tell me what it does and replaced it with just a couple of lines in iv.h, lines 44-46:

Code: Select all

#define BRIGHTNESS_MAX 90
#define BRIGHTNESS_MIN 30
#define BRIGHTNESS_INCREMENT 5
If you want to change the brightness during a snooze I guess it'd be pretty easy just to call

Code: Select all

set_vfd_brightness( uint8_t brightness_level )
The snooze, as far as I can tell, is controlled by the interrupt that changes the time once per second. It's handled as a countdown. The relevant code in the firmware starts at line 115 in iv.c:

Code: Select all

// When the alarm is going off, pressing a button turns on snooze mode
// this sets the snoozetimer off in MAXSNOOZE seconds - which turns on
// the alarm again
void setsnooze(void) {
  snoozetimer = eeprom_read_byte((uint8_t *)EE_SNOOZE);
  snoozetimer *= 60; // convert minutes to seconds
//  snoozetimer = MAXSNOOZE;
  DEBUGP("snooze");
  display_str("snoozing");
  displaymode = SHOW_SNOOZE;
  delayms(1000);
  displaymode = SHOW_TIME;
}
...and then continues in the once-per-second SIGNAL (TIMER2_OVF_vect) interrupt which starts at line 338. The part that counts down the snooze is at line 422:

Code: Select all

  if (alarm_on && (alarm_h == time_h) && (alarm_m == time_m) && (time_s == 0)) {
    DEBUGP("alarm on!");
    alarming = 1;
    snoozetimer = 0;
  }

	dimmer_update();

  if (timeoutcounter)
    timeoutcounter--;
  if (buttonholdcounter)
    buttonholdcounter--;
  if (snoozetimer) {
    snoozetimer--;
    if (snoozetimer % 2) 
      display[0] |= 0x2;
    else
      display[0] &= ~0x2;
  }
}
So if you want ten seconds of snooze you simply check to see if the snooze countdown number is > total snooze - 10. If it is, go full bright. Otherwise, go with whatever brightness you normally have.

As for modifying the snooze length, that's menu-configurable in every firmware except the stock firmware, where you could just modify the code instead. I don't want to post that code because it's not part of the same version, but if you can't find the default snooze length in the stock firmware you should just hit yourself over the head with a tack hammer a couple of times :wink:

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

Return to “Clock Kits (discontinued)”