My friend and I are workiimg on a project for our engineering course using an arduino uno.
Part of our project requires an alarm to go off when a wire is cut. We have some vague ideas regarding how to do this, but our level of expertise with arduino isn't that high. Any comments/help would be greatly appreciated.
The code that we have so far is attached below (it does not work correctly). So far what we are able to do is make the speaker that we have buzz (using code from faludi.com), but we cannot make the speaker stay silent until a wire attached to GND and some pin is cut.

Porject.ino (1.32 KB)
What ideas do you have to detect if a wire is cut? What is the difference between a cut and uncut wire, electrically?
but we cannot make the speaker stay silent until a wire attached to GND and some pin is cut.
I didn't look at your code, but I have a hint for you. If you enable the internal pull-up resistor (or if you use an external pull-up resistor), a digital input-pin will read high when nothing is connected. And of course, it will read low when grounded. Your code should be able to read the input state and then turn the buzzer on or off as required.
An arduino seems a bit overkill for this kind of project. All you would need is your buzzer, a transistor and some resistors.
HazardsMind:
All you would need is your buzzer, a transistor and some resistors.
That was my thought, too. Or use a relay instead of the transistors, if you aren't keen on electronic circuit design and can afford the current.
DVDdoug:
but we cannot make the speaker stay silent until a wire attached to GND and some pin is cut.
I didn't look at your code, but I have a hint for you. If you enable the internal pull-up resistor (or if you use an external pull-up resistor), a digital input-pin will read high when nothing is connected. And of course, it will read low when grounded. Your code should be able to read the input state and then turn the buzzer on or off as required.
this is a robust solution - i like it.
would you want to over engineer it to know where the wire is cut?
Will the professor accept an ATtiny85 as an arduino ?
Do what is done in emergency lights. Use a single pole double throw relay wired such that the alarm is connected on the normally closed side. when the relay is energized the alarm is off. When the relay is deenergized (wire cut), the alarm sounds.
can you clarify your request ?
if you charge a cap (output) then read the charge on the same line (input) can you tell that the cap is connected.
if there is no charge, then nothing is connected.
I under stand that sometimes the instructor requires you to use tools that may not be the best, but you have to use those tools. never could figure out why people cannot accept that the tools at hand are the ones needed for the project.
still not sure if you are looking for help with the speaker, the switch or what.
Why not just get a mount with a weighted base and a vertical wooden post or piece of wood with a hole drilled in it.
Put micro-switch on a small piece of wood mounted with a hinge to the switch makes contact with the post. Tie the wire on a similar post across the target zone and thread it through the hole in the other post and through a small hole in the piece of hinged wood and pull it tight and wrap it around a small nail that will bend with pressure mounted on the back of the wood so the micro-switch spring is pressed against the post. Clip the head off the nail. When the person trips on the wire it bends the nail will bend
and the wire will slide off the nail and through the hole releasing pressure on the spring opening the contacts that are wired to
a digital input pulled up with a 10 k resistor. The micro-switch has one contact wired to ground and the other to a 1k resistor connected to the same digital input. With pressure applied on the spring the contacts are made pulling the input LOW. When pressure is released , the connection to ground opens and the pullup resistor pulls the signal HIGH, indicating WIRE TRIPPED.
tripsensor= digitalRead(switch);
would you want to over engineer it to know where the wire is cut?
Thanks for throwing that out there Dave . Since it was your idea, go for it ! XD