Step 3: Program the Micro

The next step is to program the Microcontroller.

Just use whatever PIC programmer you use.

The Hex file is attached! Remember to use either the 50Hz or the 60Hz firmware depending on your region.

I have also added support to keep the clock running on battery backup when power is lost.

[Update] - I have updated the 50Hz and 60Hz firmware files - there was a simple coding error that affected the accuracy of the clock.
<p>I buld my own: https://youtu.be/fn1k5g4bUQ0</p><p>I also Programmed a Word Clock Generator to generate the Mask: https://goo.gl/JjQH3X</p><p>Maybe someone find this useful. </p>
<p>I want to make one which just says the days of the week. Can this be done?</p>
<p>It can certailny be done - The trick is to figure out how to do the transition, because for a while it may be wrong (say, you set it at 10am on Monday - if you used a 24 hour timer, then it wouldsay Monday untill 10am on Tuesday....)</p><p>Hmmmm - That is an interesting problem to solve.....</p>
I wanna make this project.<br>can anybody help me to code it.
There are hex files in the project. What type of processor are you using?<br>
just awesome.but i think it deserves a better typography.
I want to experiment with different typefaces - Can you suggest one that would be awesome?
hello...<br>I need to make this project. can you help me.<br>I am final year engineering student and need to make this as my project but not able to code it.<br>I want to use microcontroller atmega16 as I don't know how to use other.<br>plzzz help me...
<p>Very cool! Instead of making one myself, I would like you to send me one. ;~)</p>
Hi Tracey, <br><br>It is great to hear from you. <br><br>This project spawned a small hobby business for me (www.dougswordclocks.com) - I make clocks and send them all over the world. The design has changed somewhat, but you have seen where I came from :-)<br><br>Doug<br>
<p>i m recently make this project i connected a circuit as per circuit diagram but the problem is that all pin giving 0.20 volt what can i do next pls help sir</p>
<p>sir i want a help form u how we can replace 4Mhz ceramic resonator</p>
You can replace the 4Mhz resonator using a 4Mhz Crystal and two capacitors.<br><br>If you look at the schematic diagram, you will see the resonator connected to pins 13 and 14 of the microprocessor. The symbol used actually shows a crystal and two capacitors.<br><br>The PIC micro needs the capacitors to be 10 - 20pf to work.<br><br>Doug<br><br>
This is so cool!
thank you *drj113*<br>for Minute LEDs :-) good idea <br> nice clock..
When/where can I buy one of these? I'm not handy enough to make my own.
thinking of an acryllic face and vinyl print... just think it's easier, i'll let you know how it goes :)
it is much simpler :-)<br> <br> Have a look at my latest clock <a href="https://www.instructables.com/id/The-Wordclock-Grew-Up/">https://www.instructables.com/id/The-Wordclock-Grew-Up/</a> or <a href="http://www.dougswordclock.com">www.dougswordclock.com</a>
I'm wondering about the role given to { D2, D3, R32 } connected to RC0. - Diodes are probably acting as limitator, ok. Then I believe it may be used by the controller to know which part of the sine wave is occuring.<br><br>But I can't figure out why this information is needed. could you explain that please ?
D2, D3 and R32 work as follows;<br><br>The AC input to the bridge rectifier is coupled using R32 to the microprocessor - R32 has been chosen so as to effectively limit the current, so that the voltage excursions (both negative and positive) do not damage the diodes. Using 100K effectively limits the current to tens of microamps.<br><br>D2 and D3 act to protect the microprocessor input - The Zener conducts at 5V, preventing the pin from going above 5v, and the 1N914 conducts when the input tries to go negative (remember that it is an AC supply), effectively limiting the voltage to -0.7v Given the massive size of R32, the protection diodes may not be required....
Hello Doug, <br><br>Thank you for reply, but i really wonder why you need in code to know if the alternance is the positive one or the negative one. In other term why do you need to detect zero crossing of the grid ?
In this version of the circuit, he tells how much time has passed by counting the cycles of the incoming power. It's probably the most accurate of the easy hobbyist timekeeping methods, and doesn't require any expensive components. It does fail when the power is out.
That is correct - I don't detect zero crossings, I simply count cycles.<br><br>The project does fail when the power goes away, but my newer clocks use RTC chips so they keep timing even when mains is lost.<br>
Excellent project, thinking of taking the idea and trying to design one on my own... i got one question though, why didn't you use internal pic timer instead of counting cycles? just curious.<br><br>Thanks!
In this early clock, I counted cycles to get better accuracy. mains (here in Australia) is guaranteed in the number of cycles in a day so that the mains clocks are kept correct.<br><br>In the later versions, I moved to a RTC chip
OK i thought this method was too much inaccurate as the frequency varies on the grid with balance between electric supply and demand.<br><br>But i assume the variation isn't that much (here in France it goes to approx 50.01 or 49.9 Hz max and mini for a few minutes). As soon as your country grid is stable... It would be interesting to measure the deviation of the clock running with the grid (In the end the mean frequency over a day might be very close to 50 Hz).<br><br>I chose to use DS1307 maxim RTC, but i'll rethink the idea in term of cost-effectiveness (too bad i already bought the parts).<br><br>Bye, see you with pleasure
Hey. im 15 years old and i'm wanting to make this project at school. I live in New Zealand :) and i'm wondering how much the whole thing costs. I have a budget of $60 nz dollars. p.s useful nz electronic sites are jaycar nz. cheers :)<br>
Hi doug.<br><br>I'm trying to do the spanish translation of the clock, what IDE and compiler are you using for the C code? I'm using MPLAB with HI_TECH C Compiler lite but I have errors when I try to bulit hex file.<br><br>Thanks<br>Jorge Saiz<br>
Thats what I use for the PIC version. For the Arduino version, I use the Arduino IDE.<br><br>What errors are you getting?<br>
First of all I updated wordclock.h with definitions of the minute leds, next, when I build appear this error:<br><br>150.1 undefined identifier &quot;OPTION&quot;<br><br>and if I comment this line and try to rebuild appear this errors:<br><br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;UNPROTECT&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;DUNPROT&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;WRTEN&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;LVPDIS&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;BORDIS&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;PWRTDIS&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;WDTDIS&quot;<br>Error [800] wordclock_esp.as; 45. undefined symbol &quot;XT&quot;<br><br>Thanks!!
Ahhhhh - Thats a compiler version error..<br><br><br>Microchip (in their wisdom) have fiddled with the definitions used in their headers, and things broke.<br><br>Send me your email (to doug@doughq.com) and I will send you a current source version that works with their current compiler<br><br>Doug<br><br>
I have completed the translation of the code for the clock. I only have modified the definitions who were failing. After, I test with PIC Simulater IDE and it's work. Another question. If i implement the minute leds I have to use the 18pin of micocontroler for the led1? there are not problems with the 5v connection that come from the 78L05 to this pin?
Thanks<br><br>I send you a email.<br><br>Jorge
Hi Doug. Nice work!!<br><br>I'm trying to make the PIC version in spanish and have a question. In the list of component there is a 0.1uF capacitor (C3) but in the schema i don't find where you've placed it.<br><br>Maybe is with the 4Mhz crystal (X1)?<br><br>Thanks for all and sorry for my english.<br><br>
The 4Mhz crystal is actually a resonator (it has in built capacitors)<br><br>c3 is a power supply decoupling capacitor, placed between the +5v rail, and Gnd.<br>It I will have a look at the schematic to see where I stuffed up :-)
Like the 'Hidden' words in there Doug. ;-)
Who is Megan?<br> <br> Secondly, Would it be possible to make this with minutes as words but in a separate orientation? I am thinking of taking rows 5-9 and duplicating them in addition to your design.<br> <br> Visually:<br> <br> yours is...<br> <br> ITRISUHALFTEN<br> QUARTERTWENTY<br> FIVEQMINUTEST<br> PASTMEGANTONE<br> ONETWOZTHREE<br> FOURFIVESEVEN<br> SIXEIGHTYNINE<br> TENELEVENDOUG<br> TWELVEO'CLOCK<br> <br> mine would be...<br> <br> ITRISUHALFTEN<br> QUARTERTWENTY<br> FIVEQMINUTEST<br> PASTMEGANTONE<br> ONETWOZTHREE<br> FOURFIVESEVEN<br> SIXEIGHTYNINE<br> TENELEVENDOUG<br> TWELVELO'CLOCK<br> PLUSMONETHREE<br> TWOFOURASEVEN<br> FIVESIXEIGHTY<br> NINETENELEVEN<br> <br> A perfect 13 x 13?<br> <br>
I've just realized the &quot;NINETENELEVEN&quot; would be useless, however,<br>you could use &quot;NINEDAYVNIGHT&quot; or something like that...
Oh yea - You're right :-) Day/night would also be useful.
Ahh - Yep it would - you would need a larger face than the one I originally used - but with a vinyl stencil, all things are possible.<br><br>Oh - and Megan, she is my very patient wife, the one who I made theprototype clock for.
Hi drj113, I really want to make ur project, but I want to make it with an arduino, can it be done??<br>Can I do it with just 20 I/O pins??<br>What do I need to change in the code??<br><br>thanks for answering, <br>emihackr97.
You may be interested in the Arduino compatable controller that I designed - it is an extension of the Arduino Word Clock that you will find on Instructables - Have a look at www.dougswordclock.com<br><br>
hi sir!. I am making your project on my own and I want to know if I can use visual basic 6.0 to program your codes or if not what software can I use ?
The source code is able to be compiled with the Microchip IDE (in the case of he PIC project), and the Arduino IDE for the Arduino version.<br><br>The code is not Visual Basic.
Careful Mate!<br>If I couldn't complete mine, I am coming over to snatch yours!!<br>Coz I Love it!! Brilliant Idea!!<br>:D
:-)<br><br>Thanks for the comment - it made me giggle.<br><br>If it is helpful, I can provide complete kits or bits so you can get a clock working - check out www.dougswordclock.com <br><br>Take care mate,<br><br>Doug<br>
friend <br> would you please send me pdf fil of this. <br>thankes. <br>
More than happy to - what is your email address?<br><br>Alternately, full construction manuals are at www.dougswordclock.com<br><br>Doug<br>

About This Instructable




Bio: I have a background in digital electronics, and am very interested in computers. I love things that blink, and am in awe of the physics ... More »
More by drj113:A Grey Hat A Programming Jig for our DougsWordClock.com DeskClock Boards The Wordclock Grew Up! 
Add instructable to: