Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5704

General programming discussion • Re: 24 Minute Sun Simulation

$
0
0


I have no clue where to start with coding this.

Me neither.

But I have a suggestion.

Start with just 24 LEDs. One for each hour of the day.

You are lighting for a day close to an Equinox. There must be tables available on the Internet somewhere that give the relative illumination you can expect for each hour of the day. Perhaps on a scale of 0 at midnight to 100 at midday/noon. Possibly include the 'color temperature' as well. Or you could get the values programmatically, based on an assumption that they follow a Sine function.

Use that list of 24 values to write sequentially to the 24 LEDs. Wait a bit. (I would wait less than a minute during testing.) Then 'rotate' your list of values so the value at one end re-appears at the other end of the list. Refresh the 24 LEDs with that new list. And so on. So you have a 'Mexican Wave' of values gradually running along the LED strip.


If you can get that running you'll probably have your own ideas about what to do next.

402 is an awkward number to deal with. If you work with 384 LEDs you can allocate 16 LEDs to each hour. For subtlety you might want to phase the transition from one hour to the next over those 16 LEDs instead of working in big chunks.

All this feels as though it would be simple to implement on an RPi Pico microcontroller running MicroPython.
You could start with 12 leds, since half of them are not visible in a 24 hour "day".

Statistics: Posted by ame — Tue Aug 20, 2024 8:44 pm



Viewing all articles
Browse latest Browse all 5704

Trending Articles