Skip to main content
Topic: SNTP Display V1: New Firmware for #twatch (Read 9697 times) previous topic - next topic

SNTP Display V1: New Firmware for #twatch

I've rewritten the firmware on my #twatch to implement a simple SNTP display.
[attachment=0]

I've wanted an SNTP display clock for a long time.  I work at a cable TV access facility and time is very important to us.  Commercial NTP displays are very expensive, and until recently, we could not even consider any sort of NTP server.

While the #twatch is not the ideal display I envisioned, it was an excellent first try on my part.  I had to make some simplifications due to the lack of configurability and the limitation of the flash memory in the Microchip controller.  The clock only displays UTC, and in the American format at that.  The display uses the default pool.ntp.org addresses to get its time from;  it's not possible to specify a custom NTP server.  (Both I and my workplace each have a Garmin GPS module and an NTP server, which were, ironically, much cheaper and easier than a display has proven to be!)

Code-wise, I removed Ian's twitter parsing code, and implemented new clock code using the UnixSeconds value that the Microchip stack provides, and the date/time determination code from a Maxim appnote.  I added some routines to Ian's HD44780.c to display zero-filled and space-filled number fields.

In main.c, my code monitors the tick count (and monitors the state of the LCD server) and calls my clock display code once a second.  The clock display code gets the Unix seconds from the stack and does the arithmetic to get the day of year, day of week, month, day, year, hours, minutes and seconds, which are all sent to the LCD (with English abbreviations for month and day.)  Otherwise, main.c is very similar to the #twatch with the addition of some human-readable display state codes.

The LCDTCPServer.c code is nearly as-is--I added some debugging code to display the status of the LCD Server state machine as a single character on the LCD, since I had some trouble with display codes being lost.  (The cause was due to some settings on my managed switch that the module is connected to;  this problem would not be seen on a consumer router.)

I don't have Microchip programming hardware so I depended on the TFTP bootloader.  I used the LCD itself for debugging quite a lot, and did a lot of commenting out until I got a time display that worked and counted.  (The numeric display code proved to be the long pole in the tent.  The LCD Server code was another thing altogether!)

I maintained full compatibility with the Matrix Orbital emulation on the original #twatch.  Since I am in a Windows environment and I am a sysadmin, I wanted to use the LCD emulation in my management software.  I wrote a module in PowerShell that accesses the display and allows scripts to interact with and use the display for notifications.

I fully implemented the MCHP discovery protocol in my Powershell code--I'm proud of that--so that it's not necessary to get the IP display on the #twatch to find its address, though I maintained that function.  In my module, one function will send a MCHP broadcast to the device, get its IP address, and return it to the script as an object to supply to the other modules to clear the LCD, display text, position the cursor and so forth.

I produced a video demonstration, showing the clock and the Powershell display code that runs throughout.
Edit:  Linked at http://http://www.youtube.com/watch?v=X1jNZl8mrMM&feature=player_embedded

I've collected many different dev boards over the years, but this is the first project I've actually gotten to complete.  While my clock doesn't have the big digits I wanted, or the NTP serving capability (that is next), I'm very happy with how it came out.  It looks striking, and would be even more so if I had farmed out the case (I am so not good at mechanical design!)  It's always good to have a first time and get through it--the next time will be easier, no matter what platform I work on!

(BTW, to put a question to rest here:  Heat has not been a problem with my enclosure, which is considerably larger and deeper than the device itself.  The #twatch barely gets warm.  I'm using it with a Phihong 7.5VDC wall plug from Mouser.  I have commerciallly-designed network hardware that you could cook off of!  Why the #twatch is such a hazard and my oven-hot DSL modem isn't, I have no clue...  I'd like Ian to have a talk with the engineers at Westell.)

Link to the firmware and source: http://http://davidcmoisan.wordpress.com/2012/05/22/a-simple-ntp-clock-display/

Thanks, Ian for your hardware design and your helpful advice when I got my device a few months back.

Re: SNTP Display V1: New Firmware for #twatch

Reply #1
Thanks for the update, I'm glad you could hack your #twatch. We'll post it up on the blog when you post the code (or earlier if we get anxious) :)

Quote
(BTW, to put a question to rest here: Heat has not been a problem with my enclosure. The #twatch barely gets warm. I have commerciallly-designed network hardware that you could cook off of! Why the #twatch is such a hazard and my oven-hot DSL modem isn't, I have no clue...)

Just out of an abundance of caution. It's a novelty hacked together for fun, not really a properly engineered device tested in a commercial enclosure. It also depends on the supply voltage. If you can give it the recommended 6-8 volt power supply heat is hardly an issue, but if you go to 12+ the regulators start to heat up.
Got a question? Please ask in the forum for the fastest answers.

Re: SNTP Display V1: New Firmware for #twatch

Reply #2
The code is finished, I just need to finish the documentation and package it--work has not been kind to me.  I understand about abundance of caution and was glad I could verify its safety for myself--it's running 24/7 on my computer desk, and I don't want it to cook anything either!

Re: SNTP Display V1: New Firmware for #twatch

Reply #3
The code is done!

I've made it available as a zip file on my web site:
http://http://www.davidmoisan.org/comp/code/sntpdisplayv1complete.zip

Instructions are in the zip file or separately at http://http://www.davidmoisan.org/comp/code/LCDDisplay.pdf.

My blog post on the display is at http://http://davidcmoisan.wordpress.com/2012/05/22/a-simple-ntp-clock-display/.

The zip file has complete source, firmware, and a PowerShell module for using the LCD emulation.

 

Re: SNTP Display V1: New Firmware for #twatch

Reply #4
Very cool! Thanks for sharing, we'll post it up.
Got a question? Please ask in the forum for the fastest answers.