This is a simple circuit (no Arduino involved) to operate a relay when a light beam is interrupted.

This instructable is a response to a question of "How without a processor?"

## Step 1:

What happens in this circuit is that light from the led shines on the photocell.  When that light is interrupted, the resistance of the photocell changes and the transistor is turned on, turning the relay on.

A contact from this relay causes an LED to illuminate.

## Step 2:

I know how difficult it can be to figure out which lead is which when comparing a "real device" to a schematic, so I am showing the transistor and LED here.

## Step 3:

There is a diode (looks backwards) by the relay coil.

Why does it need to be there?

The simple answer is:  to protect the transistor from overvoltage.

The longer answer:  Voltage (across a coil) equals L (inductance of the coil) multiplied by dI/dt (change in current divided by change in time).  For argument's sake, you can almost ignore the inductance and the current--turning off the relay happens very rapidly (dT), the time to switch off, is very small; maybe a few millionths of a second.  If the number in the denominator (change in time) is almost zero, the total answer will move toward infinity.

Physical constraints won't let it get too crazy, but a spike big enough to blow out electronics is quite likely.  The diode allows the current to flow backward through the coil, preventing damaging voltage.

## Step 4:

I put together a simple system with a prototype board to show how you can detect the movement of a model train, car or passing object.
Plz make it clear give neat circuit diagram
<p>My son and I made this to use in his science project. It was our first foray into building electronic circuits, reading circuit diagrams and using a breadboard. It was a great project to start with.</p>
Hello: <br> <br>What are the specs of the relay?
5 Volts dc, 40 ma<br> <br> <a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?search_type=jamecoall&catalogId=10001&freeText=139977&langId=-1&productId=139977&storeId=10001&ddkey=http:StoreCatalogDrillDownView" rel="nofollow">http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?search_type=jamecoall&amp;catalogId=10001&amp;freeText=139977&amp;langId=-1&amp;productId=139977&amp;storeId=10001&amp;ddkey=http:StoreCatalogDrillDownView</a><br>