NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Do you think a binary/POV watch is possible with Nerdkit?

January 15, 2010
by Solorbob
Solorbob's Avatar

I saw binary and POV watch and started worndering if I could build something like it myself. Do you think it is possible with the nerdkit? Here's a link to the example I'm talking about.

http://www.embedds.com/cool-binary-pov-watch/

There are other websites talking more about it, but they sell the kits and such, so I'm not going to post that link here.

Thanks, Shawn

January 16, 2010
by Rick_S
Rick_S's Avatar

From a hardware and programmability perspective absolutely doable. The mega168 is physically larger chip than the PIC that was used in their project but could definitely be programmed to function the same. Aesthetically -- pretty ugly -- but as they say, beauty is in the eye of the beholder... :D

If you search for minipov on the web you'll find an example of a project for pov using avrgcc. This could give you a reference for the POV portion of the code. Now that particular project uses a tiny2313 as the micro controller but it shouldn't be hard to port that over the 168 used in the nerdkit.

Have fun and show us your progress.

Rick

January 16, 2010
by Solorbob
Solorbob's Avatar

Thanks Rick. I just ordered 3 more MCU's yesterday, so I'll have some for other projects. Maybe I might give this one a go.

Shawn

February 01, 2010
by Solorbob
Solorbob's Avatar

I’ve been doing a bit more research to see how I might go about the Binary watch using the nerdkit. I have a few things that I would like to ask to see if I’m off the mark or heading in the right direction.

1.) I want to run this via a single cell LIPO battery. It is 3.7v at 70mAh (at minimum). I see that the ATmega168’s data sheet will operate at that voltage, but only up to 10MHz. I’m assuming that I’ll need to get another crystal oscillator to operate at the 3.7v. If so, I was planning on using the supplied crystal and power supply to program it, but I will move to the LIPO and other crystal to use it.

2.) I'm planning to have the leds be off until a button is pushed. Once pushed the time will be displayed for 1 minute. I'll have 4 hour LEDS and 6 minute leds. (LEDs I'm planning on using are 3mm having an operating voltage of 2v with an operating current of 10mA. If I plan on pushing the button once every 15 minutes for all 8 hours of my work day. This comes to 32 minutes of LED display time. How long do you think this would last with the above LIPO having 70mAh?

3.) I see that the ATmega168 will accept a 32kHz crystal oscillator. I looked around to try to understand why I would choose this type oscillator vs. a 4MHz, 6MHz, or 8MHz oscillator. Can someone give some guidance or advice on this? Also, I don’t quite understand how to get from the oscillator value to a millisecond time tick count. I’ll dig into this next. If anyone can point me to a good resource for calculating this, I would appreciate it.

Thanks, Shawn

February 01, 2010
by Phrank916
Phrank916's Avatar

the 32.768 Khz crystal oscilator oscilates at 32,768HZ and this figure is exactly half of a 16bit counter (which maxes out at 65,536). So if you set one of the 16 bit counters to use an external crystal and then hook up one of these, you can start the counter counting a 32768 and when it overflows at 65536 you know that exactly one second has passed. Reset the interrupt, and start the counter over again.

February 01, 2010
by Phrank916
Phrank916's Avatar

Sorry "technically" the counter maxes at 65535, since it starts at 0.

February 02, 2010
by treymd
treymd's Avatar

Holy moly that's cool. Hey, there's a whole new way to get your advertising message out there. Strap a bunch of LED's to your motorcycle jacket and zip around town at XXXmph.

February 02, 2010
by Phrank916
Phrank916's Avatar

One caveat I forgot to mention about using the 32Khz watch crystal. If you look at the pinout for the ATMega168 you'll notice the pins where we have the 14.7456Mhz crystal, labeled XTAL1 and XTAL2 are also labeled TOSC1 and TOSC2, which I believe stands for Timer Oscillator. So, if you decide to use a 32KHz crystal to create an asynchronous timer, the chip clock has to use the internal 8MHz RC oscillator. Pages 79, 152-153, and 160 of the MCU spec sheet have more info on this.

February 02, 2010
by Phrank916
Phrank916's Avatar

A little more research uncovered a problem. The 16 bit timer on the ATMega168 doesn't have asynchronous operation. So you'd be using the 8bit timer2 which overflows at 255. If you prescale the 32KHz clock by a factor of 8 that gives us a 4096KHz clock which allows us to create a 1/32 second tick every 128 clock cycles, meaning you can do basically the same thing splitting the timer in half and set the compare at 128 on the 8 bit counter. Here's a link that might make more sense than I'm probably making.

8 bit timer w/ 32KHz crystal

Ted

February 02, 2010
by Solorbob
Solorbob's Avatar

Phrank916 - thank you for all of your information. I'll take a look at the link you posted today after work.

February 02, 2010
by mcai8sh4
mcai8sh4's Avatar

Hi Guys/Girls/others(?!),

This sounds like a great little project. My apologies (to anyone who reads this) that I haven't been posting much recently, I have a lot going on at present and my 'play' time is very limited!!

Just in case you haven't seen it, I made a binary clock a while back using the std NerdKit.

You can find my random comments/questions/pics/code HERE

