Beruflich Dokumente
Kultur Dokumente
Table of Contents
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
step 7: Modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
License: Attribution Non-commercial Share Alike (by-nc-sa)
But not for the readers of this instructable. It explains you how to build a combined sunrise and sunset-lamp from a picaxe microcontroller, some LEDs and a few other
parts.
The LEDs might cost you 5-10 Euros depending on the quality and the other parts should not make more than 20 Euros. So with less than 30 Euros you can build
something really helpful and nice.
And this instructable will not only explain you how to rebuild this, but also show you how to modify it to your individual preferences.
Image Notes
1. LED-array to simulate sunset and sunrise
2. Light against the wall
In older computer-mouses with D-Sub-connectors you might find a good substitute for the phone-jack cable used to program the picaxe.
Image Notes
1. The microcontroller
Image Notes
1. The connection to the computer.
2. These are the outputs we use to control the LEDs
Image Notes
1. This is the one we use here!
2. Only 80 lines of memory. Hey, thats a challenge!
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
step 2: The circuit-layout
The ULN2803A is a darlington-array, consisting of 8 individual darlington-drivers with suitable resistors on the input-side so that you could directly connect the output from
the microcontroller to the input of the UNL2803A. If the input gets a high level (5V) from the microcontroller, then the output will be connected to GND. This means that a
high on the input will light up the respective LED-strip. Each channel might be used with a current up to 500mA.
Standard ultrabright 5mm LEDs normally use 25-30mA per strip and even eight of them will stress the FET only with 200-250mA, so your far away from any critical
points. You might even think about using high power 5W LEDs for the wakeup light. They usually use 350mA at 12V and might also be driven by this array.
The switch "S2" is the selector of sunset or dawn. You could also replace it by a pushbutton and activate sunset by an interrupt in the software.
The potentiometer R11 acts as a selector for speed. We use the picaxes ADC ability to read out the position of the potentiometer and use this value as the timescale.
The picture shows the first board that I built with 7 individual transistors (BC547C) and the resistors to drive them. I didn't have the ULN2803 at the time I build the circuit,
and now I'm missing some other parts. So I decided to show you the original layout, but also provide the layout with the new driver-array.
Image Notes
1. Interface to computer via a 3.5mm phone-jack
2. The FET, directly driven on Output3 of the microcontroller
3. The individual transistor-Array with 8 BC547C and 8x1kOhm resistors! (It also
works) The ULN2803A saves you 16 transistors (Darlington-driver!) and also the 8
input-resistors in a smaller shape. Image Notes
4. The reset-Button 1. LED-Array
5. The IC7805-Voltage converter with the capacitors. 2. ULN2803A
6. Power-cables from 24V power-supply 3. IRF520 The FET
7. The Picaxe 18M (in a 20pin socket, sorry had nothing else) 4. The Picaxe with connection to PC.
8. upper red line = 24V black line = GND lower red line = 5V 5. The Voltage-converter
9. Potentiometer for speed adjustment 6. Sunset-sunrise selection switch
10. Hot glue to fix the board on the power-source housing
File Downloads
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
step 3: What is sunset looking like?
When you observe a real sunset you might recognize that the colour of the light is changing over time. From a bright white when sun is still over the horizon it changes to
a bright yellow then to a medium orange then to a dark red and after that a low blueish white glow, then there is darkness.
The sunset will be the most difficult part of the device because you watch it with full consciousness and little mistakes are quite annoying. Sunrise is principally the same
program reversed but as you are still asleep when the sunrise starts, we don't have to worry too much about colours. And starting your sunset when laying down, you
might not want to start out with bright sunshine but in the morning it is important to get the most out of the LEDs. So it is convenient to have different sequences for
sunrise and sunset, but you are free to test anything you like of course!
But these differences in the programs, might lead us to a different selection of LEDs for both programms.
Image Notes
1. Sunset over Mannheim (my hometown) from the webcam: www.morgenweb.de
2. low blueish white glow simulated by a UV-LED
3. Everything off! You should be asleep by now!
4. O.k. it changes back to a brighter yellow, but thats caused by clouds..
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
step 4: Selecting the LEDs and calculating the resistors
Selecting the LEDs is the creative part of this instructable. So the following text is just a suggestions from me to you. Feel free to vary and change them, I will tell you how
to do this.
Colours:
It is difficult to smoothly switch a strip on or off with LEDs of a complete new colour. So my recommendation is that each strip contains LEDs of all colours but in changing
quantities.
If we imagine the sunset reversed the first strip would contain a lot of red LEDs and maybe one white, a blue and a UV one. So let's say 5 red ones, 2 yellow, 1 warm
white and 1 UV. If you like you might replace one of the red or yellow LEDs by an orange one (Strip 2 in the schematic)
The next brighter strip would then have a few red ones substituted by yellow ones. Let's say 2 red, 5 yellow and 2 warm white (strip 3 in schematic)
In the next strips a few more red ones will be substituted by yellow ones or even white ones. Let's say 1 red, 1 yellow, 4 warm white and 1 blue. (strip 4 in schematic)
The next strip might consist of 3 cold white, 2 warm white and 1 blue LED. (strip 5)
This would be four strips for sunset so far. For Sunrise we could use the leftover three strips with mainly cold white and blue LEDs. If you connect the 7th and the 8th
input together you could also use 4 strips for sunrise, or give sunset a fifth strip, just as you like.
You might have noticed that the strips containing red LEDs have more LEDs per strip than the pure white ones. This is caused by the difference in minimum voltage for
red and white LEDs.
As the LEDs are really bright and even dimming them down to 1% is quite a lot, I calculated strip 1 with 3 reds, 2 yellow and a warmwhite LED to have only 5mA of
current. This makes this strip not as bright as the other ones and therefore suitable for the last hint of sunset. But I should have given this strip an UV-LED too, for the last
glance.
The LEDs need a certain voltage to operate and even the darlington-array uses 0.7V per channel for its own purpose, so to calculate the resistor is very simple. The FET
practically doesn't cause any voltage loss for our purposes. Let’s say we operate at 24V from the power supply. From this voltage we subtract all the nominal voltages
for the LEDs and 0.7V for the array. What is left must be used by the resistor at the given current.
That’s the reason why you could only operate 6 high voltage consuming white LEDs on 24V.
But not all LEDs are really the same, there might be big differences in the voltage loss from LED to LED. So we use the second potentiometer (300 ?) and a current-
meter to adjust the current of each strip to the desired level (25mA) in the final circuit. Then we measure the value of the resistor and this should give us something
around the calculated value.
If the result is something in between two types then choose the next higher value if you want the strip to be a little darker or the next lower value for the strip to be a bit
brighter.
I installed the LEDs in an acrylic glass board which I fixed to the power-source-housing. Acrylic glass can easily be drilled and bend if heated to around 100°C in the
oven. As you can see on the pictures I also added the sunrise – sunset selection switch to this display. The potentiometer and the reset-button are on the circuit-board.
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
Image Notes
1. Red LED
2. Yellow LED
3. cold white LED
4. Warm-white LED
5. Blue LED
6. UV LED
Image Notes 7. Strips are numbered by the sequence they were supposed to be switched on
1. Sunrise sunset selection switch during sunrise.
2. white cable to connect the anodes of all LEDs (Top of the board) to 24V from
power-supply.
3. All anodes are connected together
4. Individual resistor for each strip
5. Power-supply 24V (2A?) Cheap from surplus on ebay (6.50€)
The picaxes are very good for beginners because the requirements to the hardware are very simple and the basic-language is easy to learn. With less than 30€ you can
start to explore the wonderful world of microcontrollers. The disadvantage of this cheap chip (18M) is the limited RAM.
If you chose other features or connect the picaxe different you might have to adjust the program. But surely you will have to make adjustments to the transitions between
the individuals strips.
As you can see in the listing the variable w6 (a word-variable) acts as a counter – variable and as the parameter for the PWM. With the chosen PWM-frequency of 4kHz
the values for 1% to 99% duty-time are 10 to 990 respectively. With the calculations in the loop we get a nearly exponential decrease or increase of LED-brightness. This
is the optimal when you control LEDs with PWM. When switching on or off one strip, this is compensated by the software by changing the value of the PWM.
For example let's look at the sunset. Initially the outputs 0, 4 and 5 are switched high, that means the respective strips are switched on via the ULN2803A. Then the loop
reduced brightness until the variable in w6 is smaller than 700. At this point pin0 is switched low and pin2 is switched high. The new value of w6 is set to 900.
This means that the lamp with strips 0, 4 and 5 at PWM-level 700 is nearly as bright as the lamp with strips 2, 4 and 5 at PWM-level 800. To find out these values you
have to test around and try some different values. Try to stay somewhere in the middle, because when you dim down the lamp in the first loop too much, you can not
make much in the second loop. This will reduce the colour-change-effect.
To adjust the PWM-settings I used a subroutine that also uses the value of w5 to pause the program. At this point the speed comes in the game. Only during start-up the
potentiometer is checked and the value is stored in w5. The number of steps in each loop of the program are fixed, but by changing the value of w5 from 750 to around
5100, the pause in each step changes from 0.75s to 5s.
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
The number of steps in each loop might also be adjusted by changing the fraction for the exponential de- or increase. But make sure not to use to small fractions,
because the variable w6 is always a whole number! If you would use 99/100 as a fraction and apply that to a value of 10, that would give you 9.99 in decimals but again
10 in integers. Also keep in mind that w6 might not exceed 65325!
To speed up testing, try to comment out the line with w5 = 5*w5, this will speed up the program by a factor of 5! :-)
Image Notes
1. Complete Sunset. Pictures taken at the beginning of each step. One might
recognize the number of strips that are activated.
Image Notes
1. Start of Sunrise 2 strips active, but dimmed by PWM.
2. still 2 strips but much brighter
3. 3 strips
4. 5 strips
5. still 5 strips, but PWM is flying high!
File Downloads
05 62 sunset-lamp.BAS (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to '05 62 sunset-lamp.BAS']
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
Image Notes
1. Backside-View from top. All Anodes connected together on top, individual strips running down to controller.
step 7: Modifications
When replacing the toggle-switch by a pushbutton you must switch to the sunset-part by activating some interrupt in the program.
To change the supply-voltage you must recalculate the individual LED strips and the resistors, because with 12V you could only drive 3 white LEDs and you need a
different resistor too. A workaround would be to use constant current sources, but these might cost you some bucks and use another few tens of a volt for regulation.
With 24V you could drive a lot of LEDs in one strip, to control the same amount of LEDs with 12V supply, the LEDs must be separated in two strips which are used
parallel. Each of these two strips needs its own resistor and the accumulated current through this channel has more than doubled. So you see, that it makes no sense to
drive all LEDs by 5V, which would be convenient, but the current would rise to an unhealthy level and the amount of resistors needed would also skyrocket.
To use high power LEDs with the ULN2803 driver you could combine two channels for a better thermal management. Just connect two inputs together on one
microcontroller-pin and two outputs on one high power LED-strip. And keep in mind, that some high power LED spots come with their own constant-current circuit and
might not be dimmed by PWM in the power-line!
In this setup all parts are far away from any limits. If you push the things to the edge you might get thermal problems with the FET or the darlington array.
And of course never use 230V AC or 110V AC to drive this circuit!!!
My next step beyond this instructable is to wire up an microcontroller with three hardware PWMs to control a high power RGB-Spot.
So have fun and enjoy the privilege of your individual sunset and sunrise.
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
Image Notes
1. Everything on! I modified the programm to see if all LEDs are working. Make sure you don't install one LED in the wrong direction, because of the high voltage it
might damage it! Test the strip with a smaller voltage step by step before you switch on the 24V!
Related Instructables
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
Advertisements
Comments
23 comments Add Comment
Your project here is perfect for people as it naturally adusts your vision to match whats going on outside. if you could integrate a stronger UV source, it would
help your body adjust even better. This idea is great for both people and animals that are sensitive to sunrise/sunset.
Im going to try this as soon as i can collect parts. I also think it would look excellent if it were modfied to point the leds upward and enclose in a simple, thin,
3d rectangular frame with panels made of a heavy rice paper, or a thin opaque white plastic.
Awesome stuff.
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/
buteomont says: Dec 16, 2009. 10:44 AM REPLY
You would be a happier person if you concentrated on changing what you can change and just get over what you can't change. (Like get up and go to
work an hour earlier so you can get off an hour earlier.)
Unless, that is, you enjoy being a sourpuss. If that's the case, then carry on.
Stay tuned!
http://www.instructables.com/id/A-sunrise-and-sunset-lamp-with-LEDs/