I began another microcontroller project using the Picaxe. I wanted a clock that would look highly technical but present the time in a
old fashioned way. My aim was to display the time as just "Quarter past ten" on an LCD screen and then to occasionally show one
of a series of strange comments on life just to spice things up.I remembered seeing a whole series of strange sayings on the old cinemas around Times Square New York in the mid 1990’s. The seemed to offer a comment on everything that was happening around them but no one seemed to know anything about them. I asked in the working cinemas, the shops but no-one knew anything about them - I eventually found a girl in the ticket office of a soft porn cinema who gave me the answer "it’s an art project". I even wrote a story on the sayings I saw.
The circuit here shows from the left the serial interface resistors, the picaxe 18X, there is a little micro switch for altering the time, the clock chip, the backup battery and the eeprom chip. The large box on the right is the battery box and the 16x2 LCD screen rests on top of the wiring.
It turned out the LCD required 9600 baud but the Picaxe only went up to 4800. Luckily you could double the clock frequency in software so you could simulate 9600 but of course every other timing code would get upset by the change. Next I had to work out how to send special commands to the LCD to clear the screen etc. I managed to do this but, in the process, turned the backlight on and it’s stayed on ever since! Hopefully I’ll workout how to turn this off soon or I’ll need new batteries every other day.
I added the clock chip (a DS1307) and a backup battery and everything started to work quite quickly. I managed to get this far and
get all the software to show the time correctly in one evening. This was massive progress compared to my last project. The time goes
a bit weird when it gets to 13:00 - I’d hoped it would stay to a 12 hour clock but this should be easy to fix. Backlight still on.
It didn’t take long to wire in the eeprom chip. The only problem is I can’t seem to be able to read or write to it! The big problem
with micro-controllers, when things don't work first time, is trying to work out what is causing the issue - is it a programming error,
a wiring error, problems with changing the speed of the picaxe, problems on the i2c bus between the chips ... it goes on.I started copying simple programs that would read and write to the eeprom chip and everything seemed fine. That ruled out a wiring problem. I tried expanding it so it could write messages to LCD and again seemed fine. Then tried reading the clock and it all went wrong. At least I knew where the problem was now, it seemed that if I was accessing 2 i2c chips on the same circuit then I needed to reinitialise each chip before accessing it otherwise it thought it was still accessing the last chip initialised.
The clock was now working fine and I had about 20 messages stored on the system. I guess I could store around 60 messages without requiring
a separate program to do the initialisation of the eeprom but seeing as the LCD only displays 32 characters then I guess there are probably
only that many messages that will fit. I also need to add an adjust the time button to allow people to alter the time when the hour changes
etc.The big problem left is how to display this project - I felt it was better to keep all the insides on show rather than hide them in a box. It would contrast more with the old fashioned method of displaying the time. I imight add a small blinking LED to show that the system is working and to draw attention to the unit but I'm undecided at the moment. I'm also unsure how long the batteries will last with the LCD permanently running - I guess only time will tell. I did manage to turn the backlight off though!