Lighting Concept

The development process of Circadian started with a lot of research considering melatonin, the circadian rhythm and light therapy and was followed by picking the LEDs. I decided for Osram's Oslon SSL series because of its high CRI (95) white and broad color variety. 12 neutral white LEDs provide 2100lm during the day and 2 yellow, 2 amber, 2 red and 2 hyper red LEDs emit an enchanting orange light at up to 1100lm. The LEDs are split up in two white strings and one orange string at 18V each.

In contrast to commercially available lamps, Circadian does not use a warm white LED for its evening mode, because even warm white has a lot of blue spectrum. Light containing only wavelength above 530nm does not suppress the production of melatonin and amber being the bluest of the LEDs I used lays in safe distance to this threshold. Another conclusion of my research was, that I should use the white light at full power in the morning to increase my serotonin level.

Design

After the emitters were chosen, I could start working on the appearance of the lamp. I decided for a minimalistic design, which seems to be held together by a continuous brushed aluminium rod. The rod is actually a 12mm tube press fit into the upper heat sink and then two screwable aluminium pieces attaching the diffusor plate to the lower heat sink. The raw brushed finish was achived by filing the turning parts.

The diffusor plate was milled from 4mm acrylic sheet using a router and lots of protective masking tape. I cleaned up the edge with a 9mm radius head dropped to about the middle, resulting in a nicely rounded edge and a slightly bigger top side, which hides the upper edge from people looking at the lamp from below. Instead of sanding it to achive a matte finish, I covered the plate with some back projection foil. The foil diffuses the light perfectly in all directions and absorbs just a small fraction of the LEDs' light. If you should plan on making a lamp or something that needs to diffuse LED light, I can only recommend this technique. You don't have to buy a whole roll. I ordered an A4 sample piece for less than 2 bucks online.

Thermal Management

The LEDs' waste energy is transported through their board's .5mm FR4, M3 brass screws between the white LEDs and a 12mm to M6 aluminium rod in the center for the orange LED array. The lower heatsink is thermally coupled with the upper one using 3 threaded 10mm x 10mm aluminium spacers. I started with making a perfectly centered M6 thread, so I could screw the board to the heatsink and drill all the tiny holes.

Because the LEDs can not be soldered by hand, I did this step on my oven. The metal brackets keep the heat inside. Then I assembeled everything and applied 1g of thermal grizzly 12.5W/(m*K) paste to ensure a good thermal conductance - especially between the upper side of the board and the screws/rod.


Electronics

The board sits right between the two heatsinks and is held in place between the three aluminium spacers. It's mostly just an ATMega, a voltage regulator and a DCF77 receiver. I initially planned to have the NiMh RTC backup battery on the board, but then I decided to put it behind the ceiling plate with the power supply so it stays cool and because the heatsinks look better when they are only 10mm apart. How did I route and arrange the parts in a 60° angle? I just turned the whole board. The layout has only a top layer. The bottom layer represents wire connections.

The regulator provides 3.9V and connects to the backup battery via a 1kOhm resistor for trickle charging. The AVR can detect if it is powered by mains or battery. I had to generate a low level when the power supply is switched on, because the AVR needs a low level for its interrupt. This is why the diode is connecting VIN- to ground and not the output of the LM to VCC, like it would be standard procedure. As soon as the light switch is turned off, the voltage between VIN- and VCC drops, resulting in a high level.

Three LM350 provide constant current sources for the LED strings. The AVRs PWM is used to pull down the ADJ pin, reducing the LM's output voltage to its minimum and switching off the LEDs.

The rest of the board is pretty straight forward. A 32786Hz crystal is used for a precise RTC and the DCF module is powered through one of the AVRs ports for power saving in battery driven mode.


Software

I enjoyed coding for this project and put a bit too much effort into coding its RTC & DCF parts efficiently. There is still a lot code space left.

RTC

The RTC uses the AVRs low frequency oscillator and keeps the time and date using the backup battery, even when the lamp is switched off. It includes DST and leap days.

DCF

The DCF time signal is received using the INT0 triggered by rising and falling edges. The software does not distinguish between high or low, but only looks at the pulse length. The code will also work with the inverted signal. The pulses are decoded using the RTC's timer, which is why I set the divider to 256 and not to 128. 128 would mean an overflow every second. This way I have an overflow every two seconds and alternate the OCR2 interrupt between 2 values to keep secondly interrupts. This also ensures that the RTC interrupt is not triggered multiple times. This can happen if you use a slow timer clock and have a short interrupt routine.

The received bits are stored and their CRC is checked. The new time and date are set and the RTC timer is reset as soon as the next minute start mark is received.

Power Save

A high level at PD3/INT1 indicates that the device is powered by its backup battery. As soon as the power switches from mains to battery, the high level is detected by a polling routine and and the DCF module and PWM are deactivated and power save mode is entered. The RTC keeps running. Also, the low-level interrupt of INT1 is activated, which is necessary, because the pin can not be polled during sleep mode. Well, it could. For example every second, when the controller is woken up to increase the RTC. But this would result in an annoying delay of up to one second. As soon as the power is switched on again, the low-level at PIN3 generates an interrupt and wakes up the device. The interrupt is deactivated and the device continues to run without entering sleep mode until the light is switched off again.

Double Click

As soon as the power is turned on, the double click timer consisting out of 2 bits in the flag register is set. The bits are then counted down with every second. If the power should be turned on again within these 1-2 seconds after the last power up (implying the switch was off at some point), a double click is detected and the PWM settings are overridden.

PWM

The hardware PWM is used to fade between daylight and melatonin mode between 9 and 10 in the evening and is switched back to daylight at 7 in the morning (for waking up). I set the PWM's top value to 3600 and calculate the output compare registers to minutes * 60 + seconds.

Conclusion

What did I learn during this project? Well, definitely when to change to and from daylight saving time. The design was a bit too elaborate for a prototype. An iteration between breadboard and designer lamp would have been nice for validating and debugging. The idea of a DCF controlled circadian rhythm lamp seems to be a true competitor to its bluetooth controlled version. Especially for those not too fond of having an app for everything. Just screw it in and you're ready to go.

Future Work

I could implement a table to look up the real sunrise and sunset time (and to waste a lot of the code space i have left), but this would defeat the purpose of the project, since I want my internal clock to be synced up with my schedule and not with the tilt of the earth. A nice feature would be to start shifting the illumination cycle two days before a DST change. This would make the transformation less abrupt. Another possible future functionality could be a way to set your personal sleep time. Maybe the lamp could shrink to the form factor of a bulb and have a rotatable ring to select the fading time. DCF was fun in general. I am going to experiment a bit more with it. Maybe there's a watch project coming soon.

Thank you for reading!