Introduction: Smart LED Window

Picture of Smart LED Window

A fake window, powered by LED strip lights, controlled by a Raspberry Pi

Like most basements, mine was dark with only a couple tiny windows letting in almost no light. In order to brighten it up and make it feel a little less claustrophobic, I created a fake window to let in some natural-looking light.

The window is controllable via web interface. The LED strip brightness can be manually, or automatically set according to sunset/sunrise times and the weather pulled from the Yahoo! API. If it's sunny, the window is bright, if it's cloudy, the window is more dim. It fades on at sunrise, and fades off at sunset.

Materials Needed

  • 2 - 8ft trim boards for frame
  • 2 - 8ft 1x4 boards for sides and sill for frame
  • 2 - 8ft 1x3 boards for sides for frame
  • Old sheet, or canvas (to cover the back of the frame)
  • Tin foil (to cover the canvas)
  • Spray glue
  • Short nails, or staples for staple gun
  • 1.5in screws
  • Window shade
  • 2 - 16ft LED strip lights, daylight white (Amazon)
  • 12 volt power supply for lights (Amazon)
  • Extra wire (2-3 ft.)
  • 2 jumper wires (male to female) for Raspberry Pi GPIO
  • Raspberry Pi (vers. 2 or newer)
  • MOSFET for controlling LEDs (Arrow)

Tools Needed

  • Saw (handsaw or table saw)
  • Screwdriver or drill
  • Staple gun
  • Soldering Iron

Step 1: Build the Window Frame

Picture of Build the Window Frame

Determine the exact dimensions needed for the window. My window shade dimensions were 31x44 inches, so that was my starting point. I used the 1x4 board on the two long sides, overlapping the shade by 2 inches. This will allow the shade to move up and down while keeping it approx. 1 inch away from the LEDs to provides better diffusion of the light. If the shade is too close to the LEDs, you'll be able to see the LEDs through the shade.

Measure and cut the 1x2 board, and the trim board to match the length of the 1x4 boards. Then affix these boards to line up with the outside of the 1x4 board.

Now we'll need to measure and cut the 1x3 boards for the top and bottom of the frame. The top should be same width as the frame, and the bottom (window sill) should be about one inch longer on either side. Attach these with screws.

Last, measure and cut a trim piece which will go under the sill. This is typically the same width as the window (not the sill).

Step 2: Attach the Canvas Backing and Tin Foil

With the frame created take the canvas (or sheet) and use a staple gun to staple and cover the BACK of the frame. Stretch it relatively tight before stapling. Put a staple every 3 or 4 inches. When complete, cut off any excess material.

Now, using the spray glue, spray the canvas from the FRONT side and then cover with tin foil. Make sure the shiny side is pointing out. Cut off any excess tinfoil when done. This will help more of the light from the LEDs to be reflected out, and create a nice even diffusion of the light.

Step 3: Attach and Wire the LED Strip Lights, Raspberry Pi and MOSFET

Picture of Attach and Wire the LED Strip Lights, Raspberry Pi and MOSFET

Make sure the power is UNPLUGGED while wiring everything up! We don't want to short out the power supply, or kill the Raspberry Pi while setting everything up.ds

We need to attach the LED strip lights to the canvas/tinfoil backing. For the size window I was creating, rows of about 3-4 inches apart worked perfect. Start in the upper right, and work your way down, peeling the adhesive backing off the strips as you go. Once the first strip is attached, begin attaching the second strip where the first strip left off. DON'T connect the strips to each other. The second strip will be VERY dim by the end if you do this. We'll want to wire them up in parallel instead.

Each strip should come with a plastic connector wired to a female plug. Cut off the female plug, and strip and expose the black and red wires. Connect the plastic connector end to the strip lights. Then connect the wires as shown in the diagram.

Using the MOSFET wired to the Raspberry Pi, we can control the lights. See the wiring diagram above. I used GPIO 21, and the ground pin right next to it for this. Any GPIO and ground will work. I got the MOSFET from Arrow, about $0.50 (link).

To power the Raspberry Pi, I used a 12v to 5v DC Buck Converter (Amazon). This is not required, any Raspberry Pi power supply can be used. But using the Buck converter, I can power the whole setup from the single LED Strip power supply.

Step 4: Install and Configure Software on the Raspberry Pi

Picture of Install and Configure Software on the Raspberry Pi

