LLOONNGG week of packing, moving, and unpacking. Still not done unpacking. Probably won’t be fully unpacked by the time we move again Oh well.
ANYWAY! Onward and upward!
[ I really like my little Paint.NET logo, so thought I’d throw it in again 😉 ]
So since my last post I began working on NTP (Network Time Protocol) synchronization. As with EVERY part of the project so far, there were a lot of snags along the way, but I got it there. It’s a truly crippling problem having the maker of my WiFi chip defunct. It leads to all sorts of problems with documentation and community support. But “Damn the torpedoes!” I say! FORWARD!
I had to implement the NTP protocol on my end. I simplified it quite a bit by not taking advantage of many features [40 bytes of hard coded zeros in the middle of my message 😉 ], so it was actually pretty easy. Sending and receiving the UDP packets, however, was a bear because of the poor documentation for my WiFi chip. Took quite a bit of fiddling, but I got it working.
Then I found the great little Time library for Arduino that allows for easy manipulation of time and time keeping, and set that up to use my new NTP code for synchronization.
Putting it all together, here you can see the current boot sequence for the C3:
With this working, I set it up for a soak test. I wanted to see how much time the Arduino would lose after it synchronized only once, that way I could figure out how often I would have to re-sync with the NTP servers. After 24 hours I had lost just under a minute, and after 48 hours I had lost just about 2 minutes, which looks pretty good because it doesn’t seem to be accelerating. It’s a pretty minimal, and a pretty linear loss. I could probably sync with NTP as little as once a day, but to be safe I’ll probably start by syncing every 12 hours.
So that’s all good! But during the soak tests I did discover yet another problem with my WiFi software stack. It doesn’t automatically reconnect when it’s connection to the WiFi AP is dropped. It’s a fairly minor problem in the software stack that I already found someone’s patch for. My version of the stack is already pretty customized however.
So my next goal will be to setup auto-syncing at 12 hour intervals. Merge the WiFi auto-reconnect patch with my customized stack. And finally further customize the stack in preparation for working along side the display shield I will eventually be integrating. (I need to move some pins around in the code)
With all of that I should have a rock solid NTP clock, which of course is the necessary basis for everything going forward. After that I can focus on Google Calendar integration and other “fancy features” like audio output and a display