Neopixel sunrise alarm clock

My bedroom doesn’t have much natural light, but I enjoy waking up with the sunrise so this is a problem. I think it’s a problem that can be fixed by using a :spark:, Neopixels, and a website.

My idea is basically using to have a website that functions as the frontend to my alarm clock. From there I can set the alarm time and how long to fade the Neopixels in for. I’d also like an RGB color picker that I could use to control the Neopixels even if the alarm wasn’t going off.

When the alarm goes off the neopixels would turn on in a dark blue color and very dim, over the next X minutes, they would fade to a orange then yellow then white while progressively getting brighter.

Does this sound doable? I’d love some ideas if you think it’s doable.

4 Likes

This is good idea! I am plannig to do someting like that!

Very doable! :slight_smile: I like the idea as well. Heck, I like anything with NeoPixels!

  1. https://github.com/technobly/SparkCore-NeoPixel

  2. https://gist.github.com/technobly/8387151 (DS1307 RTC)

  3. https://community.spark.io/t/getting-utc-time-from-ntp-server/1213

This commercial one from Philips was a birthday gift to my wife: http://tinyurl.com/lbagxku (Amazon UK). Maybe the manual, the pics and the videoclips give you some more inspriations. I read some tests, and it seems to be the best choice.
We like the sunset when we go to bed, it really brings you down. In the morning the sunrise takes 20 min to reach 100% (adjustable time and brightness), then 1 of 5 natural sound (birds in the trees, ocean waves,…) or the FM radio starts fading. Wakeup-Snooze only stops the sound, but not the light. the front is a capacitive surface for snooze function.

So many possibilities:

  • A fog machine turns on and blows a morning mist into your bedroom.
  • A can of compressed air is released, sending fresh morning air into your nostrils (using a camera and face recognition software to aim the nozzle).
  • A servo slowly rolls your bedsheets down to your feet.
2 Likes

@mf2105 Thanks for the link! I’ll take a look at it and maybe steal a few of there features!

@topfunky I like the way you think! Now if only my :spark: would just go to school and do my homework for me I’d be set. :wink:

2 Likes

@shocku992 you could get the time of the sunrise from openweathermap.org. They have various web services providing actual weather conditions and forecast. But I could see that they are also providing sunrise and sunset.
Check it out: http://api.openweathermap.org/data/2.5/weather?id=2643743

For London: [..]"sunrise":1390377095,"sunset":1390408369[..]

Hmm. But converting 1390377095 to DateTime in c# returns {01.01.0001 00:02:19}

Sorry, so not sure if it’s usable for you.

1390377095 is a “seconds since epoch” value, so it will work just fine. Here’s a web page that does it for you:

http://www.epochconverter.com/?TimeStamp=1390377095

GMT: Wed, 22 Jan 2014 07:51:35 GMT

Google around for “epoch to datetime” and find a code snipped you like.

Rise and shine!

Dave O

You beat me to it @dorth! :slight_smile:

For a clock like this, if you look up the sunrise/sunset time and it’s in unix time, and you compare to an RTC that is also in unix time… all you need to do is 1) leave them all alone (GMT+0) for your comparison… or 2) convert them pretty easily UP or DOWN for your timezone (e.g. GMT-6) by adding or subtracting the number of seconds in an hour times the number of hours you need.
uint32_t gmt_minus_6 = unix_time - (uint32_t)(6 * 3600);

Works good as far as I can tell for Chicago, IL http://api.openweathermap.org/data/2.5/weather?id=4887398

What I lack in brains I make up for with speed! :slight_smile: But you bring up a good point about “needless conversions”. Epoch is ugly to look at but really easy to work with!

@kwyjib​0 - thanks for the link to that web site. I’ll have to keep that in mind for some future projects.

Dave O

Thanks for the info Guys. As soon as all the parts come together I’ll start working on it. At this rate all i’ll have to do is copy and paste. :wink: Keep the info coming!

1 Like

My RGB LED’s arrived today along with my Temp/humidity sensor. Now if only my :spark: would stop saying “Electronic Shipping Info Received” and hurry up and get here! Come on post office, it’s been a week!

It’s been a while since i’ve updated this thread! I’m still waiting on my second :spark: but I’ve been doing some testing with my first one. I’ve got the Realtime clock working, and the Neopixel library so I’m almost there. My next hurtle is going to be figuring out how to get the spark to pull a variable from a webpage. I want to be able to set the alarm time from a webpage, and the :spark: get that time as a variable and of course start the alarm sequence at that time. Any thoughts or suggestions?

Apart from being an awesome project, the MessageTorch by @luz also makes use of parameters which can be called upon through the rest API. You might be able to edit that in a way so you can use it to pass your time through to the core, without having the core looking for changes in variables. Seems like a logical solution, but there are more experienced people on this forum who could be of more assistance than me.
I’m hoping this project works out, because I’m planning to stuff about 24m of RGB strips in my ceiling to act as a wake up light :wink:

Good luck!

Link to the projects github: https://github.com/plan44/messagetorch/blob/master/messagetorch.cpp

I agree with @Moors7. You can easily pass in parameters from a web page through a [Spark.function();][1] as arguments.

You can do this with modifying my Remote Spark web app pretty easily. Or perhaps take a look at Luz’s project. I don’t know which would be easier. For setting the time, I’d think you’d need some nice scrollers or drop down fields to select the time, and then hit a button that says “Save” or “Set Time”… I actually need to do this for a project I’m working on as well, so if you beat me to it, please post something here :smile:
[1]: http://docs.spark.io/#/firmware/data-and-control-spark-function

Thanks guys! I’ll take a look at your project @Moors7 and Thanks for that @BDub. I’ll take a look at the spark.function. I doubt I’ll get to it before you. This is midterms week, I’m slammed, but maybe over spring break I’ll post something up if you haven’t.

Something else to think about… Another way to do this is to turn your Neopixel clock into it’s own TCP Server, and have it dish up a simple web interface. This puts more load on your clock, but could provide a faster response and you would not have to upload a web app somewhere, you would just save a link to an IP address on your local network. This is assuming you don’t need to be able to set it from the road, but you COULD forward a port on your router and still access it out and about as well.

I think you did this with your Spike Mon project, but used the RasPi right? I’m not sure how you had that all routed, but you probably wouldn’t want to have a ton of graphics if serving it up from the Core directly.

I hadn’t thought about that! That could work. It would be all self contained. I’ve got a static IP and a domain name that route back to my place. It would be easy to forward a port over to the :spark:. Something to think about indeed.

Just wanted to make sure you saw this:

:wink:

If you’re looking for some RGB colours, you can take aa look at these kelvin gradients