I'm assuming the Raspberry Pi is at least version 2 or newer, with the latest Raspbian/Pixel OS installed, and Wifi already configured. Open a terminal, or SSH in for the following steps.

Install the web server

I used Lighttpd for the web server, and a combination of Python and PHP for functionality.

sudo apt-get install lighttpd php5 php5-common php5-cgi

Next, set some privileges on the web directories:

sudo chown -R www-data:www-data /var/www
sudo chmod -R 775 /var/www
sudo usermod -a -G www-data pi

Now enable PHP

sudo lighty-enable-mod fastcgi-php

And restart the server

sudo /etc/init.d/lighttpd force-reload

Grab the code from Github

I've published all the code for the web interface, and auto-brightness script on Github. Download the files. Place the html directory in /var/www/, and put in /home/pi/

Add some cron jobs

We need the pigpiod program to start on boot, and also we want our "auto-brightness" script to run every 10 minutes. Lets add these to the root cron:

sudo crontab -e

And then add the following:

# Auto adjust the window brightness
*/10 * * * * /home/pi/

# Start Pi GPIO Daemon on reboot
@reboot /usr/bin/pigpiod

Reboot and Test

Reboot the Pi. When it comes back up the web interface should be accessible on your computer or smartphone by going to http://IP_ADDR in a browser.

Step 5: Enjoy

Picture of Enjoy

Enjoy your window, and the extra light!


amaze1 (author)2017-01-04

Really like this project. I always wanted to do one like this.

Recently have bought some strips with new kind of "addressable" leds SK6812, very similar to WS2812 that is RGB but also available with "W-WW-A" combination (read White-WarmWhite-Amber) that can mimic a wide spectrum of natural light.

You don't really need to "address" every single led, but the advantage is that the control line for white shade and luminosity is just one, so that the versatile ESP8266 can master the whole thing easily.

(unfortunately these strips work at 5V, so you need more amps to achieve the some luminosity)

Also there are sketches for ESP8266 that use its embedded Access Point feature and expose a simple html page with various controls.

MonkeyWrench3232 (author)2016-11-26

I have everything hooked up and it works except the lights are much dimmer than they should be. They are not wired in series (I have them hooked up via headers and when I unhook one set the brightness does not change of the other set).

Could it be my MOSFET? I used this one:

All of the other parts are the exact same as what you used.

dannyk6 (author)MonkeyWrench32322016-11-28

Hmm, it could be the MOSFET. You want a "logic level" mosfet that can be driven by the 3.3v coming out of the Pi's GPIO. Some of the MOSFETs are 5v, meaning the Pi would only be able to partially open the gate leading to a dim LED. I don't see any specs on that site that say anything about voltage requirements.

MonkeyWrench3232 (author)dannyk62016-11-28

I went ahead and ordered the same MOSFET that you used so hopefully that's it. I soldered the parts to an Adafruit Perma-Proto HAT and right now the LED strips are only getting 7.2 volts but if I put the multimeter leads between the hot where the LED strips connect and the standard ground it's the full 12 volts. I'll report back on the result.

It definitely was the MOSFET! Everything's working as it should!

RickB113 (author)2016-11-25

I have an ardruino. There is a part on this instructable that I get a 404 error. It's the MOSFET part I can't find the specific one to do this I have everything else but that.

I really want to build this but will not due to not having the MOSFET part due to a dead link.

Raitis (author)RickB1132016-11-26

If you look at the link he gave, there is actually the component code in it, if googled, you can find alternative retailers.

It's irlb8721pbf, adafruit has some.

greiss122 (author)2016-10-30

Very cool. My bedroom has no windows, so I'd love to try building one. Any way to do this with an Arduino?

Erroneous1 (author)greiss1222016-10-31

An arduino could be paired with a photovoltaic cell (light sensor) positioned where it could see the sky instead of using web data. If you have an arduino with lan/wifi/bt you could, but those components are expensive. You could just to sunrise/sunset with no cloud cover using an Ardiuno and a realtime clock. Pi is the easiest way to do it without having a window to put the light sensor.

RickB113 (author)Erroneous12016-11-25

I have an ardruino there is a part on this instructable that I get a 404 error. It's the MOSFET part I can't find the specific one to do this I have everything else but that.

Twyg (author)Erroneous12016-11-01

I was thinking the same Greiss. Thanks Erroneous1, I appreciate the tip on this one. The reason I need a swifter response time is due to a dark corner of my kitchen. There's plenty of windows though not enough for our "dark scary" corner, so a quicker response time would be preferred. (Right corner of the pic) Would build this into the same wall as the window as a "long window"

stevempotter made it! (author)2016-11-06

Great work, Dannyk6! Just before your Instructable came out, I published a similar Instructable on a "window" using old computer monitors (CCFL) as a nice diffuse light source. Not nearly as high-tech as your solution, and therefore amenable to anyone who is not so much into the electronics hacking:

MiroTheDarkSlave (author)2016-11-05

Hi there ! Great project here ! I wanted to try and, the problem I have is the lighting is not uniform: leds are seen through the window. I did obscurify the window with this ( but even though the leds does kind of color spots instead of diffuse light. The distance between the glass and led is 11cm. Do you have the same issue ? Did you shade your window somehow ? I am considering painting the window with white painting but... I doubtfull on the result.

dannyk6 (author)MiroTheDarkSlave2016-11-05

Hi, thanks! The light on mine is not completely uniform, but it's close enough that most people don't know the window is fake. There's about 3cm distance from the LEDs and my window blind. The blind I'm using provides all the diffusion.

Did you line the back with aluminum foil? That makes a huge difference in evening out the light.

Petsfromgeorgia (author)2016-11-05

Fantastic solution for a problem I have, also. I have it almost ready to go but the LED strips don't seem to allow for curves or right angles. Did you have to amend yours in some way to achieve the pattern on your tin foil? Thanks

gravityisweak (author)2016-11-03

Awesome! What if you had a 12v solar panel outside somewhere that was directly connected to your LED strip? That way it would power your LED's and always keep them lit in direct comparison to how light it was outside?

stevenj.reynolds (author)2016-11-03

nice prodject, practical and elegant, thanks for shareing.

RowanCant (author)2016-11-01

Wow, got my vote! Such an easy and simple idea, but really makes the space feel like less of a dungeon and more of a room. If only it gave it the sun's warmth as well!!

dannyk6 (author)RowanCant2016-11-01

Great, thanks! Maybe I could stick a heater near the window :]

jaswant9 (author)2016-11-01

I like this .. better than a lamp and looks good in a room ..

BigJRM (author)2016-10-31

Yes, a brilliant idea! My old computer room in the basement could have used this a few years ago, but now it is a storage room. Our cold storage room could use this treatment, if the light gets left on, hardly any heat will be added. It is just a GREAT ible!

As for different color temperatures, those 15 foot LED strips come in different frequencies to suite your imagination. I bought 2 strips a couple of years ago to light our basement stairs. To test the concept for my wife, I ran a 30 ft. LED rope light up the four half flights on a back split. She loves it, doesn't want it changed, it stays on all the time now. So I still have the 2 light strips to use for this kind of PROJECT! THANKS A LOT!

techno guy (author)2016-10-31

We could use some of these in the building I work in. :p

ssampson4 (author)2016-10-30

great the mimicking of outside conditions! I'm new to most of this and eliminate hoping you could further explain hhe use of the mosley? (why, how it works)

ssampson4 (author)ssampson42016-10-30

should say mosfet, not mosley

dannyk6 (author)ssampson42016-10-31

The LED strips require 12v, but the Raspberry Pi works on 5v or 3.3v. The MOSFET basically allows the LED strips to be safely connected to the Pi, and also provides dimming functionality.

ssampson4 (author)dannyk62016-10-31

So the MOSFET takes the lower voltage from the Pi and transforms it to 12v? Do all MOSFETS do that?

dannyk6 (author)ssampson42016-10-31

It's not transforming anything. It allows the 5v from the Pi to control the on/off of the 12v circuit.

sirron1957 (author)2016-10-31

Another tweak could be put the LED Light strips around the edge.
Install a camera outside where the window is and put an LCD panel in the
frame. Feed the camera to the LCD panel.

S0dyP0p (author)2016-10-31

Nice instructable. A tweak could be to do it with an old window from architechtural salvage. They're cheap and ready-made, saving you the frame building step. And it would give this high-tech project a nice throwback feel.

wannabemadsci (author)2016-10-31

Really cool instructable. I like the concept and that it gives you light in an otherwise dark basement and really neat that tracks the outside brightness. You could even go so far as changing color temperature as dusk and dawn are more on the warm/yellow tint...

Also a word of caution. I read in the comments that you covered up a small existing window with the new LED window. I also saw one post about the Building Code. Something to consider is that you need a way out of the basement should there be a fire upstairs or some other reason you can't get out the normal exit path. The window you covered up might have been your 'emergency exit' path. See an interesting article on the topic

Just suggesting it is wise for yourself and others considering this project to make sure you don't block your alternate/emergency way out of the basement.

Nice 'ible.

fabelizer (author)2016-10-30

I like it! If I wanted a picture, I would consider a dedicated sideway mounted TV/monitor and a camera, looking out a 'different' window!

dannyk6 (author)fabelizer2016-10-31

That would be cool!

x_hed (author)2016-10-30

This is an awesome project. Nice work and thank you for sharing.

dannyk6 (author)x_hed2016-10-31

Thanks, no prob!

MichaelAtOz (author)2016-10-30

Looks great!

Is there any particular reason for canvas as the backing?

v's the original wall or some thin MDF?

BTW where I come from window Shades are outside windows, window Blinds are inside. Took me a bit to work out what you were doing...

dannyk6 (author)MichaelAtOz2016-10-31

No particular reason, I just had some extra canvas lying around. MDF would work. There was a tiny basement window behind my fake window, so I couldn't put the strip directly on the wall.

T0BY (author)2016-10-30

Great idea!

dannyk6 (author)T0BY2016-10-31

Thank you!

Gusgonnet (author)2016-10-31

extremely nice idea, congrats!

dannyk6 (author)Gusgonnet2016-10-31


JohnS1182 (author)2016-10-30

Do you know the color temp. of your fake window? I could use a few of these in my photo studio but they would need to be close to 5500K Kelvin.

TIA, John

dannyk6 (author)JohnS11822016-10-31

Yeah, with the LED strip I used (listed above), it's about 6000K

bambuino (author)JohnS11822016-10-31

The project described daylight balance to mimic sunlight. Is possible LED strips balanced for tungsten?

bambuino (author)bambuino2016-10-31

Whoops. Tungsten is 3200.

coolcash (author)2016-10-27

I wonder how difficult it would be to use an esp8266 instead. Would save a few dollars and make it a little less complicated to use since you don't need linux.

dannyk6 (author)coolcash2016-10-27

Hmm, haven't thought of that. I think you still might need some type of linux computer to run the web interface though.

MikeR261 (author)dannyk62016-10-30

You can run a web server on the esp8266 and I think the libraries are available with the Arduino IDE

rusty0101 (author)MikeR2612016-10-30

They are, you could. Limitations include needing to switch down to 3.3 v for one of the -01 boards, and some others.

If I recall correctly, both gpi0 and gpi2 are pwm, you could also do full color by treating the rx and tx as gpio pins, but if you're going to do that you would probably be better off just going on up to an -07 or -12. Still need the 3.3v converter, but since you wouldn't need the pi any more, you can replace the 5v converter with one that does 3.3v. (Though if you get a weemo board or one of the other developer boards for the -12, you can usually feed them 5v)

You could also use mqtt to subscribe to a light sensor on another esp8266, or other source for getting exterior light data, or subscribe to a source of your choosing. (Would you rather have lighting relevant to the people you work with somewhere else around the world?)

Set up two or three around the room and get it setup to shift the lighting with the apparent location of the sun. Lots of ideas. This could be useful as well for people working (or living) in buildings with interior rooms and no windows.

jomiller48 (author)2016-10-30

I really like this project. Someone else mentioned having outside light intensity measured from another window and programming the setup to mimic that. I wonder if you could take that a step further and use a combination of color changing bulbs and "grow" lights to simulate a more accurate representation of what is occurring outside and to provide the "feel" of sunlight and the ambience of moonlight. Then you could have the benefits of sunlight and a day/night cycle.

jermops (author)2016-10-30

Love this!

upgrade idea: use a spare camera, or a light/color sensor, placed near one of the real windows, that'll report back to the RPi and allow it to match the true local brightness and color temperature conditions in real time.

About This Instructable




More by dannyk6:Smart LED WindowDAKboard: A wifi connected wall display for your photos, calendar, news and weather
Add instructable to: