PLCs

PLC output protection

Always use a relay between the PLC output and the signal receiver, this way you prevent any failures on the load side from damaging your PLC. It is way easier to change a single burnt relay than the whole PLC.

PLC programming

It is highly recommended that you start by designing the state machine representation of your code (see State Machines), as this will give you quite a good grasp of what the code should look like and can give you insights as to how to bring the machine into any state, specially the safety ones.

Backups

Warning

I cannot stress this enough: BACKUP THE PROGRAM.

Some PLCs can store the whole program, including the comments and other info, in a flash card or internal memory, which is a good feature, however this does not constitute a backup. It may look and feel like one, but it is not. Don’t ever trust the PLC to hold its own program. I have seen PLCs lose their program because of power outages, as explained in Retentive memory battery.

Version Control

Always a good idea to use some of the version control tolls available like GIT or Mercurial.

Often times, people who program PLCs are not programmers per se, but engineers who built the machine and now are tasked with programming it.

Being that a single man’s job, often these kinds of engineers tend to never learn how to control version, resorting to making infinite .zip versions with ever more confusing names such as “MachineCode01.zip”, “MachineCodeFinal.zip”, “MachineCodeFinalIndeed0123.zip” and so on.

Git eliminates both the need for backing up the code, as it is often coupĺed with cloud solutions, and the need for creating zips to contain the history of changes.

Retentive memory battery

Some economical PLC versions come without an internal “CMOS battery”, in their place a super capacitor is installed that can hold up to 5 or so days of charge, after that everything stored on the retentive memory area is lost. This will wipe out all of your configuration parameters, and set them back to the default values, and that is in the best case. In the worst case, the PLC will have a slot for a flash memory that would hold all these parameters and the whole program itself, so if there is no flash card and the battery or capacitor discharges, the PLC program is gone as well.

Warning

Buy a flash card, they are worth their weight in gold.