Ice Tube GPS Mod

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.
GWDodd
 
Posts: 12
Joined: Fri Jul 26, 2013 1:56 am

Re: Ice Tube GPS Mod

Post by GWDodd »

jarchie wrote:The avr-gcc command should invoke the AVR compiler. This should have come with WinAVR. Did you install that?
*ahem* I did not so that would explain why it did not work. Again, thanks for clarifying this. I'll install winavr and have more fun with Cygwin!

Take care and have a nice weekend! *runs off to download/install winavr*

Greg

GWDodd
 
Posts: 12
Joined: Fri Jul 26, 2013 1:56 am

Re: Ice Tube GPS Mod

Post by GWDodd »

So I just wanted to let John (and whoever else who may be following this thread) know that after installing Winavr, I got it to compile straight away. Now I'm waiting for the USBtinyISP kit. So for now the project is on hold until after I return from a short summer vacation. In the meantime I will be trying to come to grips with .c and .h files as this is interesting to me.
Thanks again for reading and all the help, tips and advice!
Greg

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

Re: Ice Tube GPS Mod

Post by jarchie »

GWDodd wrote:So I just wanted to let John (and whoever else who may be following this thread) know that after installing Winavr, I got it to compile straight away.
Thanks for the update. I'm glad compiling worked out.
GWDodd wrote:Now I'm waiting for the USBtinyISP kit. So for now the project is on hold until after I return from a short summer vacation.
Enjoy your vacation!
GWDodd wrote:In the meantime I will be trying to come to grips with .c and .h files as this is interesting to me.
The code is fairly well commented, but even so, I suspect you'll want the full ATmega328P datasheet and Ice Tube Clock schematic handy.

If you're unfamiliar with C, my favorite reference is K&R, and the AVR Libc documentation does an excellent job of describing the AVR-specific extensions the language.
GWDodd wrote:Thanks again for reading and all the help, tips and advice!
You're welcome. Good luck with everything!

User avatar
phild13
 
Posts: 247
Joined: Mon Sep 10, 2012 1:05 pm

Re: Ice Tube GPS Mod

Post by phild13 »

If you're unfamiliar with C, my favorite reference is K&R, and the AVR Libc documentation does an excellent job of describing the AVR-specific extensions the language.
Thanks for the links!

GWDodd
 
Posts: 12
Joined: Fri Jul 26, 2013 1:56 am

Re: Ice Tube GPS Mod

Post by GWDodd »

