Hello! I’m currently working on my bachelor thesis in furniture design, and I need some help figuring out the programming part of my project.
I’m creating a lamp with 5 separate LED strips (WS2812B, 60 LEDs/m) that are all programmed the same, so they display the same color and brightness changes in sync. The goal is to simulate the brightness and color temperature of the sun over 24 hours for a specific location (e.g., Barcelona).
I’m new to Arduino and programming, so I feel a bit lost. The idea is that the lamp will act as an indoor extension of natural light, mimicking the sun’s daily cycle but focusing on color and intensity rather than movement.
I’ve put together a list of components and steps, and I’d appreciate any feedback on whether I’m missing something or if I’ve made any mistakes. Thank you in advance.
What I Need to Buy:
LED Strips: 5x WS2812B RGBW LED strips, 50cm each, 60 LEDs/m (total: 30 LEDs per strip).
Power Supply: 5V 10A power adapter (to provide enough current).
Arduino Board: Arduino Uno Rev3 (for controlling the LED strips).
RTC Module: DS3231 (to keep accurate time even if power is lost).
Electronic Components:
330Ω resistor (to protect the data signal).
1000µF capacitor (to prevent voltage spikes).
Push button (to turn the lamp on/off without interrupting the 24-hour cycle).
Jumper wires and a DC jack adapter (for wiring everything together).
Steps to Set It Up
Connect Power: Use a 5V 10A power adapter to power both the LED strips and the Arduino.
Wiring the LED Strips: Each strip is connected in parallel, sharing the same 5V, GND, and data signal from the Arduino (PIN 6).
Add an RTC Module (DS3231): Connect it via I2C (SDA to A4, SCL to A5 on Arduino) to keep track of time.
Use a Push Button: Connected to PIN 2 to toggle the lamp on/off while keeping the cycle running.
Program the Arduino: Write code to read real-time data from the RTC and update the LED colors accordingly.
Programming Goals
The LED strips should gradually change brightness and color temperature over the 24-hour cycle.
The push button should allow turning the lamp on and off without stopping the time cycle.
I'm not sure the OP intends to replicate the outside real Sun color and intensity, but just "to simulate the brightness and color temperature of the sun over 24 hours for a specific location (e.g., Barcelona).".
So the hardware listed could do the job, including the RTC, but what it seems to me is still needed is a way to know (calulcate) exactly sunrise and sunset time over the whole year, giving the specific location to be pointed out, by using a sunrise/sunset calculator algorhytm.
But as it's a software matter, it looks like no hardware change is involved.
There is a SolarCalculator library in the IDE's library manager that claims the ability to calculate sunrise, sunset, solar noon, sun angle, etc.
Might be a bit more work if there is a need to simulate moonlight.
Well, the difference is based on the level of accuracy and purpose of the system.
"Simulate" is imitate the behavior and appearance of a model, while "Replicate" is to copy/reproduce something as closely as possible to the real and original thing.
So "simulate" is what I meant, it will get the light to reproduce the sunlight (color and intensity) as if the sky was completely clear all the time. While "replicate" is what you're pointing out, and should give the exact color and intensity of the real external environment (e.g. if it is cloudy the light will be dim and with a less "warm" color, if the sky is completely covered there will be very little light).
I'm not saying you're wrong, but the interpretation depends on the OP goal, if "simulate" or "replicate" the Sun light.
I can't make sense of anything you said and if it actually helps the OP but @martinanordberg still needs a way to measure color temperature and intensity.
Exactly, my intention is to simulate the intensity and color of the sun (and perhaps moonlight during nighttime) as we perceive it with our eyes. I want to capture how we experience sunlight on a daily basis—nothing too scientifically accurate.
Yes, do you have any suggestions on how I could achieve that? If I document the sky and surfaces where sunlight reflects by taking pictures and extract the RGB color values, would that be a good approach to replicate the colors on the LED strips? I would still need a way to determine the correct intensity—do you have any recommendations for that?
You think? In total I would get 150 LEDs, How many would you recommend? Its for a floor lamp so the aim is to strongly brighten the area near the lamp and have more diffused lightning in the rest of the room.
Well, if you really want to get picky, use an ESP32 to get the weather feed for the desired location, probably most useful if there is a major airport nearby that would give details like cloud cover, precipitation, etc.
There are light/color sensors that could provide feedback on the output of the LEDs, although LED strips may not be the best choice for simulating the sun.
It doesn't to be exact, I mainly focus on sunny days. The project has to do with well being so cloudy and rainy days are irrelevant. I need to get a somehow realistic feeling of what the sun can be like during the day. And the intensity and sunny/dark periods will change corresponding to time of year as well as sunrise and sunset.
There are many related projects, usually involving an aquarium. You can effect a dawn sequence and ramp up over time to noon and ramp down to a dusk sequence.
Got it. If the question is of a physical nature, IMO you don't need to capture nothing, we all know what changes the received light temperature is the absorption of the air based on the amount of atmosphere crossed, making the light temperature change throughout the day, and sunrise and sunset hours both depend on the "simulated" Earth parallel.
Just to start, I think you just need to know the "generic" color temperature of the Sun, from sunrise up to sunset: it starts at 2000K, almost an hour later the color temperature climbs up to 3500K, then by noon, in the summertime on a clear day, the color temperature rise up to 5500K. If true, if you just need to reproduce such temperature changes with an RGB Led strip (and Adafriut Neopixel library, right?) you just need to balance R G and B channels to implement the transition (I don't consider much the intensity for now) based on this schema I found googling around:
Warm white (~2000K): High red, low blue
Neutral white (~4000-5500K): Balanced RGB
Daylight (~6000-6500K): High blue, moderate red & green
This is a couple of useful picture I've found about that:
You just need to fade the color according to the daytime, for example something like this RGB fading schema:
Sunrise (2000K): fade from 255, 150, 50 to 255, 180, 100
Morning to Noon (4000K): fade to 255, 220, 180
Midday (5500K): fade to 200, 230, 255
Afternoon (4000K): fade to 255, 180, 100
Sunset (2000K): fade to 255, 150, 50
(we could even add a bit of light for the twilight and night, like a dimmed warm White, fading up to black, or a blueish color to replicate the moonlight )
Then you could over simplify and just use sun elevation for both intensity and color.
You can get that easily real time with some sun calculator library.
Also, If sun imitation is the only purpose of your lamp, maybe you should pick SK6812 WWA LED strips instead of RGBW. They have cool white, warm white and amber instead of RGB.
I'm visualizing a couple of tables...
One with sunrise-sunset for every day of the year and another with brightness & color temperature throughout the day. Maybe 10 or 20 readings to cover the day. Of course the time period of each segment will be shorter in the winter, but that's just a factor or percentage depending on the length of the day.
As you get more dim the resolution of the LED strip gets worse, so that's something you'll have to experiment with too. (Going to a brightness of 1-2 is more obvious than going from 245-255, and that affects the resolution of color-changes too.
Then you can interpolate to get smooth readings, updating every minute or so. You'll need more resolution in the morning & evening where everything changes more quickly... Updating every minute probably won't be fast enough, but you can interpolate as frequently as you want.
I don't think the Uno has enough memory to hold the sunrise-sunset times for every day of the year so you might need to interpolate that too (or use a different Arduino).
And here you need more resolution (or more frequent interpolation during on the 1st day of spring and the 1st day of fall where the length-of- day changes quickly. Even now at the end of February, I'm noticing that sunrise is earlier than last week.
I don't know how close RGB and RGBW strips get to daylight white. BUT I read recently that a lightbulb with color temperature equal to daylight is perceived as too-blue (because it's not as bright). For that reason. you MIGHT not need a meter to measure color temperature of the LED strip. It might work-out better just experimenting and using your judgement.