How To Question: Illuminate LED on passover?

To all of those Electronic Guru’s out there, I have a “how to” question. How do I build an optical/electronic/magnetic/alien technology unit, that can power an LED light when a beam or signal is lined up?

I have a situation where I have a fixed base object, with an “arm” on it. The arm rotates in a 360 degree rotation. I need to know when it passes by or resides over, a specific spot.

An example would be a regular clock. I need to illuminate an LED when the big hand is placed over the 2:00 hour tick. See the attached picture as an example:

Notice I drew on there a Pink and Green Dot. These are the markers that I need to have the LED light up when they are over each other. So in the example of the picture, the LED light would not be on. yet, if it were 2:00PM, it would be on.

How do I do something like this?


Maybe a proximity detector unit? Like at, just use an led instead of a speaker or use the relay to control whatever.

I might use a ir emitter and detector, from radio shack for a couple bucks. Then put the detector through a comparator with an led on the output. You need to put the appropriate resistors and power supplies in.

If you’d like a quick diagram and resistor values and power supply values just ask.

The simplest thing I can think of is a reed switch and magnet combination. That’s what many door/window alarm sensors use. Put the magnet on the moving arm, and use the reed switch to close the circuit for whatever you want to power.

(My first impression was that you wanted to light up an indicator from 15 Nissan through 22 Nissan…)

I feel better now that I wasn’t the only one who misread it now :slight_smile:

You could use a photo voltaic cell on the spot that you want to know if the arm is over and a LED attached to the moving arm. When the arm moves over the photo cell it will create a current which you can use to power the LED that you want to turn on.

Whats the end application?

If the lighting around the object remains consistent, a photo resistor might work. It has the advantage of being excedingly cheap, if the environment allows for it.

As an aside, many ‘motion activated’ toys and novelties really just have a photo resistor. When you move by or wave you’re hand in front it will cast a shadow and set it off. They are surprisingly sensitive and rarely cause a false alarm. Slowly changing lighting does not set it off, only abrupt changes. The ‘range’ is entirely dependent on the lighting situation, as that changes the length of the shadow the objects would cast.

It’s fun working in a toy store when turning the lights off at the end of the day. The whole place starts squawking with every other toy thinking someone walked in front of it. It’s a little creepy the first few times.


Thanks for all of the replies!

I have looked at a few of the options presented here, and decided to try to use an Absolute encoder, coupled to a PIC and PCB which will illuminate the LED’s. Alternatively, I was thinking about using a cheap SBC which I can write the code for as well.

This is in theory, for I have no idea how to burn PIC chips, and make them work on a PCB. I am willing to learn though!

Ultimately, it needs to be cheap. And the Absolute encoder runs about 30.00, plus any costs for the PIC & PCB & any other parts that go on it.

With regards to the “end-usage”, I am trying to solve a problem with a robot we are building which will be used in police engagements. The robot is based off the MGAe Tarantula chassis, which has four “tank style” treads. The front and rear axles rotate in a 360o rotation thus rotating the two front or rear tank treads; in addition to the treads moving in a forward/reverse direction.

This vehicle is operated in a first person view, and the positioning of the rear “legs” or “treads” cannot be seen visually. I need a cheap solution to notify the driver of the leg positions.

This is the encoder I plan on using (with a gear on the shaft):

Since it outputs both PWM and Analog voltage, I was thinking I could program the PIC chip to “apply power” to a specific LED when the voltage or PWM is in a specific range (which is mapped to the 360o orientation of the legs).

Again, in theory. Would someone mind offering further assistance with the PIC setup? Or if you have another solution (cheaper, very reliable, compact, easy to implement); I would love to hear it.

Thanks again!

Instead of PICs (Leave it to me to be the one guy on a PIC loving forum who doesn’t like PICs) you might consider Atmel AVR 8-bit RISC chips. They’re very easily flashed and have a free open source C compiler based on the GNU GCC toolchain. If you go with a PIC anyway, google around for the No-Parts PIC Programmer circuit and software, but you’ll still need a compiler unless you want to learn to do this in assembly, which is doable, but not as easy as C. If you go the AVR route feel feel to PM me with any questions I’ll do my best to answer them.

I am more of the make it simple school. Digikey sells a variety of opto sensors that are meant to read a reflected light beam. They contain an LED and a phototransistor. A simple wiring job with a 5 volt-9 volt supply and two resistors should be able to sense the hour hand. Choose an opto sensor that will fit behind the face, drill a hole behind the face at the appropriate spot for sensing the position of the hour hand. The addition of some reflective tape on the back of the hand should be enough to trigger the sensor, then it is a simple matter to mount the sensor so that it just begins to read the position when the hand moves to the correct spot. A variable resistor in the photo transistor circuit will allow you to adjust the sensitivity so it only senses the hand and not ambient light. Use the switched output to trigger whatever device you want. (Sonalert, another LED, etc.)

these two statements are contradictory. Why would a robot used for important police work need (want?) to be made cheaply?!

I would think reliability would be the primary requirement.

or is this something they use for community relations or PR stuff?

I dont mean to criticize, I think maybe you need to rethink the What and Why of this design requirement. If its important then foremost it has to be reliable.

Cheaply made as in low cost, something doesn’t need to be expensive to be reliable, and something cheap isn’t automatically unreliable. There’s nothing wrong with trying to get more bang for the buck. I’m working with the poster on this project privately and I can assure you we’ve already made concessions for price versus performance, but still made sure the bottom line wasn’t a ludicrous cost.

There’s no reason to assume cheap = unreliable though, I’ve seen some ingeniously simply and low cost things do a much better job than some ridiculously expensive thing meant to do the same thing.

There is an even easier way. All you have to do is make a circuit with 2 small wires. As thin as u can the better, connect it to the housing on the big hand. The way clocks work is the big hand is on the outer axle, the minute hand is connected to an axle inside the big hand and the second hang is inside the minute hand. If u put a wire on the big hand and then put the other wire in a stationary place where the 2 wires would meet when its 2 o’clock you get a very easy circuit that is run by the mechanics of the clock.

I have to admit that the 16F series are hard to program in C(no free compilers) but for the 18F series you can just use the MPLAB with C18. Then you can use the RC code as a guide and even use Kevin Watson’s codes without too much modification.