Hey All--You know what they say about bad pennies...
So I've assembled the target board and the USBtinyISP and I've had a go at programming one of these atmega chips. Apparently it worked! But I have a question for John:
When it came to programming, in the tutorial you were kind enough to attach earlier in this thread, I got hung-up on this:
"EDIT: The make install-fuse, make install, and make install-lock still work as described here, but they are no longer documented in the README and might be deprecated someday. To fully configure a chip for my firmware, use the single command make install-all instead of the three commands above."
When I tried the make install-all command it gave me this:
$ make install-all
make: *** No rule to make target `install-all'. Stop.
I was able to program the chip successfully using the 3 commands (make install-fuse, make install, and make install-lock). Any ideas why the make install-all command wouldn't work?

But really, I'm shocked I've gotten this far, thanks to the great help here. Next thing I have to do is tear apart my beloved icetube clock and add the gps sensor, photoelectric cell and the resistor and then slap the newly programmed chip in.

As usual, thanks for reading, consideration and time spent!

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

Re: Ice Tube GPS Mod

Post by jarchie »

Congrats on getting everything working!

I added the "install-all" target about a week after I posted that compilation information. Is there any chance you are using an old version of the code?

User avatar
phild13
 
Posts: 247
Joined: Mon Sep 10, 2012 1:05 pm

Re: Ice Tube GPS Mod

Post by phild13 »

Yea, there is no make install-all in the origional version of the firmware. I think there is one on the current version of firmware.

At any rate I would recommend the following and not using the make install-all command:

(4) Install the Firmware

Write the new fuse bits, which *do* differ from those in the original
Adafruit firmware and other alternative firmware projects:

% make install-fuse

Next, upload the compiled firmware and initial EEPROM contents:

% make install

The make install will install everything needed and the the fuse settings (make install-fuse) are needed for some of the features of the xmas firmware. At this point I would consider programming complete. Optionally you can set the lock bits, but I have not found any need to do so.

** Optional **
(5) Set lock bits

Since this firmware does not need self-programming capabilities,
lock bits should be set to prevent self-programming; this provides
an added measure of security against program memory corruption:

% make install-lock



Discussion with John on photocells and resistors determined that while a 10K or a 1K resistor will work fine, it is suggested a 5.6K resistor be used. It will likely be a better overall balance for light conditions typically found in the home whereas the 10K or 1K are biased towards dark or bright.

DigiKey part #: 5.6KQBK-ND for the resistor
And the DigiKey part #: PDV-P8001-ND for the photocell

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

Re: Ice Tube GPS Mod

Post by jarchie »

PhilD13 wrote:At any rate I would recommend the following and not using the make install-all command:
Interesting... why is that, if I may ask? I'm wondering if I should change the firmware/README instructions.

PhilD13 wrote:Optionally you can set the lock bits, but I have not found any need to do so.
I have also seen no need to set the lock bits. But to save power, my firmware disables BOD during sleep. According to the Atmel documentation, doing so should be completely safe, but PaintYourDragon has reported BOD-disable-related program memory corruption which I was unable to replicate.

In my opinion, my recommendation to set lock bits is just me being a touch paranoid.

User avatar
phild13
 
Posts: 247
Joined: Mon Sep 10, 2012 1:05 pm

Re: Ice Tube GPS Mod

Post by phild13 »

As I think it is unnecessary to set the lock bits, I was making the recommendation of not using make install-all so that the lock bits would remain unchanged. The install-all sets the lock bits (as would install-lock), so I just do the two commands below. If I were to give the clock to someone as a gift, then I would probably do the lock bits.

make install-fuse - which sets the fuse bits
make install - which uploads flash and eeprom memory
(4) Install the Firmware

Install this firmware to an ATMEGA328P by setting the fuse bits,
writing the flash program, writing the EEPROM data, and setting
the lock bits:

% make install-all

Alternatively, this firmware may be installed in separate steps:

% make install-fuse
% make install-flash
% make install-eeprom
% make install-lock
I might make a minor edit in this section to reflect there is an option for those not wishing to set the lock bits.
(4) Install the Firmware

To Install this firmware to an ATMEGA328P by setting the fuse bits,
writing the flash program, writing the EEPROM data, and setting
the lock bits:

% make install-all

To Install this firmware to an ATMEGA328P by setting the fuse bits,
writing the flash program, writing the EEPROM data, and not setting the lock bits:

% make install-fuse
% make install

Alternatively, this firmware may be installed in separate steps:

% make install-fuse
% make install-flash
% make install-eeprom
% make install-lock

GWDodd
 
Posts: 12
Joined: Fri Jul 26, 2013 1:56 am

Re: Ice Tube GPS Mod

Post by GWDodd »

Gawd--you guys are WAY over my head. I'm going to wire up the GPS, slap in the chip and see if it works. At this point, I'm doubtful.
One question (actually I have about a hundred), the photocell Phil references in his post, Digikey 5.6QBK-ND, is it the same or similar as the one referenced on the Adafruit site? I have one of those but I'll have to scare up the resistors you guys have been discussing.
John? Is the latest and greatest firmware you've been developing compatible with the original Ice Tube clock?

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

Re: Ice Tube GPS Mod

Post by jarchie »

GWDodd wrote:Gawd--you guys are WAY over my head. I'm going to wire up the GPS, slap in the chip and see if it works. At this point, I'm doubtful.
If you enabled the GPS option in config.h and successfully programmed your ATMEGA328P, the GPS mod should work. In the clock menus, do you see an option for "cfg regn"/"set zone"? If so, the xmas-icetube firmware was successfully installed with GPS support.
GWDodd wrote:One question (actually I have about a hundred), the photocell Phil references in his post, Digikey 5.6QBK-ND, is it the same or similar as the one referenced on the Adafruit site? I have one of those but I'll have to scare up the resistors you guys have been discussing.
The photocell and resistor are not required for the GPS mod; they allow the clock to automatically adjust the display brightness given the ambient light. You don't need to install those unless you want that feature.
GWDodd wrote:John? Is the latest and greatest firmware you've been developing compatible with the original Ice Tube clock?
Yes. The new firmware is compatible with the Adafruit Ice Tube Clock v1.1.

GWDodd
 
Posts: 12
Joined: Fri Jul 26, 2013 1:56 am

Re: Ice Tube GPS Mod

Post by GWDodd »

Hi and Thanks, John!
I'll install the chip and see if it works before soldering in the gps antenna. I'm working on the antenna now and it's very close to being ready. I bought the (now discontinued) GlobalSat 406A antenna from the Adafruit site and I've had to add some wire to make the leads longer. I try to be a perfectionist and that takes time. And I usually go real slow. Considering my location, one goof and the project is usually on hold for a month or longer waiting for parts.

Regarding the photocell, I was planning on installing that option as well. I ordered the photocell from the Adafruit site so I was wondering if it's the same or similar to the photocell Phil refers to.

Thanks again for reading!

Greg

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

Re: Ice Tube GPS Mod

Post by jarchie »

GWDodd wrote:Regarding the photocell, I was planning on installing that option as well. I ordered the photocell from the Adafruit site so I was wondering if it's the same or similar to the photocell Phil refers to.
It should be similar. I think most people use a 10k pull-up with the Adafruit photoresistor. Adafruit seems to sell photoresistors from several manufacturers, but they should all be similar (or maybe even identical) to the photoresistor mentioned by PhilD13. For that photoresistor, a 5.6k seems to be a good choice for most indoor environments.

As Phil mentioned, using a 1k would also work, but would bias the response for bright, semi-outdoor areas--in a sunny window, for example. Photoresistors respond to lighting changes on a log-scale, and 1k is 5.6 times smaller than 5.6k. So using a 33k (~5.6 times larger than a 5.6k resistor), would similarly bias the response for dark areas--nestled in bookshelf and away from windows, for example.

Bottom line: The Adafruit photoresistor should work well, and given typical indoor lighting, I suspect you'll be happy with any pull-up resistor in the 3k to 11k range.

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

Re: Ice Tube GPS Mod

Post by jarchie »

PhilD13 wrote:I was making the recommendation of not using make install-all so that the lock bits would remain unchanged.
I see, but why the aversion to setting lock bits? The Makefile only sets the bits that prevent self-programming, so the chip can still be be read and reprogrammed with an external programmer. And if you ever want to reuse the chip for something else, a chip erase will reset all lockbits, and a chip erase generally happens automatically whenever flashing the program memory. The benefit of setting the lockbits is questionable, but I cannot think of any downsides.

User avatar
phild13
 
Posts: 247
Joined: Mon Sep 10, 2012 1:05 pm

Re: Ice Tube GPS Mod

Post by phild13 »

The photocell is the same one that Adafruit sells or at least it is very similar and is the first datasheet on the learn site for photoresistors.
http://learn.adafruit.com/photocells
"These stats are for the photocell in the Adafruit shop which is very much like the PDV-P8001 "
The DigiKey link is
http://www.digikey.com/product-detail/e ... -ND/480602

The 5,6K resistor value is the result of John and I discussing what value would be best. It was decided that a value between 10K and 1K would probably be best all around. As John mentions if you know the environment then you can match the resistor closer the the light level found in the enviroment. If you don't know the environment the clock may be in or if the clock will go from a dark area to a bright area, then I would recommend something around 5.6K.
The 5.6K is what is listed for the resistor in the REV. D xams board and the photoresistor PDV-P8001 is also listed.
http://www.digikey.com/product-detail/e ... BK-ND/2243
and
http://www.digikey.com/product-detail/e ... -ND/480602

Of course, your free to order from your favorite place.

On the lockbits.

I had a case where the chip erase during programming did not appear to erase the lock bits which caused the chip not to program, and I had to try several times to the point where I thought I did something wrong and had bricked the chip. I was thinking that if someone was interested in maybe trying different firmwares then it would be best to not set the lock bits, just in case they don't erase properly or reset properly. That would remove a possible obstacle. If your not planning to try different firmwares, are giving the clock as a gift, or are aware that a chip might give some trouble erasing then I would recommend setting the lock bits.

One curious thing that may support detting lock bits. I pulled my UNO R3 chip the other day, set it aside and when I put it back in it (the bootloader) was corrupted. So maybe setting the lockbits would help prevent that from happening because of static.

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

Return to “Clock Kits (discontinued)”