This is another beautiful semi-transparent glass mosaic design made by my wife Mieke, combined with electronics and mechanics to create a moving sunrise and sunset using surface mounted LEDs that are moving up and down behind the glass mosaic. The glass mosaic pieces are glued onto 4mm thick plexiglass, so the LED light will shine through the plexiglass and the mosaic pieces. Because the glass mosaic is semi-transparent, the light of the LEDs gets diffused when the distance between the SMD LEDs and the glass mosaic is more than about 0.5 cm.
The challenge in this project was to make the mechanics thin enough, so the total height is not more than 3.5 cm.
The project runs on 2 small 8-pin Microchip PIC12F683 microcontrollers running at their internal 8MHz clock :
One microcontroller controls the LEDs and is located on the PCB that holds the LEDs of the sun-PCB.
The sun gets a SUN ON/OFF signal from the stepper motor controller that read the home and end-switches.
When the home or end switch becomes active, the stepper motor controller instructs the sun to start either the sunrise or sunset lighting sequence, via this SUN ON/OFF signal.
A second microcontroller is used to control a stepper motor that moves a pivoting arm holding the sun-PCB.
To give the stepper motor enough torque, a small gear system and a pulley with belt is used.
The stepper motor controller controls the bipolar stepper motor using a dedicated current limited stepper motor driver that is configured for1/16 microstepping, so the motor moves very slow,
The stepper motor controller polls the home and end switches and reverses the motor when one of the switches becomes active. At the same time, it instructs the sun to either start the sunrise or the sunset.
The "sun" is made with 25 yellow LEDs and 25 red LEDs that are positioned around 2 circles that form the body of the sun. Another 8 yellow LEDs form the sun-rays.
All LEDs are surface mount types and are assembled on a PCB, The PCB is mounted on a pivoting arm that is moved by a stepper motor and a gear box. The gearbox is necessary to increase the torque of the small stepper motor, so it has enough torque to move the pivoting-arm with the sun-PCB.
The LEDs are controlled by software PWM using 3 digital outputs :
one for the red LEDs of the sun body,
one for the yellow LEDs of the sun body and
one for the yellow sun rays.
The software PWM is compensated using a lookup table with an exponential curve, so the LED brightness changes linearly. This compensation is because the human eye has a logarithmic brightness perception.
At power on, the stepper motor moves the pivoting-arm back to the home position. When the home position is reached, the arm pushes against the home microswitch and closes the switch.
The switch is polled by the stepper motor controller and when the switch is detected as closed, the stepper motor controller reverses the motor. Simultaneous, the stepper motor controller tells the LED controller to restart the sunrise lighting sequence via the SUN ON/OFF signal.
This sunrise lighting sequence starts with the red LEDs at low intensity to simulate the start of a sunrise.
While the sun rises, the intensity of the red LEDs is increased.
At a certain moment, the yellow LEDs are also illuminated at low intensity.
Then, the intensity of the yellow LEDs is gradually increased, while the intensity of the red LEDs is gradually decreased.
This results in a red sun, that changes over an orange into a yellow sun.
When the sun is further up, the intensity of the sun rays is gradually increased and when the rays are at maximum intensity, the rays are randomly switched on and off very fast. This creates a flickering effect, a bit like a candle.
When the sun is fully up, the pivoting arm pushes against the end switch, causing the switch to close. The switch is continuously polled by the stepper motor controller and when the controller detects that the end switch is closed, it reverses the motor. Simultaneous, the stepper motor controller tells the sun controller to start the sunset lighting sequence, via the SUN ON/OFF signal.
The sunset lighting sequence is the reversed sunrise lighting sequence. When the pivoting arm reached the home switch again, the whole sequence is repeated. So the sun keeps rising and setting continuously.
One sunrise or sunset takes about 4 minutes.
The stepper motor is a small bipolar stepper motor that is connected to a DRV882 microstepping bipolar stepper motor driver with adjustable current limiting.
The stepper driver is capable of delivering about 1,5A per phase without using a heat sink for the stepper chip. This is more than enough for the small stepper driver that we are using for this project.
The stepper motor is connected to a gearbox that drives a belt via pulleys to increase the torque.
The stepper motor driver is configured for 1/16 microstepping so it can move very slowly.
The stepper motor driver is controlled by the stepper motor controller via the MOTOR STEP and MOTOR DIR signals. This way, the stepper motor controller can move the stepper motor in the desired direction with the desired amount of steps.
To move the stepper motor by an amount of steps, the MOTOR STEP signal needs to be pulsed with as many pulses as the amount of microsteps that we want the motor to move.
The MOTOR DIR signal is used to change the direction of the motor. With the MOTOR DIR low, the motor will f.e. step clockwise and with the MOTOR DIR high, the motor will step counterclockwise.
The home and end microswitches are normally open switches that switch to ground. The internal pull-ups of the PIC12F683 GPiO port are activated, so the home and end switch signals are +5V when the switch is open and 0V when the switch is closed.
The SUN ON/OFF signal is set to 0 by the stepper motor controller when the home or end switch is reached and is set to 1 when the home or end switch is released again. The sun controller continuously polls this SUN ON/OFF signal to check whether
to start the sunrise or sunset lighting sequence.
During building the project, I decided to use only 1x 7805 voltage regulator to power both the stepper motor controller AND the sun controller, because the power needed for the stepper motor was less than I expected.
I increased the heat sink for the 7805, so it is capable of driving both controllers without getting hot.
The total power consumption with all LEDs at maximum intensity and the stepper motor running is maximum 600mA at 9V DC.
Click here to download the PIC12F683 sun controller firmware
Click to download the PIC12F683 stepper motor controller firmware
The giraffe and soil are non-transparent glass mosaic pieces
The whole construction is about 3.5cm high.
The back is made of 4mm thick MDF board
The pivoting arm with the sun-PCB holding the LEDs. At the bottom is the home microswitch. At the top right is the 5V voltage regulator with a heat sink. Below the heat sink is the stepper motor controller board with the stepper motor driver and the PIC12F683
The mosaic is glued onto a 4mm thick plexiglass plate
Small bipolar stepper motor with gear system.
The pivoting arm is driven by a belt, that is driven by a pulley on the gear system.
Stepper motor driver and PIC12F683
Sunrise
The sun-PCB with the yellow and red SMD LEDs