Photo Sensor Controlled Outlet (turns on or Off at Daylight or Nightime)




About: I am a life long biz owner. I've been fortunate enough to have a successful business and a fun life.

If you look around, it is very easy to find a photoelectric sensor switches that shuts off lights during the day. What if your project needed you to turn on a item during the day and shut it off at night. I guess those are also readily available but at a ridiculous prices nearing $100+. This kit allows is made up of readily available parts, you may even have them in a parts bin.

I made it using separate GFIs. The reason is simply because they were available. You can save money by getting a GFI electrical cord. Personally I don't mind the double GFI protection. If day time control trips I won't loose my night time control.

Parts List:
- Extension Cord
- Cord Grip
- 1 or 2 GFI Outlets
- Wire
- Relay Socket
- SPDT 120v Relay
- Photocell or Photoelectric Sensor
- Wire Nuts
- 120v Small Bulbs

- Drill
- Step Bits or Drill Bits
- Wire Strippers
- Painters Tape
- Knife or Dremel
- Outlet Cover (for template)
- Marker
- Screwdriver

This is just for experimental purposes. Project boxes are not UL rated for 120v electrical. If you are interested in making one you can simply replace the project box with the plastic UL rated electrical boxes.


Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Prepping Project Box

Drill out the hole for the electrical cord. Be sure to insert the nut of the cord grip first before you begin wiring anything otherwise you will find yourself having to undo all your wiring in order to slip the nut on. At this point I went ahead and separated the ground out into 2 for each outlet.

Step 2: Creating Labels

I started to create labels for all my wires to make it a breeze when it comes time to connect them. After-which I went ahead and started placing some of the wires where they belong.

Labeling makes for a much easier project build. Below you will see the label list followed by a text diagram of where they go. I labeled them in layman's terms so they are easier to understand. 

Also label each outlet (night or day) if you are using two outlets. Disregard if you are just using one.

#2 Relay
#2 Relay
#3 Relay
#3 Relay
#5 Relay
#6 Relay
#7 Relay
#8 Relay
White Wire (cord)
White Wire (cord)
White Wire (cord)
Hot/Black (cord)
Hot/Black (cord)

Prep wires by splicing at each end (approx. 7) and add labels. Here is a text diagram of what labels go on which wires.

--- Dotted lines represent a wire
[ ] Brackets are the Outlets

#7 Relay--------------------White Wire (cord)
#6 Relay--------------------Hot/Black (cord)
#5 Relay--------------------Hot/Black (cord)
[day]-------------------------White Wire (cord)
[day]-------------------------#2 Relay
[night]------------------------White Wire (cord)
[night]-----------------------#3 Relay

Photo Sensor:
Red Wire - attach to #8 on relay
Black Wire- attach to Hot/black wire on supply cord
White Wire- attach to White wire on supply cord

Night Bulb- One wire goes to White wire on supply cord the other goes to #2 Relay

Day Bulb- One wire goes to White wire on supply cord and the other to #3 Relay


Step 3: Prepping Faceplate

I started to create the faceplate for the project box. I taped up the cover with frog tape and put double sided tape on my template (the white outlet cover). The cover turned out to be a great template. I drilled out the corners then began to cut with my olfa knife. It took a few swipes but it worked out fine. I marked my holes for the bulbs and the photoelectric switch. once complete I wired up the face plate. The bulbs must be fed through the faceplate before wiring up.


Step 4: Bulb Wiring

Grab one of each color wire from the bulbs. It doesn't matter which wire. What I did was solder both of them along with another wire that will attach to the white supply wire. I did that because the wires were so little that I felt they would come un-done inside of a wire nut. Espessially when the would be beside a much wider wire.

Step 5: Wiring It Up

If you followed step 2 and created all the labels necessary. I'm sure you also attached all the labels to the appropriate wires. You can now begin to attach all the wires to the appropriate locations.

Please note that I added a jumper from relay number 5 to number 6. You can see in the picture above.

Once you are done you can install the outlets to the faceplate and install the plate. Congratulations you just created your own light controlled outlets.

Step 6: Other Applications

