hello . Fist of all my name is Tomas and i work on computer`s hardware and software but never used an arduino before.
Im trying use arduino for implement a kind of alarm or anti theft system.
explanation: i have some honeybee hives on the ground and i want protect them from being stolen. the goal is connect a cable by plugs between each (normaly closed circuit) and then connect the cable to arduino. if some hive is moved or stolen,cable will disconnect or cutted and alarm will be triggered .
then arduino will play a loud buzzer(i think about that later) AND close an automatic gate (solenoid triggered by 5v relay connected to arduino) . like in a museum. The door is open but if you steal anything ,alarm is triggered and doors are closed
my main problem is how to do that closed circuit?. because if i follow this example(http://arduino.cc/en/Tutorial/Button#.UyyUBIUQdic) but without that switch, i can connect the vdd(5v) to pin 2 and use a pull-down resistor to gnd,but that dont appear very safe and i think i can kill my arduino on a short circuit between vdd and pin 2.?
what you tink about that? any better solution? and i`m sorry about inglish-ingrish its not my home language
If you define one of the Arduino pins for input with an internal pullup your external circuit can hold it low indefinitely. No external resistor is required.
The gate and the alarm could be handled directly from the switch without involving the Arduino. You could also consider something like this Wansview NC541W Wireless IP Camera, which can be triggered by an external input (your external switch), and can also perform video motion detection, and can send alarm notifications including captured images taken when the alarm occurred. I think it can also trigger an external circuit when the alarm occurs, which you might be able to use to activate your sounder etc.
If you're proposing to close gates etc to stop would-be thieves from leaving, you might want to check whether that's legal in your jurisdiction. Here in the UK I think it would leave you open to charges of false imprisonment, and you could also be liable if your alarm injures anyone e.g. by dropping a gate on them.
I forgot to mention something. I will feed the arduino on 12v lead-acid 7amp and i will setup a gsm shield for send an sms when alarm is triggered and sleep rest of time . So must be something like an arduino. I can't use a ip camera or a domestic alarm,they consume a lot of power.
and i need maintain it cheap. it will be used on hills .The only communication its gsm and 12 battery. (i will need do some diy work for keep this arduino working for moths on same battery)
about the law...I prefer think ..bad is steal other's stuff ... that kind of gate is just to avoid a trunk leave so easy .. its just psicologic ,because there are no wall.
So i think i can use the internal resistance or an 100ohm on pin 2 to maintain it safe like robin said.
Beehives are not kept in a shed with a shutter door, so locking the swinging gate cannot be "false imprisonment" even if that ever mattered.
A series loop circuit is fine. Here we go again with the common and most annoying problem with the Arduino information repository. While it may seem a "nice idea" to make it easy for rank beginners to understand the logic where switches pull up to the supply voltage and have a pull-down resistor to ground, this is as Thomas automatically discerns, the worst form of engineering practice as it exposes the supply line to external influences risking system failure or deliberate disabling. The critical word is "fail safe".
So yes, the loop should be referenced to ground, with a pull-up resistor to the supply voltage.
But that's not all! because you are connecting a "long wire" antenna to the system and risking induction from lightning strikes, you need even more protection; a series resistor of say, 2k, between the pull-up resistor and the Arduino input with a 0.1µF capacitor and a 5.1V Zener each from that input to ground. Won't of course guard against direct lightning strikes but - oh well ...
Now, what else might we want to consider? Well, there's tamper-proofing - what happens if the thief is cunning and spots the wiring and bridges it, possibly with a clip-lead (very professional thief!)? So, you put in each unit, a 47 ohm resistor. Ten in series makes 470 ohms, and if you use a 2k2 pull-up to 5V (though with the previously described protection, it could be pulled up to the 12V instead and use a 4k7 pull-up) then the line voltage will be about 1V and shorting one sentinel resistor will cause a 0.1V drop detectable by using an analog input.
Now that resistor chain will draw 1 mA which is quite modest as the working Arduino will draw a little more anyway. If there was any likelihood of leakage current such as by using other than insulated wire then you would need lower resistances in the loop. Pretty obviously for long-term operation this needs to be solar-powered.
I will keep it just like an simple loop,without tampering system. It will work like that signs saying : protected by alarm. , they are better that alarm itself against intruders:P
So you say; make wire loop connecting, for example pin 2 to the ground and then use a 10k resistor to connect +5V? and should i use any resistor to protect ground?like 100ohms? in case input change to output and burn everiting...
Please re-read carefully what I explained about the components protecting the input pin. These apply whether or not you wish to implement the tamper-proofing. I am not in a position to provide artwork just now ...
If you don't want to use an existing IP camera and just want to have a switch trigger an SMS, you could use the switch to pull down the base of a transistor which controls power to the Arduino, with a pull-up resistor so that the transistor powers the Arduino when the switch opens. Then write some code on the Arduino which sends an SMS when it is powered up.
Now that resistor chain will draw 1 mA which is quite modest as the working Arduino will draw a little more anyway. If there was any likelihood of leakage current such as by using other than insulated wire then you would need lower resistances in the loop. Pretty obviously for long-term operation this needs to be solar-powered.
will draw 10mA second my ohm law:P but that not the problem. the problem is the chain will have more than 30 "modules em chain(30 wood hives)" so will be a very big chain... lot of resistances will be necessary and a lot os consumed power ...and for my work, it would be simplified as possible. if I need remove one "module "and put other new , i just want connect 2 banana plugs for close loop and ready to go.
what i can do, it use one resistor on the end of chain(like 100ohm),or on the far away "module" for always have an fixed resistor, if in the middle there are a shortcircuit, arduino probably detects. but i don't know exactly how to setup that on arduino and how sensible analog in are to detect that and don't detect a simple increase of resistance on loop by the oxidation from plugs with pass time, for example.
about whether .. i will just cover cables a bit , there are no ground connection (to soil)so its easier i will euromilhoes that the cable be hit by lightning .. and much less on my country where this kind of whether only happens 1 or 2 times per year.
One more question about Arduinos ans atmegas. there are any model of this chip,that can consume less ,for long battery life? because if i use a lead acid battery ...i want make it last months ..