Imp Digital Clock

@deldrid1 - I’ve actually written a class for interacting with the ws2812 / NeoPixels. It requires release 26 (which isn’t public yet). Once release 26 goes out I’ll move it to the Electric Imp GitHub repo.

The timings required by the NeoPixels are kind of difficult to hit… so we use the SPI bus to “fake” the data - at 15MHz the clock cycles are granular enough to mostly hit the timings (they fall within the allowable range).

Since it the timings aren’t perfect, on long chains of NeoPixels you’ll get some unexpected behaviour. This might actually be a power issue - I’m going to investigate later today and will report back :slight_smile:

All in all, it mostly works… and is a good first step :slight_smile:

time() on Imp drifts about 4ms/min. That’s not good. millis() can be made much more accurate by multiplying by a constant. I’ve gotten 10ms/day. You can sync with NIST to get an absolute accuracy of about 10ms. 1/100th of a second. Depending on your internet connection. You can keep this accuracy by syncing again every day. No hardware is needed. Interested?

@sbright33 Yes, I’m interested. Do you have squirrel code for this?

If you disconnect and reconnect from the server, it will resync time. We’ll look at adding a less severe way of doing this, though it’s usually only a couple of seconds.

You’d have to do this every hour, or it will be off by 1/2 additional second. Plus up to 1 second to begin with when you sync time() by reconnecting. Great for some applications, but much greater than 1/100th second if you need that.

@beardedinventor were you able to confirm a power supply issue? How many neopixels have you been able to drive without any problems?

It was not a power supply issue - it turned out to be another issue with the imp’s clock. Right now I’m solving it by setting enableblinkup(true).

I ran the code on a strip of 120 NeoPixels and it mostly worked - it still occasionally jitters, but that seems to happen mostly when you’re updating around 20+ times per second.