Read this information - it could save your life!
Mains voltage electricity is extremely dangerous. There is a significant risk of death through electrocution if mains voltage electricity is allowed to pass through the body. There can also be a risk of fire and explosion if electricity is not cabled and fused correctly. Therefore precautions must be taken when using mains electricity or similar.
There is a lot that can go wrong with electricity with potentially dire consequences. Some of these are obvious - NEVER use your finger to test for the presence of a mains voltage! - but others may not be such as heat-sinks that are connected to the high voltage connector of a triac. Read this page in full and ensure you think about all the aspects when designing your next circuit. If in any doubt seek out the advise of a qualified person.
This section gives advice relating to domestic mains electricity and lower voltages. Higher voltages such as electrical substations and railway gantries are much more dangerous. Never approach any high-voltage cables or anyone having suffered a shock from a very high voltage unless you have confirmation that the supply is disconnected.
The most obvious risk from electricity is electrocution through contact with a live circuit. This is where an electrical current flows through the body which can result in the heart stopping to work (cardiac arrest).
It's actually the current that is important rather than the voltage, but due to the resistance of the body you can't get a dangerous current without there being sufficiently high voltage. You can work this out yourself using ohms law, but the important thing as far as this is concerned is to remember the safety principles. Generally you are relatively safe dealing with voltages of less than 50V, but anything above that can be dangerous.
You are generally safe from electrocution on most electronic circuits that run off domestic batteries, including 12v car batteries. There may however be batteries in your home that can pose a real danger, such as the output from a UPS (uninterruptible power supply) for a computer, or if you have a home energy system such as solar panels.
Even if you equipment is designed to run at less than the dangerous voltage for electrocution it may still pose a risk of burns, fire or even explosion - so keep reading.
You may have heard some people say that AC is more dangerous than DC power. Rather than get into too much debate over one vs. the other both AC and DC at high voltages can be lethal. AC is considered to be more likely to cause cardiac arrest by interrupting with the electrical signals controlling the heart, but DC can cause burns and both can still kill so debating the differences is pretty academic. Just remember electricity can kill if it has sufficient voltage and current whether it's AC or DC.
The following are ways to reduce the risk of an electrical shock.
The safest way is to completely avoid using mains voltage in a computer circuit. Most electronic circuits work on low voltages and can be powered by batteries or an external plug-in transformer. The safest way to use a transformer is to use a power-brick (such as the power adapters normally used with laptop computers) or a plug transformer (known as a wall wart in the US) such as those used to power your mobile phone. These will convert the voltage down to a safe voltage that the electronic circuit will work at (eg. 6v to 12v for the Arduino) and in most cases also convert the signal from AC (as supplied from a mains socket) to DC (used for most electronic circuits). These transformers will usually be double-insulated and have no high-voltage parts that are accessible by a user. Make sure that the transformer is suitable for the type of circuit (eg. voltage and current rating) and for the power supply it is being plugged into.
You should still check for any physical damage to the transformer as you should prior to plugging anything into mains electricity.
If you need high power then an external power supply may not always be an option in which case extra care should be taken.
If you've ever seen equipment that says "high-voltage do not remove cover", or "disconnect mains supply before removing cover" then there is a risk that there are unprotected mains voltages inside. If you have removed a cover from a mains electrical device where possible that cover should be fixed back into place before connecting back to the mains.
If you do use mains voltage in a project then you should normally use a metal case and earth the case. This is done by taking a wire from the earth terminal and connecting this to an exposed metal part of the case. Sometimes there is a special connector in the case for connecting the earth, but if not then it can be connected to a metal screw holding the parts of the case together. You should then perform appropriate testing to make sure that all the metal / parts of the case is properly earthed.
A risk with mains voltage is that a live connection (eg. a loose wire) comes into contact with a metal case and then someone touches the case creating a path for the current to go through the person to earth. If this happens then it can pose a risk to any user of the equipment. If the case is earthed then if a live wire comes into contact with the case this will provide a direct route to earth and blow the fuse for the equipment. If you find that your fuse keeps blowing then check for a short circuit to the case. If using a mains connector to bring the electricity into the case then a 3-pin connector will need to be used such as an IEC C13 connector (2-pin connectors do not have earth and are therefore not suitable). Always use an appropriate sized fuse to the equipment (eg. in the plug) to ensure that if there is a connection to earth that the fuse blows. The fuse can be within the plug (standard in UK domestic plugs) or a combined connector and fuse module can be used.
An alternative to using a metal case is to use a plastic insulated case, however if you do you need to ensure that there are no metal connections that are not earthed that go from the inside to the outside of the case that could come into contact with the mains voltage. This includes any switches, or any screws used to hold the circuit board in place and any external connectors. This is difficult to achieve in DIY projects which is why I recommend use an earthed metal case. On commercially made electrical equipment you can often see the double-insulated symbol to signify that full insulation is used rather than earthing.
When using mains voltage you also need to ensure that it is not possible to come into contact with any high voltage parts by entering through the case. This is best achieved by ensuring that there are no holes in the case, but sometimes it is necessary to include holes in the case for ventilation purposes. In this case the finger test should be used to ensure that it is not possible for a finger placed into the hole to come into contact with any mains electricity. Obviously if you are actually testing this you should do this with the electricity disconnected. Also consider that some people (especially children) will have smaller fingers.
Before you connect any equipment to the mains voltage always check that the equipment is not visibly damaged and that leads are not damaged. This applies to any electrical equipment whether home made or bought as cables can deteriorate over time especially if the are not stored properly.
If you are performing any tests on live equipment (avoid where possible) then ensure that you have properly insulated test leads with sufficient insulation for the voltage under test. You should always perform a risk asessment before working on live equipment and ensure suitable precautions are taken to prevent injury arising from any risks identified.
With electrical appliances and home made projects it is usually fairly easy to disconnect the power by removing the plug. In the case of home wiring and equipment connected directly to the mains such as burglar alarms the mains electricity may be connected directly into the equipment. Where this is the case there will normally be a switch or fuse panel on the wall where this connects and the electricity should be isolated from there.
Whenever you are working on equipment wired directly into the mains that is to be unpowered always check to ensure that the mains supply is disconnected before working. For the home user a domestic voltage detector can be used, but it is recommended that these are only used as a secondary test after other steps to isolate the supply have already been performed. Always ensure the tester is is not damaged and in good working order and follow the manufacturers instructions. If in any doubt as to whether a supply is isolated the you should get professional advice. If you are undertaking this as part of your employment then you must follow the HSE guidance rather than the above - see Electrical Safety at Work and Electrical Test equipment for use by electricians.
The most common type of domestic electrical tester is in the shape of a screwdriver with a neon inside the handle. You place the tip of the screwdriver on the contact you want to test and touch a metal plate at the other end of the screwdriver. If the tester is in contact with a mains voltage then the neon lights up. Always check that the tester is undamaged beforehand. Do not use these as a screwdriver.
Another type of domestic electrical tester looks like a large plastic pencil with a white tip. When you place the tip near to a mains voltage then the tip lights up red. This is in better as you do not need to make any direct physical contact with mains electricity, but there is a downside. The pencil is battery powered and if the battery is flat there is nothing to indicate that there is any mains voltage present. Therefore before using a battery operated mains tester check it against a known live source to see if it working correctly. You can do this by placing the tester against the right-hand side of the outside of a mains plug when connected to the supply. There is no need to open the plug or expose any live parts to conduct this test.
This guidance is for home / hobby activities only. These testers should be used after making all efforts to isolate the power. These testers are not suitable for use in a work environment - see HSE guidance - Electrical Test equipment for use by electricians.
RCDs (Residual Current Devices) and can provide an element of protection against electrical shocks by disconnecting the supply if it detects a fault or if someone is having an electrical shock. RCDs are now included in domestic house wirings in the UK, but many houses were built before this regulation came into force.
These are sometimes referred to as RCCBs (Residual Current Circuit Breakers) or ELCBs (Earth Leakage Circuit Breakers).
You can also buy plug-in RCD adapters. You plug these into the mains socket and then plug your mains powered equipment into the adapter, or you can get ones that replace the plug on your equipment. If you have your own lab / shed / home office that you use for your electrical work then it can be a good idea to use these on all the sockets in that room but at a minimum I'd recommend using one whenever you first connect your circuit to the mains or when performing any live testing.
If working on mains voltage you should have someone nearby that knows what you are doing so that they can assist if anyone does go wrong. At the very least they can disconnect the mains supply and dial 999 (112 in Europe / 911 in the US / 000 in Australia) for an ambulance. I also recommend that you and your buddy both learn first aid. See the training page on the First Aid Quiz web site for contact details for first aid training organisations.
If you ever come across anyone that is suffering from an electrical shock and are still connected to the supply then do not touch them directly as you can also receive a shock from them. Where possible you should disconnect the electrical supply (un-plug or switch off the equipment). If it is not possible to disconnect the supply then push the person away from the supply using an insulating material such as a dry wooden or plastic broom handle.
We've covered the obvious things above, but you also need to take into consideration any components that may carry mains electricity and any specific safety features. For example a triac is a device often used to switch mains electrical currents. As with any semi-conductor these devices generate heat and when switching large loads this can result in a lot of heat. To dissipate this heat and prevent the triac from overheating then a heatsink is frequently used. The case of the triac connects to the heatsink. There are some triacs where the heat-sink connection is connected to one of the mains terminals and others where there connection is insulated from the mains voltage. A common triac is the BTA08-600 triac where the heat-sink connection is insulated from the mains voltage, but the BTB08-600 which is almost identical is not insulated. You may wonder why bother with the non-insulated version, but the thermal characteristics for the non-insulated is much better hence requiring a smaller heat-sink. For hobby electronics I recommend always getting the insulated ones (which are more readily available anyway) so that the heat-sink is never live. I even use the insulated triacs on low voltage circuits as it reduces the risk that you may re-use the left-over triac in your next project which may use mains voltages.
If you ever find yourself working on equipment designed by someone else never assume that they are using insulated components and always assume any component could be live until proved otherwise.
Portable appliance testing is a way of testing electrical equipment to ensure it is safe to use. It involves a physical check for visible damage as well as some tests to ensure equipment is properly earthed and insulated. This is done using either a special PAT tester or using an insulation tester. Unfortunately the cost of PAT testing equipment makes this very difficult for the electronic hobbyist to perform testing themselves, but you may be able to get a local electrician that is able to test the equipment for you.
Electrocution is not the only way that you can be harmed through using electricity incorrectly. Fire can be just as big a risk and can happen at much lower voltages than electrocution. Again this is a high risk with mains electricity, but you should also take this into consideration when working with lower voltage systems such as car or leisure batteries or low voltage lighting all of which are capable of providing very high currents. Fire can be caused by overheating due to overloading a plug socket, or if too high a current going through a particular component or wire.
An important step towards protecting against fire is to ensure that the correct fuse size is used. In home made projects then the fuse should be selected that is above, but as close as possible to the maximum current that the circuit will draw.
The other factor under the control of the circuit designer is to ensure that all components and cables are rated within above the maximum current draw for the circuit. This should not be an issue for the low current signals within a typical circuit, but is something that needs to be considered when switching large loads such as lights and motors etc.
Also ensure that any items that get hot are kept away from flammable materials. One example is to ensure that light fittings do not come into direct contact with curtains which can sometimes get blown by a draught through an open window.
There is obviously a risk of burns whilst soldering, but there is also a risk if a component is touched after it gets hot. Light fittings are well known for their heat, but other components such as thyristors and triacs that are switching heavy loads can also cause burns if touched.
Always read the warning instructions that come with tools. I'm particularly thinking about metal working tools used in creating a home for your new creation, but you may also use power tools on the circuit itself, such as rotary tools and heat guns used with heat shrink insulation.
Remember that the warnings are there for a reason. You may have drilled hundreds of holes using an electric drill, but the first metal splinter in your eye may permanently damage your sight. Always wear goggles / safety glasses / gloves where it is specified in the instructions.
If you get into making your own printed circuit boards then there are dangerous chemicals that need to be handled with care as well as disposed of in a safe manner to prevent damage to local wildlife. Always read the instructions provided with your chemicals and contact your supplier if you are in any doubt about the risks and how to dispose of them appropriately.
This guide should get you off to a good start, but there may be other things I've missed or differences with different electrical systems in other countries. If there is anything else you think should be added please let me know.
You should also follow the advice on the following web sites: