SparkFun Forums 

Where electronics enthusiasts find answers.

By cgull
#179735
I develop software for a living but have a hobby project at home that is crossing over to the hardware domain. My end goal is to have a circuit board fabricated but if I can do this with a breadboard in the meantime it would be fun to learn something. I'm a fish out of water so please go easy on me :oops:

Here's the logic I'm looking to implement:

I have a motion detector that is wired to a box that makes a sound when motion is detected. I would like to add a button that will temporarily disable the sound when the button is held down and 'n' seconds after the button is released. I would like the 'n' seconds to be adjustable (potentiometer maybe?).

The circuit would have 2 inputs (one for the button and one for the motion detector) and 1 output to the box that plays the sound.
By lyndon
#179770
1) Why do you need to have a circuit board made? Why can't it be on a protoboard?
2) It sounds like you don't need any circuit board at all in any case. Any of the Arduinos will be sufficient. Even a Trinket has enough I/O to handle this.
User avatar
By Ross Robotics
#179787
Along with what lyndon said, Sparkfun sells everything you would need.

I would get an Arduino pro mini or nano.
IR sensor for motion
A little speaker or buzzer
and a button or 2

With a small breadboard, this is doable. After you get it prototyped and working, you can make a custom PCB. I can design and assemble it, or you can post here with any questions you have if you wanted to learn. Sparkfun has many tutorials for Cadsoft's Eagle. That is the software of choice around here.
By Mee_n_Mac
#179790
What is making the sound ? What kind of signal does it need to enable and disable a sound ? Do you have a range for the value of n ? Do you have a particular motion detector in mind ? Is this to be battery powered or run off whatever powers the sound box or ??

Depending on the answers to the above you could do it with a simple micro or perhaps a 555 IC.
By cgull
#179802
I think doing this with a Pro Trinket (never heard of this before today) or Adruino pro/mini/nano is a great idea. I've been wanting to get in to Arduino for a while and this would give me a great excuse to get one. I will definitely get a couple accessories as you mentioned cod.

I'll put the order in tonight but I would still like to build this on a breadboard. I agree a PCB may be a little overkill lyndon. To get a sense of scale how many components are we talking roughly? I found the 555 IC in searches a couple days ago and figured it would be a central component. When I looked at all the diagrams however I quickly realized I was in over my head. Based on the number of components and difficulty I may want to try it out.

To answer the other questions (as best as I can):
1. A box wired to the PIR motion detector makes the sound. I recently wired up a trip beam in place of the PIR motion.
2. I have found the signal is triggered as soon as the trip beam outputs 28V DC
3. My desired time range to block the motion or trip beam signal from making it to the buzzer is 10 seconds to 1 minute. I'm flexible on the high end.
4. I actually am using a photo eye (I was using a motion detector): Optex AX-130TN
5. The motion and buzzer are powered separately via DC
By lyndon
#179807
Regular Trinket is fine, even the Pro version is overkill for this. If you consider the Trinket as a single component, that and perhaps a solid state relay would perhaps be the only components necessary. What's in the sound box? 28VDC is an unusual control signal, is it aviation related?
By cgull
#179840
The Trinket 5V is sold out so I got the Arduino R3 so I can learn on in the meantime. I figure if I get it working on the Uno R3 I can get it working on the Trinket.

I don't know what's in the sound box other than it plays a tone when the voltage spikes when the photo eye (or motion detector) is tripped. As for the voltage, it states 28V in the literature. I measured it a while back but will confirm.

EDIT: I went by RadioShack today...they were completely out of Arduino gear but I did pick up two 555 timer circuits. I'll wait to mess around with them until I experiment with the Uno R3/Trinket I guess.
By lyndon
#179861
The reason I suggested the Trinket is that they are so cheap and everything is already built. You only need to add the special software sauce.

The 555 will work just as well and there are tons of circuits online, but you will have to build something. Google "555 one shot timer"

That Optek detector is pretty damn expensive!!
By cgull
#179942
I got the Arduino Uno R3 and wired and programmed my simple delay logic! Definitely less of a learning curve than building it from scratch with a 555! I googled the one shot timer and will definitely use the schematics once I get all the components in!

The Optek photo eye is expensive but it appears to be well built. I'm trying to figure out how to hook the Alarm output to the Arduino but I'll post another question on here as it's OT for my original problem. The Optek claims a 28v alarm output (NC) but I don't see anything close to that with my multimeter. There's a post about it on the Raspberry Pi forum http://www.raspberrypi.org/forums/viewt ... 37&t=92475 but I'm having a hard time understanding it.

Once I get this all hooked up I'll move to something smaller like a Trinket so I can use the Uno for other projects :D
User avatar
By phalanx
#180024
cgull wrote:The Optek claims a 28v alarm output (NC) but I don't see anything close to that with my multimeter.
I dug up the installation manual for the AX-130 and it states that it is a "Non-voltage contact output" which means that it is a relay contact with no power connected to it. "N.C." means that it is normally closed contact. The 28V and 0.2A rating is the maximum voltage and current that can safely be switched with that particular relay.

In a non-alarm "closed" state (assuming it's using a traditional electromechanical relay), if you measure the continuity between the two alarm terminals, you will get a value close to zero ohms. In an alarm "open" state, your continuity should come back as infinite or out of range.

To detect the state of the alarm contact, you would wire one of the alarm terminals to an I/O pin on the arduino and the other alarm contact to the ground on the arduino. In software, you would activate the pull-up resistor for the I/O pin you have connected to the alarm contact. Electrically, when in a non-alarm "closed" state, the voltage coming from the I/O pin pull-up will be shorted to ground and you will read that as a "0" on the arduino. Conversely, when in the alarm "open" state, the voltage coming from the I/O pin will not be shorted to ground so you will read that as a "1" on the arduino.

I should note that the built-in pull-up resistors in microcontrollers tend to be fairly high in value (20K to 150K+ depending on controller). This could potentially be a problem due to electrical noise if your arduino and detector are a long distance apart. If this becomes the case, you can disable the built-in pull-up and add an external one with a lower resistance.

-Bill