Learning to Code

Recently, there has been a hashtag circling on social media telling journalists who have been downsized to #learntocode. Now regardless of if you believe this is a bully tactic being perpetuated by a vocal and hateful group of extremists or if you believe this is a humorous comeuppance telling journalist the same thing they told coal miners during President Obama’s time in office, it raises an important topic for an increasingly automated world: If you wanted to, how does one learn to code PLCs?
The truth is, there are sadly few free or inexpensive resources out there to learn how to code PLCs, and their accompanying graphical interfaces (Called Human Machine Interfaces or HMIs). What few online video tutorial series are out there usually end up being two to five minute clips trying to sell you an online course rather than teaching you how to actually code anything.
While we unfortunately do not have the ability to create a video series on learning to program PLCs, although that would be exactly the kind of career enhancing material we would someday hope to provide, we can provide some starting points for anyone interested.
I have broken this article into two separate articles focusing on two broad categories. The PLC side of things and the HMI side of things. First up is PLC considerations and best of luck to you if you want to learn to code PLCs.
PLC Considerations
The photo at the top of the article shows my test bench with the PLCs that I have personally bought over the past almost decade, minus a couple that did not fit nicely on my DIN Rail. Here is a quick breakdown of the pros and cons of each of these PLCs sorted by the total cost it would run you to begin programming. (Skip to the very end for the TL;DR summary)
1) OpenPLC (not pictured), Opensource PLC programmer

Cost to start programming: $0-$40
Pros:
• Can be used without purchasing any additional software or hardware
• Programming software is free
• Can program in Ladder Logic, Function Block, or Structured Text
• Can be paired with an Arduino or Raspberry Pi for physical hardware interaction
• Healthy and active support forum
Cons:
• Software still in development stage and it shows at times
• Currently no ability to debug live code (this is a major issue)
2) Codesys v3 (not pictured) using a Raspberry Pi

Cost to start programming: ~$40-$90
Pros:
• Can program in Ladder Logic, Function Block, or Structured Text
• Cost of base programming software is free
• Can run for two hours on Raspberry Pi without buying additional license
Cons:
• Have to purchase module for running on a Raspberry Pi separately if you want to use it for more than 2 hours a a time
• Getting the PLC program on to a Raspberry Pi is initially complicated.
3) BL20 (Bottom row, second from the right in photo) from Turck

Cost to start programming: ~$150
Pros:
• Very low cost to start learn PLCs
• Technically offers the ability to program in Ladder Logic, Function Block, or Structure Text
• Modular design allows easy expansion for more Inputs/Outputs
Cons:
• Easy to get the older version that uses Codesys version 2
• Codesys version 2 awkward to use, and very problematic (Codesys version 3 fixes many of these issues)
• Less common PLC, can be difficult to find support for it
4) ILC 131 (on the floor, middle of photo) from Phoenix Contact

Cost to start programming: ~$300
Pros:
• Phoenix Contact offers several free videos on creating your first program on their site
• Relatively inexpensive
• Can program in Ladder Logic, Function Block, or Structure Text
• Can use Modbus TCP/IP
• Full version of programming software free to use in demo mode indefinitely
• Lite version of programming software is completely free
• Modular design allows easy expansion for more Inputs/Outputs
Cons:
• Programming software can initially be non-intuitive (though free training videos help mitigate this issue)
• Programming software not as visually developed as other options
5) M340 (Top Row, second from the left in photo) from Schneider-Electric

Cost to start programming: ~$400-$2,500
Pros:
• Programming software is free to download and use for 30 Days (after 30 days you need to purchase full version, current list price for Unity Pro Small is ~$2,000).
• Able to program in Ladder Logic, Function Block, or Structured Text
• They provide several how to videos on their site for basic use of programming software
• Schneider-Electric PLCs are some of the most widely used PLCs in Europe and extensively used in America
• Uses Modbus TCP/IP
• PLC has built-in USB port to allow you to connect when you do not know the IP address of the PLC.
• PLC has built-in serial port
Cons:
• Less intuitive programming environment (although the help videos on their site mitigate the worst of it)
• One trial period runs out purchasing software is expensive (you can technically expand the initial 30 day period by registering your software)
• Have to purchase power supply, CPU, Input/Output cards, and back-place separately
• Fixed rack length means adding additional I/O can be cumbersome and requires planning ahead properly
6) Micrologix (bottom row, far left in photo) and SLC 500 from Allen-Bradley:

