hello i was wondering it anyone has written a sunrise/sunset program with a timer

hello i was wondering it anyone has written a sunrise/sunset program with a timer for Adafruit NeoPixel Stick 8 x WS2812 5050 RGB LED with Integrated Drivers ! I have no clue how to do it i want to use it for my planted aquarium to simulate sunrise in the am and then have it go in to sunset in the evening . if anyone has any code or know where i can get it i would greatly appreciate it

@Andy_Muntz - If you use the search community box on the left of this page and search for sunrise, you will find:


This provides you with the some of the information that you want.

I’ve got a library I use with FastLED all the time. But it requires some programming expertise as it requires some setup.

Are you asking for a complete program? I won’t do that, but I can post my github link and some help to get you started.

i don’t understand the fast setup programing i have not done any programming in 20 years . so i am trying to relearn it i have a basic understanding of how to program the uno but that’s about it ! that is why i was asking if anyone has done this and if then may be some code out there that i could use if not i’ll just have to try and figure it out on my own or just fo to a bunch of color led strips and multi timers

I’m doing roughly what you are for Particle photon (similar to the Arduino). My code requires accurate time and GPS coordinates. You need to know where you are and what day it is to know when sunrise and sunset are. If you can’t get accurate time, then your results may vary.


Peter thanks for the info it looks like more then i can take on ! i took computer programming back in the 80 and never worked n the field and now in my late 40’s i trying to get back into it as a hobby and it looks like i’m biting off more then i can chew right now ! LOL i do want to thank you for the information and will book mark it for down the road if i get that good !

It can be a little overwhelming in the beginning but it gets much more easy when you get used to the basic concepts.
Also this community is great and provided me lots of help in the past, if you run into any trouble while coding or don’t understand something just drop me a message.

Thanks for posting this. I’ve been wanting to play with this same idea!

Peter i have been looking at your code and think i’m starting to understand it but what i don’t get is Include Sunset/firmware/SunSet.h ?

That’s a different library in my github. Look for sunset. It’s a small library I wrote years ago (someone else did the math) to calculate the exact time of the Sunrise and Sunset. The directory is funky because it’s a one size fits all kinda thing. Just check it out as a subdir of the code you have now.

Thanks. Looks like I’m going to have to get partial photon to play more with it. . And did you use the adaiftuit lights other any pixels led will work. I’m really trying to learn and all this again. Just taking some time to work it out.

You don’t need a photon, that’s just legacy stuff with the firmware directory. I need to update it to work with Arduino better, but I just don’t have time now. If you want to use it in the Arduino IDE, just copy and past the .cpp and .h file into the IDE directly. Not a great solution, but it works just fine. If you want to use it to compile directly, then it becomes a Makefile exercise, or make it a subdir depending.

I use Neopixels almost exclusively. I get them from Adafruit. You can use any LED that FastLED supports honestly. My code doesn’t care, you will just have to modify it to match your chosen LED’s.

i was looking at the partial photon and like it cause it has wifi and thinking i could get better use out of then and arduino and i was also looking at the NodeMCU LUA WiFi Internet ESP8266 just have to learn more on coding and using web access also

I love the photon for all the free services for small projects. They also are really driving their firmware pretty fast. I think in the latest ide, you can use the latest FastLED too. Overall, it’s really turning into a great thing. The ESP chips are really nice too, and super cheap. Though LUA and FastLED don’t mix, they work with Arduino too. Good luck.