Last Updated: 21/02/2024

#69 Arduino Fail Safe Projects

Projects >> #69 Arduino Fail Safe Projects

Building Fail Safe Projects

Fail Safe

Building Arduino style projects is great fun and rarely carries any risk apart from burning out the odd component. Over my years of programming I've destroyed a few Arduino and ESP32 boards and melted some holes in some breadboards when using some bigger stepper motors but the only real damage has been to my pride and my wallet.

However, as projects get bigger and turn into installed items it is useful at the project planning stage to think about the concept of "Fail Safe".

The Concept of Fail Safe

This is a piece of old railway sleeper I keep outside the house, one of a pair that I use when fixing my car.

If I'm working on the car brakes or changing a wheel I jack the car up with a conventional jack.

However, before I start work on the car, especially when I need to get under the car, II lower it onto this block of wood so that if the jack fails... I will be safe.

The concept of "Fail Safe" means building a project in such a way that if something goes wrong it fails in a way that causes as little damage or injury as possible.

wooden block

Things to think about

External Considerations
Voltage Most of the time our projects use 5v or 3.3v so normally power supplies rarely provide more than 12v. At these lower voltages the risk of harm becomes much lower.
However, care needs to be taken when thinking about the location of the power supply. For example, a power supply left outside suddenly becomes deadly.
Also, if using relays to turn of 220v AC items make sure you are competent to wire the item correctly, especially when others may be using it.
Remember children, pets and even other adults may not understand or interact with your project in the way you expect. Items get knocked over, things can be dropped or spilt on your project.
All these things need to be thought about.
Moving Parts Even a simple fan blade moving at speed is enough to do serious injury, other items such as Stepper Motors can also have very high torque, especially if they have any type of gearbox.
Make sure both yourself and others are protected from moving parts.
Power Failure What happens when the power fails and then comes back on? Is the restart procedure fail safe? Do things instantly move to reindex or wait for a manual command.


On my model railway the points are controlled by servos. I had a lot of problems with servos twitching or even performing random movements for no reason at all. The issue was caused by cross talk. The track power is an alternating square wave that was running along wires in the same bundle as the servo. This was enough to generate a signal that at times could imitate a PWM signal and confuse the servo.
Wire Breakage When a PULL DOWN resistor is used on a switch, a command is sent when the switch is pressed and the signal goes HIGH. The opposite is true with a PULL UP resistor, the signal goes LOW when pressed.

A fail safe consideration is what would happen if the wire to the switch broke? Will the machine just randomly switch on? Certainly not Fail Safe.
There may be other times when we require a signal to be HIGH by default to ensure that if there is a failure the system shuts down.
Environmental Factors Dust, Humidity, Weather, Vibration, Heat and Light. All can have an impact on proects and may cause issues with different sensors.

Dust can block optical sensors, Weather can have an impact with sunshine fooling PIR motion detectors. Vibrations can cause connections to come loose or wires to chafe through. water can cause short circuits or corrosion. On my cat washer project temperature was important, what would happen if the water froze in the pump?
Human Error You may know how the project should work but not everyone else will. When being moved and items are being plugged back in does it pass the "Fail Safe" test. Can people plug things in back to front?

On this board you will see a Clutch relay connection and a Brake relay connection. Both require 2 wires but one uses a 3 pin connector to make sure they cannot be plugged into the wrong connection that would lead to catastrophioc failure.
Notice that all other connectors have different numbers of pins apart from the 2 serial connectors. No damage would be done if these are plugged in the wrong way round.

Notice also the connectors used only work in one direction to prevent someone connecting back to front.

The foot switch uses a PULL DOWN resistor so that if it became detached the machine would just stop working.
Multiple pin outs
Programming Considerations
Knowing your ability Are you compentent enough at this stage in your programming career to build this project safely?
Code failures Key safety code needs to be confined to as small a number of cfunctions as possible, 1 is best. In this way when modifications are made it is easier to make sure that crucial safety functions remain un changed.
Testing Runing somehting once and seeing it work is not really enough to test an item. What happens if you test it a 100 times or more.
What items look like they will fail first.

Always try and build a decent mock up before moving on to final components, especially when the final components are big and expensive.


Additional Resources

#60 Arduino Connectors and Plugs 15/01/2024


For help or suggestions on new projects, please email the address in this image: and use #69 Arduino Fail Safe Projects as a reference.