Page 1 of 2

Newbie Introduction and First Project Questions

Posted: Fri Oct 17, 2008 5:04 pm
by schwing
So I'm pretty new to electronics and found out about this forum when I picked up my first copy of Nuts and Volts a few weeks ago. I've been practicing desoldering components from old motherboards and soldering them back. Can't say I'm very good at it yet, but it's a good start, right? :)

Anyway, I've kind of always been one of those guys who "just learns by doing" so I thought I would jump in and ask around. For my first project, I would like to make something practical. My wife has mentioned a few times that she would like one of those "sunrise lamps", and I looked up prices for them online and they are like $150!! In case anyone is not familiar with them they are lamps that are programmed to come on in the mornings but start off with low light and gradually get brighter, simulating the sun rising.

When I think about the concept of the lamp it seems pretty straight forward, however, I don't really know about how to get started. It seems as if you could take an existing digital alarm clock, redirect whatever signal was going to the alarm speaker and send it to some circuit that controlled the electric to a lamp which gradually increased it until it hit maximum. When the alarm went off, the light would slowly start to come on. I know I'm probably over simplifying it, but that seems like it would work.

Now the questions. :) So how do I start? What, or where, can I read something to show me the things I need to learn to make it happen? If you've stumbled across this idea before, or maybe you've already made this for yourself, I would appreciate some steps on what you did to get it going.

Looking forward to your gentle pushes in the right direction. :)

Posted: Sat Oct 18, 2008 9:18 am
by Engineer1138
Well, if you're new to electronics, I'd start with a battery powered version to get experience. Playing around with 120VAC can be dangerous.

How I'd do it: forget the alarm clock; get a plug-in timer module. They make them digital or with little pins to set the time and they will turn a circuit on/off at the time you say.
Now the timer can turn on/off a wall-wart that powers a small 12V lightbulb. You're now at a safer voltage level to play with.
I'd take this opportunity to use high power LEDs instead of a lightbulb: now you can learn about LEDs and resistors, etc. Checkout or my own site at for LED tutorials.

Ramping up the intensity: there are various circuits you can find online to generate ramps. This is a learning experience in itself. In fact we had a discussion on doing just this a few months ago.

Come back when you need to learn more. I think the learning curve will build an appreciation for the $150 price :-)

to the group: is this ramping up a light at power on a common application that others here are interested in? If so I can put a few simple circuits to do it up on my site when I have time.
I'm thinking now that it might be a cool little module to build to replace the dome lights in my truck. Slow brighten, slow dim.

Posted: Mon Oct 20, 2008 8:58 am
by philba
Welcome! It's a great hobby.

I appreciate your desire to create something practical but i can't help think that is too ambitious for your first.

I'd suggest 2 or 3 small projects at first. here are some ideas
- Build a 7805 based voltage regulator
- Blink an LED with a 555 timer.
- Build a dark activated switch (or LED).
- More sophisticated multiple LED project like a chaser

The sunrise project has several components that will be challenging or hazardous (as said above):
- real time clock
- triac control of a light
- variable power level (illumination control)
- time display and settings

If I were doing this project, I'd use a microcontroller and a 7-segment LED display. It is pretty complex. As a microcontroller project, it's at least an intermediate project. Without a microcontroller, it would be a very advanced project.

Posted: Mon Oct 20, 2008 9:03 am
by philba
On the subject of ramping. This is fairly straight forward with uC driven phase control via a TRIAC. It's possible without the uC but with it you can linearize the phase so 75% really is 75% power or even 75% brightness. I don't know what the sun-up illumination curve is but you could even build a compensation table for that. I'd probably rig up a sensor and record several sun-ups to then build the table.

such is the power of the computer...

Posted: Mon Oct 20, 2008 10:16 am
by MrAl

Guess what? The illumination of a source of light is equal to
cos(angle) but since the sun is referenced to 90 degrees,
that would be, amazingly, sin(angle) !

Also, a linear time ramp controlling
both positive and negative half cycles would apply power as
(sin(angle))^2, which would roughly approximate a sine curve
with somewhat steeper slopes at the start and end of the
half cycle. This control methodology might work by itself,
meaning a linear ramp phase locked to the line (by squaring up
the sine wave and using it to generate a ramp) and a comparator
might be used to generate the phase trigger pulse to the triac.

Interesting idea huh?
If i get a chance i'll go over the equations later to see if they
work out like this, and what the error would be compared to
a true sine, unless someone else wants to of course.

