Intell1gence
Posts: 2
Joined: Mon May 06, 2013 8:56 pm

Building a Wakeup light

Mon May 06, 2013 9:42 pm

Hi all! :D

I would like to build myself a wakeup light using the raspberry pi, but i don't know where to start. :roll:

I have linux, as well as some coding background, so that part im not too worried about. :)

My idea is to have the pi run an alarm clock, which i can adjust. I think i would need a lcd to see what im doing :) When the alarm goes off i would like to play some calming bird sounds, which i would like to increase gradually (the dB) over a set period of time. While the sound is going i would like to trigger a strip of led's (which i want to stick to the wall atop my bed) to also gradually increase in lumens over a set period (say 30min).

Thats basically it, oh and a snoozzz button would be great :D

I have figured i would need a type of add-on board, thats the reason why im posting this in here (but would be very glad if i can do without it), a lcd, some type of input using hour and minute buttons, speakers, and a strip of led's.

I would like to mimic sunrise as close as possible (in color and the gradual increase in light) if that is possible and it should be light enough to enable to wake me (250 lux?)

I would like to know if anyone can point me into an direction into which parts i would need to accomplish this.

The only thing is that i live in south africa, so ordering some specialized goods online (from adafruit for example) would unfortunately not be an option as the shipping and import tax alone would probably kill my budget :roll:
Is it possible to accomplish this using 'generic' parts that i can buy locally from an specialized electronic store for example?
Can i do without an add-on board?

Thank you very much
Intell1gence
Wes-Kaap!

Fathima Sheik
Posts: 20
Joined: Fri Jan 11, 2013 12:05 pm

Re: Building a Wakeup light

Thu May 09, 2013 8:51 am

Hi,

We represent Farnell Element14 in SA and ship daily reducing cost of freight to customers. Should you wish to order any product/add-ons from Farnell, feel free to enquire with us at anytime : sales@eexpress.co.za

We are carrying some Raspberry Pi products in stock for same day orders.

Thanks

Fathima Sheik
Electrocomp Express (Pty) Ltd
+27 (0) 11 458 9055
0860102020

Rene_is_I
Posts: 172
Joined: Tue Dec 25, 2012 12:52 pm

Re: Building a Wakeup light

Sun May 12, 2013 10:27 am

@Intell1gence

There is an easier way to achieve your goals, don't draw the curtains and leave a window open.
Seriously though, what you are trying to achieve is relatively easy using a script and some pwm on the GPIO.
First decide on things like how long the snooze period should be, the dB/time ramp for the audio, the pwm ratio over time to increase LED intensity and lastly how you want to display the time, on seven segment displays or the monitor.

Once you have decided on all that, have a look at Gordons WiringPi https://projects.drogon.net/raspberry-pi/wiringpi/ which also does PWM.
For the actual hardware, you drive some PowerFETS with the PWM which will set the LED intensity.
The audio clips are easy to play using one of the built-in media players.
Best use a command line one as then you can invoke it from your script.
As for the playback volume, use the mixer.
For the snooze, connect a button to one of the GPIO pins and read it periodically.

Lastly if you decide to display the time on the monitor then you have many options depending if you are using X or not.
If you would rather display the time on seven segment displays, then best to multiplex the output as this will save on GPIO pins and also decrease overall current consumption.

Good luck.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Building a Wakeup light

Sun May 12, 2013 10:36 am

Having a big screen on all the time is likely to stop you sleeping, so check out Texy's small LCD displays: http://www.raspberrypi.org/phpBB3/viewt ... 59&t=43286

Rene_is_I
Posts: 172
Joined: Tue Dec 25, 2012 12:52 pm

Re: Building a Wakeup light

Sun May 12, 2013 10:39 am

rurwin wrote:Having a big screen on all the time is likely to stop you sleeping
A good point.

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Building a Wakeup light

Sun May 12, 2013 12:04 pm

Rene_is_I wrote:@Intell1gence

There is an easier way to achieve your goals, don't draw the curtains and leave a window open.
That's an intersting point - however I've just returned from a few weeks to places closer to the equator than where I live, and one issue I had was not just early light, but early heat. One solution that seems to be employed is shutters over the windows - to keep both the light and heat out.

And it's not just a problem for hotter countries, but northen ones too - where it starts to get light at 3am in Orkney/Shetland and where blackout curtians are order of the day - for summertime use at least.

Back to the task at hand.. Several issues here. One is timing - but that's not hard. For a fixed time of the day, use the crontab mechanism. So you can write a program that starts with the lights off, then gradually increases their brightness to full, waits for you to push a button, do a quick fade on the light and exit. That makes testing easy and your program doesn't have to read the time as Linux on the Pi can do it for you.

The hardware - you need to work out what lamps/LEDs/etc. you'll use and how to drive them. Easiest would be a bank of white LEDs and some drivers, but if you want colour then you'll need some RGB's. Working out the drivers may be problematic, but for LEDs up to 500mA or so, then uln2803's will work for you. You could arrange many LEDs in a grid with multiple uln2083's driving small sections of the grid.

