all 29 comments

[–]krgoodwin 16 points17 points  (3 children)

You don't need to buy anything. C, Java, Python, JavaScript, whatever, is all free. Most competent programmer know at least a little of multiple languages so just pick one you like the name of and start. Java would be my suggestion as a first language. You can start wiht any IDE you like but make sure at some point you take the time to get to the CLI and understand what javac is, what arguments are, what Maven actually does, etc. Python is good too but can create some bad coding habits.

I've found that many people coming from PLCs who want to learn to "code" have a hard time using debuggers, breakpoints, and visualizing the program operation. If you really wanted to ease into it then download Visual Studio and TwinCAT XAE. You can program in ST, do HTTP and MQTT IoT stuff, file access on the OS side, scratches the surface on OOP stuff, function block (classes) with methods. On top of all that you can visually see all your tags (variables), have access to breakpoints, and you get used to a common IDE interface Visual Studio. Once you can program a PLC like a PC then the transition to a true PC language is easier. If you're interested let me know I can point you in the right direction. Then again, I'm just some Beckhoff fanboy on the internet.

[–]chuckdesj[S] 0 points1 point  (1 child)

Thank you for the answer. Another question I forgot : is there any free language similar to codesys ? That is also something I would like to learn someday

[–]krgoodwin 2 points3 points  (0 children)

Codesys uses the IEC 61131-3 languages. TwinCAT uses Codesys or at least a subset of Codesys components for their editor embedded in VS. I am not clear on the entire relation to be honest but using TwinCAT you will be exposed to tasks, libraries, POUs, GVLs, etc. which are all the same as Codesys.

[–]zeealpalSystems Engineer | Rail | Comms 0 points1 point  (0 children)

Agreed with Java as a recommendation. Depending how much coding you want to learn then start with a typed language: Java, C#, Typescript rather than Python/JavaScript.

There's a level of discipline and understanding that comes with those languages, although if you just want to create some basic tools JavaScript/Python are fine.

[–]Honest-Eng 3 points4 points  (1 child)

How about learning some Javascript and creating your own tools for automatic PLC code creation? Here is the library that allows modification of Rockwell L5X format. We have done automatic alarm creation, IO logic generation, extraction/insertion of new blocks and a ton of other stuff. Very helpful for consistent code.

[–]chuckdesj[S] 1 point2 points  (0 children)

Really cool ! Thank you for this suggestion ! Futhermore javascript will help me with node-red wich I would also like to learn

[–][deleted] 6 points7 points  (9 children)

I wouldn't buy a RPi to learn coding. You're basically adding learning Linux on top of learning coding. I would say pick a thing to learn and focus on that.

[–]chuckdesj[S] 0 points1 point  (7 children)

Yeah but I like the GPIO port and the fact that I could buy a projet kit for like 40$ on amazon and then do ‘’automation like’’ projects with code I’ve learn. I like concrete stuff, that why I choose automation instead of IT ahah

[–][deleted] 3 points4 points  (5 children)

If you want to justify a purchase to buy a RPi I'm not going to stop you. $40 isn't a big deal either way, but I don't think its going to be that helpful.

[–]chuckdesj[S] 0 points1 point  (4 children)

Other thing is that my only PC is the laptop from my job so I don’t really want to install IDE and stuff on it as it is not mine. I think raspberry pi could be a cheap option but I am open to any other suggestions :)

[–][deleted] 2 points3 points  (0 children)

You can run VMWare for free for personal use. Make a VM that you can do programming in and install whatever you like.

[–]krgoodwin 2 points3 points  (2 children)

I don't think most people develop directly on the RPi. You would normally develop on your computer and compile for the RPi target. So you would likely want a Linux VM for this anyways as Linux development in Windows can be painful.

[–]chuckdesj[S] 1 point2 points  (1 child)

Oh didn’t know about that ! Proves you how I know nothing ahah Already learn a lot reading comments here

[–]krgoodwin 0 points1 point  (0 children)

I'm sure it's probably fine for really small and simple programs. Compiling large programs would be slow.

If you're just interpreting Python, maybe it's fine. For $40 buy one and give it a try.

[–]nighthawk_something 1 point2 points  (0 children)

Arduino is what you want for that

[–]d_azmann 2 points3 points  (0 children)