Posted: Mon Oct 20, 2008 10:28 am
by philba
uh, even before the sun rises? No, I think it's not a simple thing. I think there are 3 phases: dawn (pre sunrise, atmospheric scatter), sun rising (portion of the sun visible), sun risen. Each has a different profile. Also, simulate ideal terrain (i.e. sun rise on a perfect sphere) or realistic with trees, dust, clouds and such?

Posted: Mon Oct 20, 2008 10:35 am
by haklesup
While I share the opinion this might be a bit more of an all electronic project for a first one, I do see some shortcuts to a project using common modules and more intricate for construction than design.

Consider a standard lamp dimmer switch you can get at any hardware store, a timer scrounged from a broken coffee maker and a mechanical clock motor. Wire the timer so that when it turns on it applies power to the lamp dimmer and clock motor, use the minute hand collar to drive the dimmer knob (that's the hard part in construction) .

Its a bit of a kluge but it could work with a minimum of electronic design

Example of Clock motors

More direct would be to find an electronic way to substitute for the turning of the dimmer knob. Removing the potentiometer attached to that knob and injecting a signal from a ramp generating circuit would alleviate you from constructing a lamp dimmer circuit but still requires a bit of reverse engineering of the dimmer and concocting a substitute circuit to make the signal from the wiper.

I'm not up on precisely what that signal would need to be so I am holding off on a solution that fits there. I'm leaning toward something based on an RC circuit whose voltage either directly is applied to the dimmer or applied to another circuit in between.

Posted: Mon Oct 20, 2008 11:41 am
by MrAl
philba wrote:uh, even before the sun rises? No, I think it's not a simple thing. I think there are 3 phases: dawn (pre sunrise, atmospheric scatter), sun rising (portion of the sun visible), sun risen. Each has a different profile. Also, simulate ideal terrain (i.e. sun rise on a perfect sphere) or realistic with trees, dust, clouds and such?
Hi philba,

Are you trying to light up an LED or drive an LCD panel? :smile:

I was offering some simple ideas to make a first electronic
project, not a LCD panel sunrise simulator.

It's ok if you want to get more complex, but i thought we would
start off more simple.

The results of using a linear ramp (or uC) to control the phase
trigger of a triac only work so-so anyway, with a lot of error
toward the beginning of the curve but it gets better as the
angle gets larger. Here is a little table for comparison between
what the sun's ideal illumination would be and what a linear
phase triggering method would provide:

Code: Select all


    0us   0.00A    0.00A     00 percent    0 percent error
 1250us   0.04     0.20      20 percent   80 percent error
 2500us   0.15     0.38      39 percent   61 percent error
 3750us   0.31     0.56      55 percent   45 percent error
 5000us   0.50     0.71      70 percent   30 percent error
 7500us   0.85     0.92      92 percent    8 percent error
10000us   1.00     1.00     100 percent    0 percent error
This table represents LED current normalized to 1 amp.
The 'percent error' represents the percent error between the
sun's ideal lighting and the LED lighting, not considering the
slightly higher efficiency of a white LED at lower currents,
which would help to some degree.

Some sort of clock would still be required to start the cycle however.
This would be a uC or a bunch of counters driven from the line

Posted: Mon Oct 20, 2008 11:58 am
by philba
MrAl wrote: Are you trying to light up an LED or drive an LCD panel? :smile:
Neither. Simulating sunrise means driving a light (not an LED) with the same illumination profile as a real sunrise. I don't think it's just a sine or cosine formula. IMHO, a precise model is very complex. In your table you are presuming that the linear phase error is the difference from the solar illumination. I guess we just disagree on that. The linear phase error is the difference between the integration of a linear vs sine curve.

Use of a table to determine proper phase angle is exactly right because of the errors you point out. Basically, its a non-linear PWM at 120Hz. But, like I said earlier there are 3 phases. Each of which could be simulated separately. I believe the pre-sunrise segment is a slow build followed by the transition to sun up which happens fairly quickly followed by a slow increase to full brightness. I think the simplest way to do this is record a real sunrise and not worry about mathematical models.

Yeah, a simple linear approach would work but I think it brings the light up too fast. It's all an approximation so it's up to the designer how much fidelity to the original phenomenon he wants. Once you've got a table driven scheme, it's easy to increase the accuracy.

Posted: Mon Oct 20, 2008 1:17 pm
by MrAl
Hi again philba,

Before i start, let me just say that i do agree that a uC would
be best for this, as a table lookup would have greater flexibility.

Next, i think you misunderstand me a bit with the scheme i was
trying to outline, which i admit is an approximation and perhaps
not as good as we would like.

The scheme i was trying to outline was not to simulate the sun's
intensity by using a linear ramp to ramp up the intensity, but
to use a linear ramp as the trigger point in time for the triac,
in relation to the sinusoid line voltage. So, it's not a linear ramp
alone, but a linear ramp PLUS a sinusoid voltage wave, that
together form a rough approximation to a light intensity
varying as the sine of the angle which any light source does
obey as physics dictates.
Given that the ramp controls the trigger time and NOT the intensity
itself, the output to the LED (or lamp) is a chopped sine wave,
who's conduction angle is dependant on the ramp for each cycle
and the (theoretical) ramp for the day's time. When these two
ramps cross the triac fires, and the conduction angle is controlled
where a longer conduction angle (not time delay) equates to a
brighter light. Of course if there are trees in the way this wont
happen, but then again if the moon is out that's going to affect
things too.

Now because this wave varies as a sinusoidal wave, the output
to the LED is not a linear one, but an approximation to a sine
wave, which i was after in the first place. The actual wave however,
comes out as a sine squared wave and so this is non ideal
(in theory the ideal would be a sine, but certainly not a ramp).
It would work however to some degree, and that's all i was trying
to say. How particular the person is to this working is up to them.

Granted, there are pitfalls, such as trying to generate a ramp that
lasts for 8 to 12 hours or so. This is possible however with some
good ic chips, so this approach might still stay on the table.

The other pitfall is that some sort of timer would have to trip
when morning actually starts (first light), or a light detector
would have to detect the actual sun's rise. Of course if this
is to be build for use in say Alaska it would have to be a timer
such as a clock.

I also agree that a uC could be programmed to simulate the
sun's rise to a much better degree of accuracy, but then not
everyone wants to start their first electronic project with a
uC ic chip and the complexities of the programming needed
to accomplish even a simple pulsed output.

Posted: Mon Oct 20, 2008 3:21 pm
by CeaSaR

Is this what you are looking to build?


Re: Newbie Introduction and First Project Questions

Posted: Mon Oct 20, 2008 3:40 pm
by kucomp
schwing wrote:In case anyone is not familiar with them they are lamps that are programmed to come on in the mornings but start off with low light and gradually get brighter, simulating the sun rising.
Noob /naive approach: Use the sun as your natural timer. Get some wire, a photoresistor, a light bulb and a small solar panel. Hook them together in series. Make sure the wires attached to the photoresistor are long so you can place it near a window where the sunlight comes in.

Probably not how you would like it done, but it would be a nice first simple project that kind of does what you want.

Posted: Mon Oct 20, 2008 3:44 pm
by Robert Reed
I think I am missing something here as I don't know what a commercial "sunrise " lamp" is. It sounds like the OP is wanting a bedroom lamp (?) to turn on when the alarm clock goes off. And then simulate a sunrise at the same time. I would guess from that , they are arrising in the dark before sunrise and want to simulate the feeling of an actual sunrise.
In my home the sunrise's light intensity does not follow any dedicated curve of light vs time. Some rooms are brighter at initial rise than later on (windows facing sunrise) while other rooms follow a completely different curve. I am wondering if the lighting rampup is really that critical, as maybe just a slow transition over several minutes from full dark to full light is all that is required.
If this is so,it would seem that a relatively simple circuit layout could be constructed with common logic components. Say a zero crossing detector triggering a monostable of variable delay [delay controlled by a linear ramp generator (or maybe non-linear)] of which its output trailing edge would pulse the triac's gate. Everything would occur from a large phase angle to a small one for the triacs conduction cycle. Of course that is a general plan and the details would have to be worked out for completion. Again, not knowing what that "sunrise" lamp's intended use is, I may be way off base here.

Posted: Mon Oct 20, 2008 4:09 pm
by CeaSaR

See my post above and the link therein.


Posted: Mon Oct 20, 2008 4:21 pm
by Robert Reed
I guess I was typing while you were posting. Read your link and it looks like the type of lamp I had envisioned. Still not clear on how the off-on intensity curve is on them, or if it is really that important. They mention setting your alarm to go on consequent with lamp's full brightness. For myself, it wouldn't matter how it progessed as it takes almost an A-Bomb to get me up in the morning. Prior to rising, I am dead to the world. :grin: