Firstly, I am still new to electronics so please bare with me and sorry if my question is naive.
I am working on system that should be secured from destroying the project with intention by flowing over current to i/o pins exceeds the current the arduino needs which as much as I know it's 5v and 2mA through wires that goes to the arduino so in my situation what kind of protection and secure action I can take to prevent destroying arduino with intention that can even reach the 220v more or less and just limit it to the 5v. I don't mind even if I can break the circuit but don't destroy the arduino but also I don't want the solution to be expensive or else I would better buy another arduino instead XD .
Take the incoming signal to a MOV/TVS to ground, then a 10k resistor in series to a pair of shottky
diodes to gnd and 5V (reverse biased in normal operation). The MOV/TVS will catch high voltage
spikes (you should find one with a low triggering voltage, 10 to 20 volts).
The resistor and schottky diodes protect the Arduino input from excess current/voltage and bolster the on-chip
protection diodes (which are puny and designed for static protection only).
On its own the 10k resistor couldn't cope with very high voltages.
If you want to use a pin as an output the series resistor may get in the way - but you haven't said what
you are connecting to the pins.
...that can even reach the 220v more or less and just limit it to the 5v.
If you're talking about the power line, you should NEVER make a direct connection to the power line!* That means you need transformer or optical isolation.
Here's the issue - A protection circuit or voltage divider can bring the voltage between the Arduino's input and ground to 5V or less. But, a mis-wired AC connection with reversed neutral & hot wires will result in 220V on the Arduino's ground, relative to earth ground (with 215V on the Arduino's I/O pin). That's "safe" for the Arduino, as long as the Arduino's ground remains isolated from power-line ground or earth ground... But, it's not safe for you and it's not safe for the computer or the Arduino if you connect the computer's USB port to the Arduino, etc.
There a lot of ways to get the AC hot & neutral crisscrossed... Sometimes an AC outlet in the house is mis-wired. Some extension cords are "non-polarized" or mis-wired, or you could make a mistake... In general, you cannot sell a product that's not isolated/insulated from the power line. (You may not be selling your product/project, but I'm sure you want it to be safe.)
It can be done if the entire project is isolated in an enclosure with no electrical connections to the outside world... For example you could make a power-line voltage monitor with an LCD or LED voltage display that needs no other connections. However, it's difficult to develop & debug such a project without access to dangerous voltages.
Do you need protection from over-current or over-voltage? Your topic says over-current but your post says over-voltage.
Components like Fuses and Circuit breakers are used to get protection from over current and components like Varistors and Zener Diodes are used to get protection from over-voltage.
Sorry, maybe my post was a bit not clear enough and probably confusing but as I mentioned I am really new in electronics world and uino but what I am doing is I try to connect a door switch to the uino but as I need to be 100 percent secure that the uino won't be destroyed if someone intentionally cut wires of the switch and insert it in 220v electric outlet for sake to destroy the project and stop it and I am trying to find a way to prevent that from happening. So is there a way to do this?
need to be 100 percent secure that the uino won't be destroyed if someone intentionally cut wires of the switch and insert it in 220v electric outlet for sake to destroy the project and stop it and I am trying to find a way to prevent that from happening
Their is no way to prevent everything from being damaged, the best you can do is to minimise what gets damaged. I would use an opto isolator to protect the Arduino but if some one did that then the opto isolator would fry. Is this a thing that is likely to happen?
Yes I would sacrifice with an isolator than the uino of course and that's what I wanted :). Sorry maybe i wasn't that clear but by the project I meant the uino not an isolator. But is there a special way to connect the isolator to the switch wires and uino or just through the wires (inbetween)?
Thanks again guys and appreciate your support a lot.
But is there a special way to connect the isolator to the switch wires and uino or just through the wires (inbetween)?
The input to an opto isolator is basically just an LED. So you need to drive it like you drive an LED, that is with a voltage and series resistor. This means having a separate voltage source on the push button side. However, just two AA batteries will last you until the batteries leak. This is because the time it is driving the LED is very small in comparison with how long it is not pushed.
@ grumpy_mike can you please show me a scheme to how to use the opt-isolator with door switch and uino and how to mount it in between with resistors if u don't mind?
Grumpy your awesome man. Thanks a lot but I guess there is misunderstanding what I meant was door magnetic switch not button switch. Does it works the same way?
@off-topic Btw did you used to support in another forum's than here? Cuz your name ring bells here?
I have few questions running through my head if u don't mind asking them.
Paul__B:
Exactly the same way. But!
Mike's answer was for a manually operated, normally open switch.
If the switch is going to be closed (with the magnet) most of the time, it will be useless as the battery will quickly go flat.
1st I got such suggestion from paul but donno what is solution if this is the case?
2nd won't it be dangerous is someone cut the wires between the reed switch and the opt and inserted it into electric outlet or any power outlet with high voltage and current while there is battery in between which might cause explosion?? I don't mind the opt to melt or get fried or damaged but I care about the uino and of course the place and I don't want any harm to either of those?
3rd is it better to roll around the opt and thr wires connecting to it an electric isolator tape to protect the surroundings incase it got fried or any bad case scenarios happened or it might cause problems in the long run?
4th is it better to wire the wires directly to the opt or I can use breadboard?
I have feelings that it would be safer to do it directly for some reason than on breadboard in case of high current and voltage
5th i am using 9v battery cuz AA battery holder wasn't available in the nearest elec. Shop so how i can calculate resistance needed for the opt when using the 9v battery?
Thanks a lot and really appreciate your support especially grumpy_mike, paul_B and of course the rest as well and apologies for long post
If the switch is going to be closed (with the magnet) most of the time, it will be useless as the battery will quickly go flat.
If the magnet is going to be in contact all the time you would use a normally closed switch, this will open when the magnet is removed. In fact I used an identical arrangement to turn off a Drum I designed for autistic kids. When a magnet is removed the drum turns on, when the drum is put away the teacher places a magnet on a specific indentation in the drum to turn it off.
won't it be dangerous is someone cut the wires between the reed switch and the opt and inserted it into electric outlet or any power outlet with high voltage and current while there is battery in between which might cause explosion??
Yes that could happen but we are talking about isolating the Arduino here. It could be equally as dangerous if someone doused your front door with gasoline and set fire to it. That is much more likely than your high tech bandits rewiring things. So far you haven't given us any justification as to why you think this is even a remote possibility.
3rd is it better to roll around the opt and thr wires connecting to it an electric isolator tape to protect the surroundings incase it got fried or any bad case scenarios happened or it might cause problems in the long run?
Things like tape will compromise the isolation properties of the opto switch - avoid it.
4th is it better to wire the wires directly to the opt or I can use breadboard?
For any circuit you want to last longer than a day or two you can not use solderless bread board.
5th i am using 9v battery cuz AA battery holder wasn't available in the nearest elec. Shop so how i can calculate resistance needed for the opt when using the 9v battery?
Replace the 5V with 9V in your calculations:-
resistor = (9V - (LED's forward voltage drop))/ required current
Note encasing a system in epoxy potting compound is a good way to vandal proof most things.
Yes that could happen but we are talking about isolating the Arduino here. It could be equally as dangerous if someone doused your front door with gasoline and set fire to it. That is much more likely than your high tech bandits rewiring things. So far you haven't given us any justification as to why you think this is even a remote possibility.
So it's not still safe to do the opt as if someone inserted the wires connected from magnet reed to opt to main outlet it will lead to the battery explosion and maybe other losses from the surroundings which is not what I want.
I really began to give up lol. Seems I am seeking something hard to be done or impossible. I really care about the uino not to be harmed as well as the place of course and I want some cheap solution that won't cost more than the uino itself but idk it's seems bit complicated to achieve such thing.
@Grumpy_mike trust me I know this scenario that amaze you can happen and it's the first and most easy to think about way to destroy the project and feel safe
Anyways I am still waiting more suggestions if anyone have any.
Look for an introductory lesson on fuses. Fuses protect wires from accidents and idiots. Sometimes you let the wire itself be the fuse: any significant fault current will melt the wire and make it stop conducting.
I second the "armoured cable" idea. If the wire is run through the wall or ceiling, it would take an extremely talented fool to pull the wire out and drag it over to a mains outlet.
Who was it that said "Sufficiently advanced stupidity is indistinguishable from malice"?