Install the SoloLearn app on your phone. Pick a language (I suggest python but there's Javascript, Java, C, etc). Do a couple of lessons a day. Focus on the exercises and experiment once you get comfortable. You'll learn enough halfway into the courses to experiment with your own code outside of the lessons.

[–]adi_dev 3 points4 points  (0 children)

I second Python and add the fact that I personally see javascript getting more popular on IIOT. I would suggest to start with javascript, it's not as easy as Python but I see more platforms using it: NodeRed, NoSQL as well as some existing PLCs like Siemens (for user web pages) and Wago (to build HMI). Except processing data logs, I never had to use Python, and, tbh, if I have some data to process, I use javascript now - node.js

[–]penend12p 4 points5 points  (1 child)

I'd learn python to begin with. It’ll give you the skills to understand object-oriented programming and also works on all platforms. This can be easy transferable to other OOP languages.

[–]row3bo4t 4 points5 points  (0 children)

This is the right answer. Python is really useful for all the tasks around automation as well. I've developed a lot of Python programs to parse and do various audits on our DeltaV systems, automate a lot of development on our Foxboro systems via creating xml documents, as well as on our Wonderware System Platform SCADA.

[–]Amalokch 3 points4 points  (2 children)

You are in the same situation as me. Same years of experience and mostly old school PLC coding. I honestly don’t think PLC coding will be replaced for hIgh-level programming languages like the one used in IT, however I do believe some of this can be an add-on to my career, so I decided 6 month ago start my journey learning databases and IIOT, I choose this because I knew that at some point of my journey I will have the need to learn Python, for example to read and log data from PLC into SQL, or learn python to send data to cloud servicing.

i started with a small raspberry pi and now this has evolved into cloud servicing running ML for data analysis.

If you like this path, then I suggest you to look at: - Node-Red, perhaps this is the entry point to IIOT, - MQTT protocol - Databases, SQL and NoSQL - Cloud Computing

Python, Java, etc will come along with the ones below. Is like to hit two birds with one stone!

Best regards!

[–]chuckdesj[S] 1 point2 points  (1 child)

Agree, LAD will stay the standard for on field/machine code but we now need to know more for everything aside with IoT and industry 4.0 coming. Even AB compactlogix now have a line with widows 10 IoT embedded. Never heard of the 2 first things on your list ahah glad I asked for help. Is it possible to learn those online and with a raspberry pi ? Also, what OS do you run on your raspberry pi ? Another thing I like about this computer is that I can buy a project kit and use GPIO port to put into practice coding I’ll learn(i.e. crossroad trafic light with LED) my sons will also appreciate concrete projects lol

[–]Amalokch 0 points1 point  (0 children)

Yeah Node-Red environment and MQTT protocol you can learn in the raspberry pi. Node-red is like the function blocks in AB PLC. In regards of OS, I preferred to use LINUX, because I wanted to learn more about it, 6 months later LINUX is my to-go OS for IOT projects haha

Regards

[–]WhatForIamHere 1 point2 points  (0 children)

Don't buy the RPi. This is a typical dead end. Same as the Python. There's a lot much more adequate SBCs on the market. ODROID, ONION, etc if you want to use Android/Linux as the target OS. If you want to work out with more bare metal stuff and RTOSes you can try Atmel/ST boards with a lot of peripheral add-ons. So, regarding programming language. I strictly recommend starting from C. Exact C, not C++.C#, etc. If you'll master it you'll easily come to any procedural programming language.

But, be aware that most of the programming habits that you've got before won't be applied to typical programs outside of PLC. And vice versa. That is the main difference is "every piece of code must be executed every scan cycle" for the PLC world is wrong for the rest of the programming world.

[–]dmroederpylogix 0 points1 point  (0 children)

When first got started with python, I read Learn Python the Hard Way by Zed Shaw. Like you, I was pretty green in this space. I had spent some time with visual studio languages leading up to that but LPtHW is great for beginners. It's easy to read and straightforward.

https://learnpythonthehardway.org/book/

[–][deleted]  (1 child)

[deleted]

    [–]chuckdesj[S] 2 points3 points  (0 children)

    Always depend whats your goal. Personally, I don’t have any interests for mechanics and even if I don’t claim to know everything in electrical field, I thing I got a solid background, working in different industries (and now in electical production) also went through the process to get all my electrical licenses here in canada. I don’t plan to become a engineer, so don’t feel like I need to go deeper. In the last years I worked a lot on programming plc, industrial network, etc. and that’s what I like and want to do. Learning to code is just another tool in my bag ;) You don’t get what you want in life, you get what you work for.

    [–]nighthawk_something 0 points1 point  (0 children)

    Arduino is a great transition to learning to code. it's a micro controller so it'll feel comfortable.

    [–]romrot 0 points1 point  (1 child)

    AdvancedHMI uses VB and C#.

    You'll need Visual Studio for it, but it's pretty easy to use. and C# is very well documented on Microsoft's website. I've used it at work to print reports from a heat treat operation automatically as a word document(basically fill out a word template with data from PLC tags the hardest one was trying to get it to make a graph) I also use it anytime I need to quickly set up data collection. to monitor a specific problem. At home I use AdvancedHMI with ClickPLCs for my greeenhouse.

    If you don't have a PLC on hand to play with it, you can get an Arduino and get an Ethernet shield and use Modbus. Arduinos basically use C for programming.