0

Dimmer mod for icetubeclock
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Dimmer mod for icetubeclock

by elwing on Wed Oct 28, 2009 5:14 am

that dimming mod seems quite mandatory, any chance for it to get in the next kit version?
elwing
 
Posts: 6
Joined: Thu Oct 15, 2009 8:13 am

Re: Dimmer mod for icetubeclock

by adafruit on Wed Oct 28, 2009 12:31 pm

its being considered, it didnt make into rev 1. we're likely to do a big update and also have it GPS-enableable (if that makes sense) as well.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Dimmer mod for icetubeclock

by len17 on Wed Oct 28, 2009 1:29 pm

daveparker wrote:Sweet! The constantly varying dimmer seems to work pretty well.... and it doesn't have the threshold value to fiddle with like the original code did.

So what's next? I'm thinking of making it display tweets. :)

Actually there are two threshold values (PHOTOCELL_DARK and PHOTOCELL_LIGHT) but if it turns out they don't need to be fiddled with, that's great. :)

I've been playing around with some display animations but I'm not completely happy with what I have so far.

len17
 
Posts: 394
Joined: Sat Mar 14, 2009 7:20 pm

Re: Dimmer mod for icetubeclock

by bastard on Fri Oct 30, 2009 3:54 pm

Hi,

added DST for Germany.

icetube-fw.zip
(41.17 KiB) Downloaded 288 times



Bye

Stefan
bastard
 
Posts: 54
Joined: Tue Aug 25, 2009 7:10 am
Location: Germany, Bavaria

Re: Dimmer mod for icetubeclock

by caitsith2 on Fri Oct 30, 2009 8:49 pm

And integrated it as some rule defines now.

For implementing it, make a new rule define, #define DST_YOURCOUNTRY 3 (or whatever isn't used. 0-2 are used.)

Then, where the rules are checked, you do #ifdef DST_YOURCOUNTRY, and in that block, check if dst_on is == DST_YOURCOUNTRY, then do all of your rule checking, ideally by calling dstrulecheck.

In the menu selection, add in your country code. If you look at DST_USA, and DST_GERMANY, you can get an idea as to how to implement the rules for your country.

A little nicer than #ifdef FEATURE_DST_DE common_dst_code #endif #ifdef FEATURE_DST common_dst_code #endif. If there is a bug in one instance, and you copy/pasted that instance, the bug will be in the new instance as well, and even if it gets fixed in one instance, I hate doing the fixing twice.

*** edit - deleted bugged code version. ***
Last edited by caitsith2 on Sun Nov 01, 2009 6:12 am, edited 1 time in total.
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

Re: Dimmer mod for icetubeclock

by bastard on Sat Oct 31, 2009 5:18 am

Hi,

caitsith2 wrote:And integrated it as some rule defines now.


nice work! Thanks.

Bye

Stefan
bastard
 
Posts: 54
Joined: Tue Aug 25, 2009 7:10 am
Location: Germany, Bavaria

Re: Dimmer mod for icetubeclock

by Troubadix on Sat Oct 31, 2009 11:15 am

How about adding the dimmer mod as an option to the kit with a dropdown menu, like you did here?

The firmware would need to check if the photocell and the resistor exist, and if so it would offer the "automatic" setting in the brightness menu. This way you could go with one firmware version to cover both options and would only have to add the photocell and a 1k resistor.
Troubadix
 
Posts: 18
Joined: Fri Oct 09, 2009 1:09 pm

Re: Dimmer mod for icetubeclock

by caitsith2 on Sun Nov 01, 2009 6:11 am

Fixed a VERY serious bug in the Daylight saving code, that was not present in the original code, but was present in the multi-region version.

The issue was uncovered by me noticing the clock stuck on 4:xx:xx AM constantly, given that it was afterall, the first sunday of november.
Attachments
icetube-fw.zip
(33.49 KiB) Downloaded 515 times
caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

Re: Dimmer mod for icetubeclock

by daveparker on Sat Nov 07, 2009 1:11 am

I received a request to post details about the photocell I used for the dimmer mod. The photocell I used came with the Arduino starter pack sold by Adafruit. The sensor is also available separately on the Adafruit website.

The photocell acts as a pull-down to ground. Pin 28 on the IC provides power (5V) to the R4 current limiting resistor. The other side of the R4 resistor is connected to ground via the photocell. Pin 27 on the IC is also connected to the other side of R4 (the same connection point as the photocell) to sense the voltage across the photocell. When the room is bright, the photocell conducts and the voltage across it drops to near 0V. When the room is dark the photocell doesn't conduct and the voltage across it approaches 5V.
daveparker
 
Posts: 10
Joined: Sat Jan 03, 2009 11:46 pm
Location: San Francisco

Re: Dimmer mod for icetubeclock

by adafruit on Sat Nov 07, 2009 10:35 am

the particular cds cell is doc'd here http://www.ladyada.net/learn/sensors/cds.html

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Dimmer mod for icetubeclock

by khoyt on Thu Jan 07, 2010 6:32 pm

Len17 wrote:Here's my version of Ice Tube firmware with auto-dimming. It's based on daveparker's version, but with some differences:
  • CdS photocell is the one from the Adafruit store and R4 is 1kΩ. This is a combo I've used before and it gives a good range of values between dim room light and sunlight.
  • Instead of switching between dim & bright, the display brightness varies continuously based on the ambient light.
  • Auto-dimming is turned on by selecting "au" (automatic) in the brightness menu.
  • I've also incorporated caitsith2's button interrupt fix.
  • Also I changed the "9" digit so it looks like every other 7-segment display I've ever seen.
  • Added features can be enabled separately at compile time. Look at the top of iv.h.
Compiled firmware and source code are attached.


How does the 1kΩ behave differently than the 10kΩ resistor? Does it affect the dimmer or does it not matter much?

And another silly question... is the resistor a "1/4watt" one? I'm guessing that is the right one because it's the right size :roll:
khoyt
 
Posts: 4
Joined: Thu Jan 07, 2010 12:30 am

Re: Dimmer mod for icetubeclock

by len17 on Fri Jan 08, 2010 1:10 am

khoyt wrote:How does the 1kΩ behave differently than the 10kΩ resistor? Does it affect the dimmer or does it not matter much?

I haven't tried a 10k resistor, but like I said using a 1k resistor with the Adafruit photocell gives a reasonable voltage spread in various light conditions. I think a 10k resistor would work OK, but you'd have to tweak the auto-dimming code. If you use my code, adjust the PHOTOCELL_DARK and PHOTOCELL_LIGHT values based on the readings you get with the 10k resistor.
And another silly question... is the resistor a "1/4watt" one? I'm guessing that is the right one because it's the right size :roll:

A 1/4 watt resistor is more than sufficient. Or even a 1/8 watt.

len17
 
Posts: 394
Joined: Sat Mar 14, 2009 7:20 pm

Re: Dimmer mod for icetubeclock

by khoyt on Sun Jan 17, 2010 8:46 pm

Ok, got it working!

Dimmer mod seems to work, this was the first time I've reprogrammed anything, even got it working from my Mac :mrgreen:


And because this was the hardest part of the entire process, here is the command I used to flash it:

avrdude -vv -c usbtiny -p m168 -B 32 -U flash:w:/icetube-fw/ivbin.hex
khoyt
 
Posts: 4
Joined: Thu Jan 07, 2010 12:30 am

Re: Dimmer mod for icetubeclock

by ssquire on Mon Feb 01, 2010 7:54 pm

adafruit wrote:its being considered, it didnt make into rev 1. we're likely to do a big update and also have it GPS-enableable (if that makes sense) as well.


That's great news. Those are exactly the two things I was considering as my first mods too! Well that and figuring out how to program it to make things like a stop-watch or timer too.

ssquire
 
Posts: 9
Joined: Mon Feb 01, 2010 7:26 pm

Re: Dimmer mod for icetubeclock

by gatonero on Sun Mar 14, 2010 2:23 pm

Yesterday I got my Icetubeclock and today it's running with autodimming, DST and test function :mrgreen:
gatonero
 
Posts: 5
Joined: Sat Mar 21, 2009 6:37 pm
Location: Aachen

Please be positive and constructive with your questions and comments.