Need help with circuits and photocell

I need help building a project but know nothing about circuitry and photocell. I thought I’d ask you professionals.

I want to take a photocell light sensor and attach it to a small motor (1" diameter motor) and battery.

Here is the link

What I want to happen is, when the light is on the photocell sensor, the motor will come on and spin left (counter clockwise) “x” amount of times, the quit. Then, when it is dark on the photocell sensor, the motor will spin clockwise “x” amount of times and stop.

I realize there has to be some kind of silicon circuit board in there to tell the motor what to do. On the same link mentioned above, there is a picture of a silicon board the size of a quarter, is it possible to have a board that size to do what want mentioned above?
Do you recommend someone or a company to help with this project? I would Gladly compensate for the job.

Any help, advice is greatly appreciated.
Any additional questions, please ask.

Thank you.

What you are asking for is not a simple circuit. You need something that is programmable, capable of taking sensor input, using it for a program that controls a motor driver of some type. Lego Mindstorms is just such a product. This controller is capable of several sensor inputs and several motor outputs. It is easily programmed via supplied language with the kit. Unfortunately, it is designed for special motors that are also supplied in the kit. Actually, some of the motors also contain tachometer sensors that allow you to actually count rotations and use that to feedback into the program.

There are ways to do this without a microcontroller, but it honestly is probably easier to use one. Quick question: does the “x” number of times have to be a very accurate and consistent number?

You may look into using something like a PICAXE 08M2 or 14M2 microcontroller to read a CdS (LDR), and some transistors to drive the motor.

This isn’t too difficult really.

Also, does it have to be THAT motor, or can it be a continuous rotation servo? If the latter, this is a piece o cake.

I spent sometime reviewing the Lego Mindstorms but I found myself to be more lost than before I started.

I really don’t know what a micro controller is. What I’m building has to be contained by itself and operate via photocell. Rechargeable batteries to run the system. Similar to the outdoor lights you hang. They come on when it’s dark and turn off when the sun comes up.
I dont know much about a servo but if it’s small, it’ll work. The “x” should be somewhat consistent in operating.

Gentlmen, is there someone or a company that you recommend who could build this prototype?
Thank you,

Your description of the desired behavior is incomplete.

What do you want it to do if the light is removed from the sensor while the motor is spinning CCW? Stop immediately and spin CW? Or finish the CCW spinning and then spin CW? Or ignore any changes that occur while the motor is spinning?

Do you want the circuitry to require a persistence of the sensor state before action is taken? In other words, if the light on the sensor is removed for 1 millisecond do you want the motor to start spinning CW? Or do you want the circuit to ignore momentary changes like that?

What is the operating voltage you will be providing to the motor, and what is the current draw?

Are you going to make one of these, or 10 million?

How big can the controlling device be? Is there a size or weight limit? Can it be supplied with 120vAC power?


We approach these problems with a little more precision. So we need to know the amount of precision you need. A simple circuit can be developed that will spin the motor in one direction when lit and then spin in the other direction when dark. However, the length of time it will spin (or the number of rotations that it will make) will not be controlled and therefore will not be repeatable from one trigger to the next. The size (output power) of the motor also will determine the complexity of the circuit to some extent. If you are merely turning a small hobby motor like a slot car might have, then a simple circuit may be made using a dual 555 timer, some resistors and capacitors, and two miniature relays in addition to the photocells you have shown. Again, this circuit would very likely vary widely in the action of the motor.

Yea I second (or should i say third) what the others have said. While only a10th grader (although the team captain/programmer/electronics) I am familiar with this, in terms of FRC and programming while no expierence with circut boards.

-From a programmable board (microcontroller- “is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.” perserpective, this would be relatively simple asumming you know some basic programming. This method could be accomplished using a cRIO or as I’ve been looking into recently a Arduino board.

-Now the part that I am not familiar with: Using only a circut board (breadboard). But what I do no is that in my school’s physics class they commonly have to make something that will run off a timer using just circuts.

Hope this defines your 2 most basic options which each branch off on their own.

I do apologize for the delay. I had to make sure I was Patented before letting out too much information.

What I am creating is a stand alone solar power yard light that is recessed into the ground when the sun is out. Once it is dark out, the light will raise up and aluminate. Similar to a pop up sprinkler.

Now I’m looking for a prototype builder or someone to guide me. Who’s up for the challenge?

Or you can just buy one of these.

For that application, you don’t really need to turn the motor a definite number of rotations. You can either choose a motor that can withstand being stalled for a few seconds and drive it for a long enough time that your mechanism will reach a hard limit, or you can use a sensor that detects when the mechanism is fully retracted or fully extended to let the motor run only as long as it needs to.

There are also a couple of nifty mechanical tricks you can use to let the motor keep driving for a while without stalling, like using a lead screw with unthreaded ends and a spring-loaded stage that will be certain to reacquire the threads when the screw turns the other direction.

First post here. I wonder what happened with the OP?

I want to do something similar.

Could you use dpdt relay (or an H bridge) for this?

Using a dpdt relay wired so that it is NC for one direction and the motor would move a screw and then stop when it hits a limit switch - at night time. Then using a photo resistor and a transistor to get the motor to move in opposite direction when the photo resistor has low resistance during the day and then stop when it hits a limit switch.

I think that would work, but (and what I don’t understand) after the motor moves during the day and stops would it stay there during the day because the coil would stay energized because of the photo resistor until night when the relay goes back to the NC position? I don’t think it would be good if the coils stayed energized during the day and constantly draw current especially if using batteries?

Or would it automatically move back into the night position because the relay is wired NC, and then this would keep repeating back and forth constantly during the daytime?

Of course the objective would be to move one direction at night and stop at a limit switch then move a different direction during the day and stop at a limit switch and then repeat daily.

I can’t quite figure this out and if it would be the best way to proceed for something like this?

Any help you could give me would be Greatly Appreciated…I’m stumped!


You could do it with a pair of relays.

Motor leads go to the common terminal, the NC terminal goes to ground and the NO terminal goes to B+. You would put the limit switches in the circuit powering the coil using the Common and NC terminals.

If power is applied to the forward relay’s coil then that coil will supply power until the limit switch opens the coil circuit. That coil will be de-energized and that motor lead will return to ground ready for the motor to be reversed.

Then when power is applied to the reverse relay’s coil that motor lead will get connected to B+ until the limit switch opens the coil circuit. That lead will return to ground and the system will be reset to go in the forward direction.

You will probably need a pair of transistors to supply adequate current and voltage to power the relay’s coils. How you would do that is pushing the limits of my electronics knowledge. Hopefully someone else can chime in with the appropriate transistors, photo cell and photo resistor to make that work.

You could use a Arduino or Raspberry PI to use a single photo resistor or photo cell to control the relays and then you could also wire the limit switches to it.

Thanks Mr. V for your post.

Is there a reason to use two relays instead of just one dpdt relay?

I think the part I’m struggling with is how to keep the motor still during the day after stopping at a limit switch. I don’t want the motor to reverse until night time.

Somehow using the low resistance of the photocell during the day to keep this from happening?

A DPDT relay would allow you to reverse the motor but it wouldn’t allow you to shut if off without including more components to control that.

By using two separate relays you can use limit switches to shut off the motor when the end of travel is reached and simultaneously reset it so it is ready to be turned on in the other direction. Using a pair of relays with the common terminal connected to the motor leads, the NC terminal connected to ground and the NO terminal connected to B+ is the way that a number of automobile manufactures wire their door lock motors.

Unfortunately that would also mean that you would need two photo resistors, one to activate the “forward” or “up” relay and one to activate the “reverse” or “down” relay.

Here is a little information on how to use a photo resistor in a voltage divider circuit to cause the output voltage to either increase as the light increases or increase as the light decreases.

You would need to select the proper resistors to create a “dead band” to prevent the system from trying to activate the “forward” and “reverse” relays at the same time or to fluctuate between the two states.

Page 3 of this document shows a circuit using a photo resistor in a voltage divider circuit to drive a transistor which switches a LED on and off based on the amount of light. Replace the LED with the relay coil and the resistor with the limit switch wired to the NC and common terminals and you have the circuit that would activate the motor in a desired direction when the light is bright enough and then shut off the motor when the limit switch is activated.

By swapping the position of the photoresistor and standard resistor in the voltage divider circuit it would activate the relay when the light dims enough.

You need to select a transistor that can handle the current and voltage needed to activate the coil of the chosen relay.

Thanks Mr. V

I had thought about the 2 photocells but was trying to stay away from going that route.

And thanks for the links they were helpful.

I’ll try to wire something up and post what happens.

Glad to be of help. Considering how cheap photocells are (5 pack for $3.99 at Radio Shack) it won’t add that much to the cost of the project, relatively speaking.

Please do share what you come up with.