This light control can be created with just a day or night time control. It can also be made in a much smaller manner with both day and night control by using a special outlet that does not have both outlets wired together or better known as an altered dual outlet. No worries they are available at your local hardware store.

1 Person Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

16 Discussions


4 months ago

There's a MUCH MUCH easier way... and cost $5 Here's how...

Buy two photo sensors from eBay at $1.60 each.... and any light bulb.

Put one sensor in normal light and the other in a shoe box with the light bulb. When it's dark the first photo sensor will turn the light on in the shoe box (with the second sensor.)

It's dark outside but the light in the shoe box tells the second sensor to turn off. When it's light outside the shoe box will be dark... telling the second sensor to turn on.

If you use this with solar panels you'll get significant INCREASE in efficiency because solar panels normally supply WAY WAY MORE power than the batteries can accept at their maximum charge rate. You can draw this extra power from the panels that the batteries can't take..... during the charging daylight hours. So you run your freezer, water pump, etc during the day and turn them off part of the night.


Question 1 year ago

Could you use a 6 pole DPDT relay instead of the 8 pole SPST relay? Reason is I'd like to try a solid state relay and I could only find one maker for them in DPDT format.


Question 1 year ago

Thanks iceng, that's good advice! Appreciate the diagram as well


Question 1 year ago

Could you provide a wiring diagram for the relay-> photosensor part of this project? I am looking for a way of automatically turning of a solar PV charging system when the light goes and think this could be just the thing.


1 answer

Answer 1 year ago

All you need to provide auto charging is a simple diode that blocks any discharge at night or when a cloud passes over your PV array.

Normally when the light level falls and the PV drops below the battery the PV acts like a resistor but the one way diode prevents reverse current from discharging the battery..

Do click the pic to see the entire image !


1 year ago

Simply amazing Arizno! Going to use this to directly power a 240 volt ac motor
adapting/emulating your 120 volt plans) to run a gear-track
assembly to open and close greenhouse insulation panels day and night

It's a reversible motor and pretty sure can wire it to run both ways
without need for a DPDT relay in between. A lot of motors say
interchange red & black wires to run in reverse. Since with your
design, just one circuit would be operating at a time I can run
red-black wires to one outlet & black-red to the other on same circuit. Please
correct me if I'm wrong.

Was going to use a 365 day programmable timer with 2 relay outputs but
your design doesn't need programming, operates even on a leap year &
is much cheaper. The only other electronic devices needed are
limit/snap switches to stop the motor once it reaches the end of it's
track when insulation panel assembly closes, and releases to power
back on for next cycle when insulation panel assembly opens.

So simply elegant & versatile, this has become both one of my
favorite electronic projects as well as devices. Thanks!


2 years ago

I need something like this but for 12 volts. I want something that is time adjustable. I want it to open my RV awning when it's day then close it when it's dark.

1 reply

Reply 1 year ago

That would be pretty simple. I would go the route of using an Arduino or Raspberry Pi you can also control it manually as well, either by phone (bluetooth) or pushbutton.


3 years ago

Great writeup. One question though, do you have a part number for the relay? Everything else is pretty much self explanatory.

1 reply

4 years ago on Introduction

Exactly the kind of info I was searching for. Just bout a screw in sensor at Walmart for $6.97 and calculated the 8 Watt LED bulb would take 4 years, running 12 hours a days as opposed to 24 hours a day, to pay for the sensor control. Would be interested in knowing how much for your sensor and where you obtained it.


4 years ago on Introduction

This is an awesome idea.

Can you give more specifics on the relay portion? I understand the concept but I don't know which relay to purchase. When I Google SPDT 120V relay it seems there are many options. Can you list a part number? How many ports on your relay?

How does a relay socket differ from a relay?

Thank you kindly for sharing this cool project!


5 years ago

So would this work in an application where a light would turn on/off at sunup/sundown?

1 reply

Reply 5 years ago on Introduction

Yes, The outlet on the left turns things on during day light and the outlet on the left turns things on at night. I put a orange bulb to represent day and a green bulb on the right to represent night. So basically if you want something off during the day just plug it into the right side. Keep in mind you can make this unit with just daytime or night time feature.