SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By jesperhs

I have a Sparkfun mp3 trigger v.2 working with a SHARP
GP2Y0D340K distance sensor.

At the moment the mp3 file is triggered when someone gets close to the sensor.

My problem is that I would like to invert this: A sensor is at all times blocked by a window. When someone opens the window the mp3 files starts playing.

I only have the sensor and the mp3 trigger. I don't have time to build anything new or use a different sensor whereas I'm stuck at a museum with a deadline tomorrow.

If you can help me I hope for a quick reply!

- Jesper
By esklar81

I'm going to ignore your statement "I don't have time to build anything new or use a different sensor whereas I'm stuck at a museum with a deadline tomorrow.", as it is contrary to your declared purpose. There are some very knowledgeable and talented people in this forum, but I doubt any of us can change the behavior of electronic apparatus by sheer force of will.

(BTW, I recommend you read this guide, a link to which our moderator posted in another thread.)

I'm a bit limitted because you haven't specified which way the window moves or how someone opens it, so I can't get a good mental picture. That said, here are several ideas you might try:
  1. Instead of using that sensor, use a switch that detects when the window is moved to its open position.
  2. Move the sensor so that it detects the window in its open position.
  3. Move the sensor so that it detects a person's hand on the window handle (if this works like an old-fashioned car window with a crank handle, for example).
  4. Change the position, orientation, or angle of view of the sensor so that the window keeps it from sensing a person. It may, for example, be possible to have such a shallow angle between the sensor's line of sight and the window that the window deflects enough of the IR beam to keep the sensor from detecting a person.
  5. There is mention in the datasheet of the lens being moved to adjust the sensor, but I didn't see instructions for that. You might, however, do a bit of web searching on that topic.
  6. Coat the window with an IR-dispersive or IR-opaque film, so that it does not allow enough reflection through it for the sensor to detect a person. That way, a person would be sensed only if the window is removed from the path.

Good Luck,