Hooking up a photosensor with control relay to Arduino?

Hey guys, I was wondering if it is possible to hook up this photosensor:

http://www.electronickits.com/kit/complete/ligh/ck1003.htm

to the Arduino so that the Arduino. What I want to do is hook this and a motor up to the Arduino so that when the Arduino detects no light (0 analog input), then I will set the motor to stop.

Thanks!

You would have to modify it as it is intended to be a self-contained device. It would probably be easier to start from scratch with the components.

A relay can only turn a motor on and off. If you get a motor driver board you could also control the speed.

…R

That will work, but that kit already has all the electronics in it, and already opens and closes a relay based on the light level. Thus, with something like that you could have it control a motor directly (or through another relay, if your motor is a beast), with no need for an Arduino.

It's also $13.

If you want to use an Arduino to react to light levels, you need a light sensor, not a larger device that has a light sensor in it. The usual choice, and what you had in mind, I think, is one of these - http://www.ebay.com/itm/311050784623 (these are available from many vendors) - you put it in series with a resistor, the middle (where they're connected) goes to the analog input pin of the Arduino, and the other ends go to ground and +5v (either way around will work, it just inverts the output).

If your entire project is just that, then the kit you linked makes a lot of sense (and has nothing to do with Arduino), but if you need more sophisticated logic, you'd want some sort of light sensor connected to an Arduino, and then a relay module ( http://www.ebay.com/sch/i.html?_nkw=relay+arduino ) to switch the motor.

Well, while I was typing, DrAzzy pretty much said everything I was going to say.

I'll just add a link to an example of using a simple photoresistor.

ShapeShifter:
Well, while I was typing, DrAzzy pretty much said everything I was going to say.

I'll just add a link to an example of using a simple photoresistor.

Okay, thanks for that! So I wouldn't even need an Arduino if I wanted to stop the motor with only the control relay right? How would I then hook up the control relay, motor, and power supply (in this case a 9V battery) to a switch so that when I flip the switch the motor and control relay turn on? Right now I have a wire soldered onto NC and another soldered onto COM. I am guessing that I would have to connect the positive terminal of the motor onto one side of the switch, but I am not so sure how to continue. Do you have any ideas?

Hopefully you know how to hook up the motor to be controlled by a manual switch? The circuit starts at the power supply positive, which goes to one switch terminal, then continues from the other switch terminal to one motor terminal, then from the other motor terminal to the power supply negative:
power+ --- switch --- motor --- power-

The relay acts just like a switch, except that it is controlled electrically. It also usually has three contacts, so when the power is applied to the relay, it turns one contact on, and the other off. The COM (common) contact is common to both modes. The NC (normally closed) contact is normally connected to the COM terminal, and opens when the relay is powered. The NO (normally open) contact is normally not connected, and gets connected to COM when the relay is powered.

  • relay off (normal position) COM and NC are connected, NO is open
  • relay on (powered position) COM and NO are connected, NC is open

So, what you do is replace the switch with the relay contacts, or add the relay in series. You always use the COM terminal for one connection, and whether you use the NC or NO contact for the other connection is dependent on whether you want the motor to run when the relay is active or idle.
power+ --- relay --- motor --- power-
Or
power+ --- switch --- relay --- motor --- power-