Another Ice Tube Clock Firmware for the Holidays

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.
User avatar
jarchie
 
Posts: 615
Joined: Sun Jun 24, 2012 2:16 pm

Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

The xmas-icetube firmware is a complete rewrite of the Adafruit Ice tube clock firmware. Despite its name, xmas-icetube works perfectly well at other times of the year. The only feature related to Christmas is that "We Wish You a Merry Christmas" is one of eight alarm sounds. And of those eight alarm sounds, six are perfectly well suited for everyday use.

The xmas-icetube firmware is compatible with both the Adafruit Ice Tube Clock v1.1 and the xmas-icetube hardware revision. The firmware includes all of the features of the Adafruit firmware in addition to the following improvements:
  • animated display transitions
  • multiple time and date formats
  • optionally pulse display during alarm and snooze
  • three alarm times for selectable days of the week
  • functional alarm during power outage
  • adjustable alarm volume (from 0 to 10)
  • progressive alarm option (gradually increasing volume)
  • selectable alarm sound (high frequency beeps, low frequency beeps, high frequency three beep pulse, low frequency three beep pulse, Merry Christmas, Big Ben, Reveille, or For He's a Jolly Good Fellow)
  • adjustable snooze duration
  • DST support (USA, EU, or manual)
  • fully automatic correction for time drift
  • time-from-GPS support*
  • temperature compensated timekeeping*
  • no beeping or time loss after external power failure
  • 4-fold or 25-fold* increase in backup battery life
  • low battery warning before battery failure
  • per-digit brightness adjustment for uneven displays
  • automatic brightness control by ambient light*
  • optionally disable display during specified time periods
  • optionally disable display at night (when dark)*
  • IV-18 VFD tube driven to specifications*
* These hacks require hardware modification of the Adafruit Ice Tube Clock v1.1.

The installation and usage of xmas-icetube are documented reasonably well, unlike most alternative firmwares. For the most recent details, please visit the GitHub page.

Finally, please note that I consider Christmas to be a cultural holiday in the United States and many other countries. I also acknowledge that Christmas is, to many, a Christian holiday. The xmas-icetube firmware is named after Christmas as a cultural holiday. Personally, I am agnostic, and I sincerely hope that my firmware is compatible with all religions.




NOTE: Since the xmas-icetube firmware has matured significantly over the past year, I revised the initial post of this thread (above). The original post, however, is reiterated below.


If anyone would like to play with another Ice Tube Clock firmware during the holiday season, I'm posing mine. It currently runs on an atmega328p, but (theoretically) should work on the atmega168 (see the Makefile). Features include,

(1) adjustable alarm volume,
(3) progressive alarming,
(2) musical alarm ("Merry Christmas"),
(4) DST support (USA, EU, or manual),
(5) automatic drift correction,
(6) alarm sounds during power outage,
(7) no reset during power failure, and
(8) autodimmer (requires photoresistor).

I am not aware of any bugs, but please consider the project a work-in-progress. I would greatly appreciate bug reports and am open to feature requests...

Have fun!

http://github.com/johngarchie/xmas-icetube
Last edited by jarchie on Tue Nov 26, 2013 11:19 pm, edited 1 time in total.

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by wbp »

Nice job! I like how you broke it up into separate components. Been wanting to do that for ages but got distracted by another project.
William

User avatar
revnull
 
Posts: 22
Joined: Mon Aug 30, 2010 10:06 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by revnull »

+10 for John's firmware!

Please do not let the "xmas" name sway you from giving it a try. It's the most feature complete Ice-Tube Clock firmware to date. John has been very busy combining both functional and aesthetic features from all of the different firmwares and adding his own drift correction and musical alarms.

Pop in an atmega328p you have laying around and give it a try.

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

Thank you both for the kind words. :)

I'd like to encourage anyone interested in this firmware to click on the GitHub link in the first post and view the README. The list of features in the original post is now rather outdated, and I am still working on the project as spare time permits.

User avatar
pgeremia
 
Posts: 12
Joined: Sun Jan 06, 2013 10:45 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by pgeremia »

Update: Guess I should have read the README better! I am ordering the ATMEGA328P.

Thanks!!

-Pete

Ps. Could you add DST support to your firmware?

=======
Hello,

I just purchased an icetube clock and would love to be able to load your firmware. But my icetube clock has the chip ATMEGA168V. I tried to use this. It compiles, but that is as far as I can get because my chip does not match.

Is there a way to get your code to load on this chip?

Thanks!

-Pete

Ps. Already have the ultimate gps breakout module installed and want to use your firmware to I can use it.

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

Update: Guess I should have read the README better! I am ordering the ATMEGA328P.
No worries. Besides, I had forgotten I added that sentence to the README. ;-)

One disadvantage of the xmas-icetube firmware is that it has quite a few features. I remember being a bit sad when the code would no longer fit on the ATmega168v that comes with the Ice Tube Clock. Another disadvantage is that there are many menu options. The menus are organized fairly intuitively using a nested structure, but it still takes a little time to discover what everything does.

As far buying a chip, I recommend the ATMEGA328P-PU. That's the chip used for Arduinos, and works well in the Ice Tube Clock. At one point, I tried the other chip (ATMEGA328P-MN?), but the crystal oscillator was unstable and the clock didn't keep time reliably.
Ps. Could you add DST support to your firmware?
By default the firmware is in manual DST mode. In the menus, under "cfg regn"/"set dst", you may toggle "dst on", "dst off", "dst usa", and "dst eu". The first two options allow you to manually enable or disable DST. The last two options automatically enable and disable DST according to US or EU rules. When setting time, the GPS code uses the current DST setting along with the GMT/UTC time offset in hours and minutes, as specified under "cfg regn"/"set zone".

Writing more generic DST code is on my to-do list, but is currently a low priority. If anyone uses the xmas-icetube firmware outside of the USA and EU, please let me know. Otherwise, I'm not likely to work on the DST code anytime soon.

User avatar
pgeremia
 
Posts: 12
Joined: Sun Jan 06, 2013 10:45 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by pgeremia »

Thanks very much for the info!!! Awesome!!

Oh.. One other feature that would be cool. My Icetube clock has a problem that the last digit is significantly dimer than all the other digits. Someone suggested displaying the digit multiple times in order to make it glow brighter. So maybe an option to individually increase the brightness of certain digits would be cool. Now that I have the code and the compiler all set up, I might see what I can do.

I am excited for my chip to arrive!!!!

Thanks!!

-Pete :D

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

The xmas-icetube firmware does provide a per-digit brightness control (under "cfg disp"/"digt bri"), and that is one solution to your problem. Another solution is to replace R3 with a jumper or potentiometer. Both approaches are discussed in another thread: http://forums.adafruit.com/viewtopic.ph ... 6&start=20

User avatar
pgeremia
 
Posts: 12
Joined: Sun Jan 06, 2013 10:45 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by pgeremia »

Thank you very much!!

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

You're very welcome. Let me know how things work out. Good luck!

User avatar
pgeremia
 
Posts: 12
Joined: Sun Jan 06, 2013 10:45 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by pgeremia »

Well... I have a question. I have an ATMEGA328P-PU chip. I got it from adafruit. I tried to program it using the usbmini programmer with your xmas firmware. I follow the instructions, but when it tries to access the chip I get an error. If I put the original chip back in the clock and program it, it works fine. I actually made some modifications to the original gps based source code so that my ultimate GPS works at 9600 baud instead of 4800 baud. That works great.

So is there anything special that i need to do in order to program the 328 chip? Do I need the Arduino board to program the chip?

Any help would be appreciated.

Thanks,

-Pete

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

---edited post---
I tried to program it using the usbmini programmer with your xmas firmware.
Is usbmini another name for the Adafruit USBtinyISP? Or is it something different?
I follow the instructions, but when it tries to access the chip I get an error. If I put the original chip back in the clock and program it, it works fine.
What avrdude commands are you using for the atmega168? The atmega328p? What is the exact error you get with the atmega328p?
I actually made some modifications to the original gps based source code so that my ultimate GPS works at 9600 baud instead of 4800 baud. That works great.
Very impressive. Congratulations on getting that to work!
So is there anything special that i need to do in order to program the 328 chip?
I think the only difference is that avr-gcc must have the "-mmcu=atmega328p" option and avrdude must have the "-p atmega328p" option. But the xmas-icetube Makefile should take care of this.
Do I need the Arduino board to program the chip?
I wouldn't think so. The Ice Tube Clock's ISP interface should work fine.

User avatar
pgeremia
 
Posts: 12
Joined: Sun Jan 06, 2013 10:45 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by pgeremia »

1. Using USBtinyISP from Adafruit

2. I follow your instructions. make, make install-fuse, make install

make worked fine.

make install-fuse fails with:

Code: Select all

sh-3.2# make install-fuse
./optgen.pl time | xargs avr-gcc -c -I. -mmcu=atmega328p -std=gnu99 -Os -Wall -DF_CPU=8000000  -o time.o time.c
./optgen.pl time | xargs avr-gcc -MM -I. -mmcu=atmega328p -std=gnu99 -Os -Wall -DF_CPU=8000000  time.c > time.d
avr-gcc -I. -mmcu=atmega328p -std=gnu99 -Os -Wall -DF_CPU=8000000  -o icetube.elf icetube.o system.o time.o alarm.o piezo.o display.o buttons.o mode.o usart.o gps.o
avr-objcopy  -j.fuse -O ihex icetube.elf icetube_fuse.hex
avrdude -p atmega328p -c usbtiny -P usb -B 4 -u -U lfuse:w:0x62:m -u -U hfuse:w:0xD1:m -u -U efuse:w:0x06:m

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make: [install-fuse] Error 1 (ignored)
rm icetube_fuse.hex
I did order the chip from Adafruit. But it was programmed with the Arduino boot loader. So maybe that is the problem? I cannot overwrite?

https://www.adafruit.com/products/123

I am running this on a Mac and I am using crosspack avr latest version:

http://www.obdev.at/products/crosspack/index.html

Yeah the adafruit original firmware will not even compile now.. I had to change a number of items to const as well as change to the new signal naming. But now it does work. I guess I should post the modified source for others if they need it.

I also modified the board and now all digits are perfect!! So nice to NOT have a dim last digit!

Thanks again for helping me out. I really appreciate it.

-Pete

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

Re: Another Ice Tube Clock Firmware for the Holidays

Post by jarchie »

I have reproduced your error and am wrong about the Adafruit chip working out-of-the-box. I apologize for the inconvenience.

To reproduce the error, I removed the ATmega328p from my GPS-enabled clock, placed it in an Adafruit DC Boarduino, and burned the Arduino bootloader. When I inserted the chip back in my clock, programming failed exactly as you describe.

The problem was that the Arduino uses an external 16 MHz oscillator, so an ATmega328p with an Arduino bootloader has the external oscillator fuse configured. Since the clock does not provide a high-frequency external oscillator, the chip will not function in the clock--not even to be programmed.

To fix the situation, I installed the ATmega328p in my AVR development board (which provides power and an ISP header), wired in a 16 MHz external oscillator, and programmed the new fuse settings using the xmas-icetube's "make install-fuse". (A Boarduino or Arduino board also would have worked, but I wanted to make sure the problem really was the external oscillator.) With the ATmega328p fuses configured to use the internal 8 MHz oscillator, I put the chip back in my clock and was able to program it normally with a "make install."

Do you have access to an Arduino board or something with an ISP header and external crystal oscillator?

User avatar
pgeremia
 
Posts: 12
Joined: Sun Jan 06, 2013 10:45 pm

Re: Another Ice Tube Clock Firmware for the Holidays

Post by pgeremia »

Wow!! Thank you so much for going through all that!!! No apologizes necessary. Much appreciated. Actually I plan on purchasing the Arduino board from Adafruit. So I can use that and follow what you did.

https://www.adafruit.com/products/50

I am looking forward to using your firmware and maybe making some mods of my own. This is fun stuff!!!

Thanks Again!!

-Pete
jarchie wrote:I have reproduced your error and am wrong about the Adafruit chip working out-of-the-box. I apologize for the inconvenience.

To reproduce the error, I removed the ATmega328p from my GPS-enabled clock, placed it in an Adafruit DC Boarduino, and burned the Arduino bootloader. When I inserted the chip back in my clock, programming failed exactly as you describe.

The problem was that the Arduino uses an external 16 MHz oscillator, so an ATmega328p with an Arduino bootloader has the external oscillator fuse configured. Since the clock does not provide a high-frequency external oscillator, the chip will not function in the clock--not even to be programmed.

To fix the situation, I installed the ATmega328p in my AVR development board (which provides power and an ISP header), wired in a 16 MHz external oscillator, and programmed the new fuse settings using the xmas-icetube's "make install-fuse". (A Boarduino or Arduino board also would have worked, but I wanted to make sure the problem really was the external oscillator.) With the ATmega328p fuses configured to use the internal 8 MHz oscillator, I put the chip back in my clock and was able to program it normally with a "make install."

Do you have access to an Arduino board or something with an ISP header and external crystal oscillator?

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

Return to “Clock Kits (discontinued)”