It's not a difficult project - for me the hardest part would be making it look nice - if you're handy with woodwork, then you can make a nice box for it all, etc. rather than a geek nightmare of wires, switches, etc...

-Gordon
--
Gordons projects: https://projects.drogon.net/

Rene_is_I
Posts: 172
Joined: Tue Dec 25, 2012 12:52 pm

Re: Building a Wakeup light

Sun May 12, 2013 12:11 pm

gordon@drogon.net wrote:
rather than a geek nightmare of wires, switches, etc...
Hey, you're describing my workroom :D

gordon@drogon.net wrote:
but if you want colour then you'll need some RGB's
Very true.
I'm not quite sure what the colour temperature of natural light is (should be easy to find) and simulate it with RGB LEDs by adjusting the PWM to each of the R,G & B inputs.

limpens
Posts: 38
Joined: Thu Sep 13, 2012 1:15 pm

Re: Building a Wakeup light

Sun May 12, 2013 1:00 pm

been there, done that :-)

Completely dissatisfied by the Philips product (it kept turning the alarm on at the most odd times) I decided to make one of these things my self.

Most components will be available by Adafruit.
I've used an oLed display for displaying the time, this is turned off unless a button is pressed or the alarm is active. I've used a single (white led backlight) button and the software is able to distinguish long and short 'presses' of the button.

All configuration is done using a browser, the software running on the pi is monitoring a directory for new information written by a cgi program (thttpd is the webserver) and the web interface is build in a mix of jquery and friends.

The oled display is hooked up using a mcp23017 so it can be used over i2c.
I did use a couple of standard rgb leds with opamps, but I'ld suggest to use spi-driven rgb strips, a lot easier to address and get proper colours/brightness.

The backlight for the button is driven by pwm, so it is pulsing using a sin-array of values.

Additionaly I've added a rf433 transmitter so a set of creative 2.1 speakers (with amp) is turned on when the alarm starts an audio stream (h264 from sat. receiver).

All is driven by a single multithreaded application and making both the software and the hardware was a nice experience.

Adafruit product numbers:
RGB leds: 306
mcp23017: 732
oled display: 823
white led ring button: 558

@Gordon: to complete the product, I've build a plexiglas enclosure, and covered it with black foil. Nice and professional looking :-)

Intell1gence
Posts: 2
Joined: Mon May 06, 2013 8:56 pm

Re: Building a Wakeup light

Wed Aug 07, 2013 2:33 pm

Hi guys! :D

Thanx for all your replies. I really appreciate it.
There is an easier way to achieve your goals, don't draw the curtains and leave a window open.
That unfortunately is not an option for me. Living close to a nightclub with spotlights shining in the direction of my windows, makes it a bit difficult for me to get to sleep without closing some of my windows and drawing the curtains. If only life was so straight forward. :roll:

I’ve done a bit of searching and found these 12v led strips:
http://www.oznium.co.za/led-lights/wate ... rip-light/
I would go for the premium strips. The warm and cool white ones produce 300 Lumens per meter while using about 5w/meter. There is also a RBG option @250 lumens/m.

I have three questions regarding this product:
My main worry is not waking up due to not enough light being produced. Is 250/300 lumens enough or do you think ill need 2 meters?

Should i rather go for the RGB strip? Will it be worth it sacrificing 50 lumens? Would you?

If i go with the white strips, should i go for the cool or warm one?

I see the colour temp of horizon daylight is about 5000K
https://en.wikipedia.org/wiki/Color_tem ... t_lighting

Lumens during sunset/rising is about 400
https://en.wikipedia.org/wiki/Daylight# ... conditions
Once you have decided on all that, have a look at Gordons WiringPi https://projects.drogon.net/raspberry-pi/wiringpi/ which also does PWM.
For the actual hardware, you drive some PowerFETS with the PWM which will set the LED intensity.
Thanx @Rene_is_I
I have spoken to someone studying electrical engineering and they have also advised me to use a method called pulse width modulation.

Would you advise me on using something like a Humble pi prototyping board or is there something that will fit my needs better?
http://www.pifactory.co.za/node/54

Ok, the following is a wild in-the-dark guess, please correct me if im wrong;

Regarding the power supply; i would like to be able to only have to use a single PSU. While searching for power supplies that would supply at least 2A, and seeing how much they go for, i immediately thought, why couldn’t i just use a computer atx PSU and power it all from there. It already has separate 5v and 12v outputs; that would mean i could get away without using a voltage regulator to supply the pi with its needed 5v. I could connect the standby 5v to the pi and send a signal to the PSU when i need the 12v to start coming on. This would avoid the need to have the psu on the whole time (having that fan blow through the night is surely going to disturb me).

Ok so now here comes the question: Is it possible to do the needed PWM by signalling the PSU directly from the GPIO's? Ive done a bit of reading and as far as ive read, atx psu's actually work by means of 'switching' which involves PWM. Can i not tap into this and PWM the 12v line by only sending signals from the pi?

Can i get away with only using the GPIO pins and doing all of this using coding?

Thanx for all of your inputs Guys! I know i am not the only one who is going to appreciate it ;)

Return to “HATs and other add-ons”