Introduction: Waking Up on the Right Side of the Bed Light

Here's a sensor-light that will let you know what temperature it is outside the moment you step out of bed... and prevent you from stubbing your toe in the process (well, I hope).

The Concept

The story begins with a tragedy. I got out of bed one morning, stubbed/broke my toe and suffered for a month because of it. I swore, no more!

The problem is that I'm lazy when I'm waking up. The effort of reaching over to the lamp is just too much. If only a light would come on the moment my foot hit the floor. Eureka!

Now, a rug that turns on a light sounded way too easy, so I thought of another annoying ritual of the morning: checking the temperature in order to decide what to wear. What if the light also told me roughly what temperature it was so I'd know weather [sic] to wear shorts and a t-shirt or a parka and snow pants? Sounds great to me.

Breakdown

I've broken the instructions into five chapters:

  • The rug sensor - The design for the rug sensor is pretty straight forward and follows what a lot of other DDR pads have done. I found this simple electronic button by gitterbug23 a great inspiration for materials.
  • The light - There are a lot of ways to make a light, and Instructables offers many options to explore. You can follow the instruction I offer, or choose your own. I chose a "rustic" approach, which probably ranks average in time and difficulty requirements (when compared to other solutions on this site). Since the electronics used don't generate much heat, the actual housing isn't much of a concern (as in, building a paper lamp is perfectly fine). If you chose a different lamp, make sure that it can house the electronics: 3.2"x4"x.7" for the SBC plus about 0.2" around for input and output clearance. Then have some sort of cover to house a small board with five RGB LEDs.
  • The temperature sensor - If you decide to use a temperature sensor, it has to be installed and protected from rain.
  • The program - I chose to use a PhidgetSBC to handle the processing. This is what's handling the sensors and setting the colour of the lights. I ended up doing two versions of the program. One grabs the temperature from a temperature sensor while the other pulls the temperature from the web.
  • Putting it all together! The exciting part

And here it is!

Step 1: The Rug Sensor

The design for the rug sensor is pretty straight forward and follows what a lot of other DDR pads have done. I found this simple electronic button by gitterbug23 a great inspiration for materials.

Materials:

  • One smallish rug (I went with an Ikea Signe for $2.99)
  • 1/8” thick cork, two pieces the same area as the rug
  • 1/8” thick upholstery foam, one piece the same area as the rug
  • Heavy duty aluminum foil, as wide as you can get
  • Double sided tape (a 42’ roll of some indoor carpet tape seemed to do the job quite nicely without too much left over in the end)
  • Electrical tape
  • Two lengths of insulated wire to reach from rug to lamp (I used two 5’ pieces - 23AWG worked well)

Assembly:

  1. Cut your pieces of cork and foam so they fit under the rug. Prepare the foam by punching 0.5” diameter holes, each about 1” apart.
  2. Put double sided tape on the top of one piece of cork that'll fit the width of the aluminum foil. Make sure to put some extra strips along the centre so the foil doesn’t come loose. Secure the aluminum on the tape. Leave at least 1" of cork around the edges, except for one protrusion of aluminum foil to the edge, which you will use to attach the wire (see picture). I put electrical tape around the edge of the aluminum foil for extra fastening and to prevent an aluminum foil from accidentally coming loose.
  3. Strip 0.5" off the end of the one of the lengths of wire. Use electrical tape to secure the exposed end of the wire to the aluminum foil.
  4. Use more double sided tape just around the very perimeter of the foiled cork. Do not tape around the protrusion of aluminum foil! This will allow you to access it in the future (the attached wire is the most likely spot to break). Lay the holy foam (that is, the foam with holes in it) on top.
  5. Now, prepare the other piece of cork with aluminum foil in the same fashion that you prepared the other piece. Make sure the protrusion of aluminum foil will be in the same approximate spot as the other one when it's turned upside down. So, if both are foil side up, the aluminum foil protrusion will be mirrored. Attach the wire in the same fashion as the first.
  6. Put double sided tape on the perimeter of the newly prepared foiled cork (not taping the protrusion) and sandwich everything together.
  7. Now tape the rug on top of the cork in the same perimeter and criss-cross fashion that I've described. In the end you’ll have something like this (from top to bottom): rug, cork, foil, foam, foil, cork.

Step 2: The Light - Parts

As mentioned, there are a lot of options for what kind of lamp you can build for this. You can follow the instruction I offer here, or choose your own.

I chose a "rustic" approach, which probably ranks average in time and difficulty requirements (when compared to other solutions on this site). Since the electronics used don't generate much heat, the actual housing isn't much of a concern (as in, building a paper lamp is perfectly fine). If you chose a different lamp, make sure that it can house the electronics: 3.2"x4"x.7" for the SBC plus about 0.2" around for input and output clearance. Then have some sort of cover to house a small board with five RGB LEDs.