Cost to start programming: ~$800
Pros:
• Less expensive way to start learning Allen-Bradley PLCs
• Micrologix 1400 provides the ability to use Allen-Bradley EtherNet/IP protocol as well as Modbus TCP/IP
• Micrologix PLCs include power supply, digital inputs and outputs, and CPU all in one device
Cons:
• Very limited programming environment
• Programming environment based on outdated technology
• Can only program in Ladder Logic
• May require a special programming cable depending on the PLC chosen
• Limited I/O Options
7) Simatic S7-1200 (Bottom row, far right in photo) from Siemens

Cost to start programming: ~$2,000
Pros:
• Able to program in Ladder Logic, Function Block, or Structured Text
• Can purchase PLC and programming software together as a starter's kit
• Modular design allows easy expansion for more Inputs/Outputs
Cons:
• Much of the help is in German
• Can be difficult to transfer what you learn to other brands
• Often requires one extra step beyond what you would expect to make logic work
8) CompactLogix (top row, far left in photo) and ControlLogix from Allen Bradley:

Cost to start programming: $2,500-$7,000 (Depending on if you get the Lite or Full version of Studio 5000. Lite only covers the CompactLogix line of PLCs while Full covers Compact and ControlLogix PLCs)
Pros:
• Able to program in Ladder Logic, Function Block, or Structured Text
• CompactLogix and ControlLogix are some of the most widely used PLCs in America
• Programming software is powerful and relatively intuitive
• PLC has built-in USB port to allow you to connect when you do not know the IP address of the PLC.
• Modular design of the CompactLogix line allows easy expansion for more Inputs/Outputs
Cons:
• Cost of entry is high (most of the $2,500 estimate is the cost of buying the Lite edition of Studio 5000)
• Finding information on how to program it can be limited.
• Most technical support documents are hidden behind pay wall on Allen-Bradley's site
• Have to purchase power supply, CPU, Input/Output cards, and Right end cap terminator (for the CompactLogixs) separately.
• Cannot easily use the Modbus protocol
• PLCs cannot create unsigned data types
• No Built-in Serial port
• Fixed rack length of the ControlLogix line means adding additional I/O can be cumbersome and requires planning ahead properly
If you are looking for the cheapest option that gives you the most options, I would go with Codesys version 3 on a Raspberry Pi. As long as you are okay with uploading the runtime to the Pi every two hours then it only costs you about $40 for the Pi itself. For $40 you can have a full learning test bed with the major PLC programming languages.
If you have just a bit more to spend, I would recommend the Phoenix Contact ILC 131 ETH. The 141,151, etc. are equally good, just look for what is on sale on eBay. While I suspect that Codesys v3 and the Phoenix Contact programming environment (PcWorx) share some underlying code, there is no substitute for a true industrial PLC at the end of the day and I have been impressed with Phoenix Contracts programming software so far.
Because there is no live debugging on OpenPLC I cannot recommend it for using if you are trying to learn to code. I also can not recommend the BL20 Turck PLC since if you get stuck with one of the older ones that can only use Codesys version 2 it is truly a harsh experience. While I use the Simatic S7-1200, I would caution against it being your first PLC to learn on, they just handle things a little differently than most other PLCs so leaning it first can make it difficult to transfer what you've learned to another brand of PLCs.
Finally, you ca not go wrong with Allen-Bradley or Schneider-Electric. They are the biggest name brands in America, however as such they have the least to prove and are not going to give you much in the way of freebies. They are big and amazing and they know it. I do like that you can get a Schneider-Electric M340 for around $400 if you catch the right eBay deals and start learning on it for 30 days for free though. It would be really cool of Allen-Bradley offered something like that in the future as both their PLC and programming software are top notch.
*OpenPLC logo is the property of OpenPLC
PLC photos are stock images and the property of their respective manufacturers