I'm not sure about this, but the atmega168 does have an internal 8mhz clock - has anyone thought about using that to eliminate the need for an external clock. (If this has already been considered, then please forgive me - I'm speed reading everything)

Hope I can be around more in the future to continue playing around and learning.

Best of luck with this project - make sure you keep us all updated.

Best regards, Steve

February 02, 2010
by Solorbob
Solorbob's Avatar

Would this be correct? If I want a 1/2 second tick (2 ticks per second) using the 32Khz crystal, I would have a comp value of 16 based on a 1024 prescale. I didn't check the spec sheet to see if this was possible for the chip, but as a learning experience for myself.

Then each time I counted to 16 it would be 1/2 second.

February 02, 2010
by Phrank916
Phrank916's Avatar

Yeah, sounds right to me. A prescaler of 1024, which is the highest you can go, would give you 32Hz. So a comp of 16 would be 1/2 second.

February 02, 2010
by Solorbob
Solorbob's Avatar

Thanks Phrank916. Maybe I'm starting to understand some of this stuff.

mcai8sh4 - I saw your post about a week ago. I did download your code and build a prototype binary clock. I'm using your code as a starting point for my effort.

February 03, 2010
by mcai8sh4
mcai8sh4's Avatar

Solorbob : I'm not sure if I've posted my latest code, if you want what I've got (probably only slight changes), let me know. I'm really looking forward to seeing your watch, I wanted to do the same - I still intend to make a 'finished' binclock for my desk - as soon as time becomes available then I'll do it.

Good luck,

-Steve

February 03, 2010
by Solorbob
Solorbob's Avatar

Steve, That would be great. I would like to have it, if for nothing else as a reference tool.

I've made out how I think this thing should work. If anyone sees something that looks bad or wrong, please let me know. I made an initial instruction manual for the watch because I plan on making a few for gifts.


Binary Wrist Watch Information
v1.0
2/3/2010
dagroundzero@gmail.com

~

Hardware: ATmega168 mcu from Nerdkits.com LIPO 3.7v 70mAh battery 32Khz watch crystal 11 red 3mm Leds (10 LEDs for time and one for mode in the 16 position on hour row) 2 momentary push buttons

Operations Modes: Mode 1: Binary Watch Mode 2: POV (digital watch read out) Mode 3: POV (Hello World message or pre-programmed text) Mode 4: Time set - minutes Mode 5: Time set - hours

Switching Modes: The watch will stay in the current mode until it is changed by pressing the mode button. Each time the mode button is pressed, the mode LED, (led in 16 position on hour row) will flash. The mode LED will flash X number of times to indicate the mode. Each flash will have a ??(experiment) millisecond delay. This flashing is known as a flash cycle. The flash cycle will repeat every 30 seconds for the first 2 minutes. After that, the mode LED will not flash again until the mode button is pressed.

Buttons: Button A will be on the bottom row right side.
Button B will be bottom row left side.

Operation Instructions: Mode 1: Binary Watch • Push button A until mode LED flashes 1 time per flash cycle.
• Push button B and the time will be displayed in binary format for 1 minute.
• After a minute the LEDs will be turned off to conserve battery power.

Mode 2: POV Watch • Push button A until mode LED flashes 2 time per flash cycle.
• Push button B and the minute row of LEDs will start flashing for 1 minute. • The user can swing their arm back and forth to display the time via POV effect.

Mode 3: PPV Message • Push button A until mode LED flashes 3 time per flash cycle.
• Push button B and the minute row of LEDs will start flashing for 1 minute. • The user can swing their arm back and forth to display the programmed message via POV effect.

Mode 4: Time set - minutes • Push button A until mode LED flashes 4 time per flash cycle.
• Push button B to increment the minutes by 1 minute.

Mode 5: Time set - hours • Push button A until mode LED flashes 5 time per flash cycle.
• Push button B to increment the hours by 1 hour.
~~~~~~~~~~~~~~~~

Coding time..

--Shawn

February 05, 2010
by Solorbob
Solorbob's Avatar

I have gotten the initial bit of coding done, and I posted a vid for some folks at work asking about the project. I thought I would share it here too.

I still have some more coding to do around the POV modes.

http://www.youtube.com/watch?v=H5ky6N5rsKU

Shawn

February 18, 2010
by Solorbob
Solorbob's Avatar

I got the POV part of my watch working. I can't see it in person, but the cam picked it up nicely.

[Time example] (http://www.flickr.com/photos/smokinshawn/4369120049/)

[My name in lights] (http://www.flickr.com/photos/smokinshawn/4369119833/in/photostream/)

Should one be able to see this with just waving it around without using a camera? If so, then I have some more work to do. I'll take any and all suggestions.

Shawn

February 19, 2010
by mcai8sh4
mcai8sh4's Avatar

Cool - That looks great.

You should be able to see it with the naked eye - perhaps you need to alther the timing(?)

I had a kit that displayed stuff when you waved it around, but it wasn't very good.

Post a Reply

Please log in to post a reply.

Did you know that NerdKits believes in the importance of a mixture of meaningful topics, clear instruction, and engaging projects? Learn more...