Materials:

  • One piece of perf-board (must be at least 2.5" wide)
  • A block of wood, at least 4"x4.5"x7"
  • A regular-mouth pint-size mason jar
  • Frosted glass spray paint (I used Rust-oleum brand)
  • One pack 5 super-flux RGB LEDs
  • A few feet of insulated wire (I used 23awg in black, red, green and blue)

Tools:

  • Sandpaper
  • X acto knife
  • A lathe, drill press, dremel and/or various woodworking tools

Assembly (Part 1 - Parts):

  1. Start with the perf-board: Cut out a 2.375" diameter circle to fit inside the mason jar's ring (you can also just trace the flat cover of the mason jar lid onto the perf-board). I used an x acto knife to make light perforations and snapped the board. I then sanded the edges a lot to get it to the circular shape using 60-grit sandpaper (we're just looking to get the job done, we don't need to make it look particularly pretty.
  2. Now for the block of wood: In the middle of one of the sides, cut a rectangle into the wood that's 4.3" tall by 0.875" wide and 3.4" deep. On the top of the block, cut out a circle with a 2.75" diameter and is 0.75" depth. This hole should fit the mason jar ring snuggly (modify as needed with sanding or glue to get it to fit right). Then, drill a hole from the centre of that circle to the cut rectangle. This hole will be used to bring the wires from the lamp to the SBC, which will be housed in the rectangular extrusion.
  3. Finally, the mason jar: Spray the mason jar with the frosted glass spray paint as per directions (I'd really like to play around with different designs on the jar, but didn't have the right materials at the time). Allow to dry and apply more coats as necessary.

Step 3: The Light - Electronics and Final Assembly of Light

Materials:

  • The cut perf-board from the last step
  • One package of super-flux RGB LEDs (five lights per pack)
  • About 2 feet of insulated wire (I used 23awg in black, red, green and blue)

Tools:

  • Solder and soldering iron

Assembly (Part 2 - Electronics):

You'll probably want to take a careful look at the pictures for a better idea of what I'm talking about in these instructions:

  1. Line up the five LEDs in the perf-board so that the notched corners are on the same row. Put a short length of wire into the hole with the appropriate coloured wire to each lead of the LED and solder the connections on the underside.
  2. Collect the bunches of colour as shown in the picture. I found a maximum of three wires would fit through any one hole in the perf-board I bought. Solder these groups together on the underside. In a hole next to the groups of wire, attach a longer piece of wire (about 4") and solder it so it comes out from the underside. Then, use solder to bridge this wire to the group of wire (see picture for what I mean).
  3. Use the mason jar ring to screw the perf-board onto the frosted jar. Put the LED side of the perf-board into the mason jar and let the wires come out the top.
  4. Thread the wires through the hole you drilled in the top of the block of wood. The mason jar ring should fit snugly in the hole, you can glue it in if it's lose.

Step 4: The Temperature Sensor

If you plan to pull weather data from the web, you can skip this step. The advantage of having your own temperature sensor is that you'll get data for right outside your door, as opposed to the nearest weather station. Also, the temperature sensor allows the lamp to change colours as the temperature changes, where as the web API does not.

Materials:

Assembly:

  1. If you're using the wooden block approach (as opposed to the weather box), attach the temperature sensor to the bottom of the block of wood using the mounting kit provided.
  2. Screw the wooden block to your house in a location reasonably close to a window where you'll be setting up the nightlight). This will save you from (a) having to drill through the wall of your house by running the cable through the window and (b) having to run ridiculously long wires. The longest sensor cable that Phidgets sells is 350cm, so keep that in mind. If you need more length, you'll need to make your own sensor cable.

This solution has proven to work very well for temperature sensing over the long term (5+ years). However, humidity values did start to become quite skewed as more dust got into the sensor.

A high quality weather box will be better at protecting the sensor. If you're using this approach, just mount the temperature sensor inside your weather box and place it outdoors. As mentioned before, try to place it reasonably close to a window where the nightlight will be.

Step 5: The Program

I chose to use a PhidgetSBC to handle the processing. This is what's handling the sensors and setting the colour of the lights. I ended up doing two versions of the program. One grabs the temperature from a temperature sensor while the other pulls the temperature from the web.

Materials:

  • One PhidgetSBC with power adaptor
  • A wi-fi dongle (or just use the wired ethernet connection provided with the PhidgetSBC)

Assembly:

  1. Plug the power adaptor into the wall and attach the barrel connector to the SBC. Then hook up the internet connection (if you've never used a Phidgets SBC before, check out this video for a getting started guide).
  2. Log onto the web interface and create a new project, I'll call mine nightlight.

The Temperature Sensor Solution

  1. Download the attached file and unzip it. Upload the files in the "nightlight-tempsens" folder to the project folder on your SBC.
  2. You can modify the lighttemp.h file to set up your own temperature sensing or change the inputs/outputs that you'll be connecting the lights and sensors to on the SBC.
  3. Use ssh to log onto the SBC (i.e. ssh root@phidgetsbc.local and use the password you set for the admin role on the web configuration). Navigate to the project directory:
    cd /usr/userapps/nightlight/
    and run:
    make
  4. Go back to the web configuration and enable the nightlight program using the menu selection at the bottom of the program page. When you're ready to run the program, just hit the start button at the top of the page.

The Web API Solution

I used http://openweathermap.org/API to gather temperatures. It works really well for me in urban Canada, but it's very possible that if you're from another region, you'll need to find another weather API.

  1. Download the latest version of cURL. You can transfer the archived file to the SBC using scp or you can upload it on the SBC web configuration tool. It doesn't matter where you put it, so just put it in the /usr/userapps/nightlight folder that you just created, and delete it after it's installed.
  2. You’ll then need to use ssh to log onto the SBC (i.e. ssh root@phidgetsbc.local and use the password you set for the admin role on the web configuration).
  3. Unarchive the tar.gz file (i.e. tar -xzvf curl-7.37.0.tar.gz) then go into the cURL directory. Install using:
    ./configure
    make
    make install
  4. You can now delete the tar.gz file and the extracted directory.
  5. On my SBC, I had to add the line “/usr/local/lib” to the ld.so.conf file found in /etc/ then run ldconfig.
  6. Download the attached file and unzip it. Upload the files in the nightlight-webAPI folder to the project folder on your SBC.
  7. You can modify the lighttemp.h file to set up your own temperature sensing or change the inputs/outputs that you'll be connecting the lights and sensors to on the SBC.
  8. Use ssh to log onto the SBC (i.e. ssh root@phidgetsbc.local and use the password you set for the admin role on the web configuration). Navigate to the project directory:
    cd /usr/userapps/nightlight/
    and run:
    make
  9. Go back to the web configuration and enable the nightlight program using the menu selection at the bottom of the program page. When you're ready to run the program, just hit the start button at the top of the page.

Step 6: Putting It All Together

Materials:

Assembly:

  1. If you're using the temperature sensor, attach one end of the 350cm sensor cable to the temperature output of the temperature sensor. Attach the other end to analog input 0 on the SBC.
  2. Using the 10cm sensor cable, attach the reflective sensor to analog input 3 on the SBC.
  3. Strip 0.1" of the insulation from the wires of rug sensor. Attach one of the wires from the rug sensor to digital input ground (G) and the other to digital input 7.
  4. Strip 0.1" of the insulation from the wires coming from the lamp. Attach the black wire to digital output ground (G), attach one of the red wires to digital outputs 0 and the other to 1. The green wires go into 2 and 3. The blue wires go to 4 and 5.
  5. Slide the SBC into the rectangle-shaped hole. Secure in place. Using the mounting hardware, screw the IR reflective sensor onto the wooden block. I put it on the back so it didn't obstruct the look of the wood.
  6. Make sure you SBC is plugged in and on the internet. Go to the web configuration and run the nightlight program from the project page.

* If you change any of this around, it's easy to go into the "lighttemp.h" file and put in the input or output you attached something to. *

Step 7: Next Steps

What you've got is a lamp that turns on and off when you step on the rug. The distance sensor on the back also turns the light on (to bright white) and off, in case you just need some bright light. The light shows the temperature outside.

  • Straight blue for temperatures under -7˚C
  • An icy green for temperatures between -7˚Cand 5˚C
  • Purple for temperatures between 5˚C and 15˚C
  • Green for temperatures between 15˚C and 22˚C
  • Green-Red for temperatures between 22˚C and 27˚C
  • Red for temperatures above 27˚C

There are still a few areas where I think this project could be improved:

  • The lamp is still pretty plain and simple. I'd like to do some wood burning around it and replace the mason jar with a more intricate frosted design (maybe clouds).
  • The attachment of the wires to the rug could be improved as it is a bit finicky.
  • In the web-API I'll probably start polling the temperature every 10 minutes or so. That way, when the light is on, the colour will change as the temperature changes outdoors, like it does when using the sensor.

Good luck with your project! I'd love to see pictures of your rug sensors and lamps if you make them.

Comments

author
Robibame (author)2014-07-05

I dig the idea of making the light differ in color based on temperature. I'm not sure if I'da ever thought of that. very cool.

author

What a nice way to wake up! Great idea!

author

Thanks... although this morning it was icy green, which means under 5˚C and that was not so nice :)

author

Wow, that's cold! brrrrr!

About This Instructable

10,978views

179favorites

License:

Bio: Math lover. Engineering communicator. Mad-lib enthusiast. Total nerd. I work at TELUS Spark as a champion of engineering communications. I love to fill my brain ... More »
More by kahht:Fancy Cheese Potato SkinsCanti Robot Costume From Fooly Cooly (FLCL)Heather's Cheesy Potatoes
Add instructable to: