Go Down

Topic: BEGINNERS: PLC vs Arduino (Read 5741 times) previous topic - next topic

lastchancename

Dec 16, 2019, 04:00 am Last Edit: Dec 17, 2019, 10:16 am by lastchancename
The comparison of PLC to an embedded controller is valid, but are aimed af a different goal.   PLCs use a similar type of single-chip microcontroller internally  - probably programmed in C, to handle the PLC control language.

A PLC uses an embedded micro to perform its magic.
PLCs have a powerful, easy to learn language and control set, but are strictly constrained with the scope of functions they can perform.
For example, a PLC would be unsuitable to write a text editor!

Coding in C or assembler typically runs an order of magnitude faster and uses less memory than a higher level interpreted or tokenised language like the PLC, BASIC or Pascal etc.
C or C++ are probably as tight/close as you can get to assembler/machine code.
Other languages tend to carry some overhead baggage... and are usually written in C as it turns out !

The source code of a higher level interpreted BASIC, can be re-downloaded intact, while the tokenised PLC or Pascal code can re-download the tokens - to *reconstruct* the strictly defined source.  if the source environment or language version has changed, the old tokens may not match the new development environmen, so you're out of luck.

In old school BASIC, the closest you can get to the hardware is with those old PEEK and POKE instructions and ASM blocks.

C or other 'compiled' languages are converted (compiled) to pure binary machine code (assembler-like) and 'linked' before being uploaded to the chip, hence there is only ever machine code available in the target chip to 'download' back again... the *source code is gone* unless you saved it previously, and then it needs to recompiled into binary machine code again - before upload to the chip.

Machine code is typically 80-90% smaller than the required 'source code' - hence uses less memory in the target cpu.

Because chips are 'so fast' nowadays, they can execute those 'slower languages'  (interpreted or tokenised)  - so quickly that the speed difference* is negligible to the result for the application at hand.  Same for memory... newer ARM and other chips have on-chip, or support much larger memory than a small 8-bitter like the basic Arduinos.

* e.g an Arduino UNO or MEGA clocked at 16MHz can execute about 4 million machine code instructions per second.
An ESP or ARM could be clocked at 80 or 300MHz, giving ~20-70 million machine code instructions each second.  And they likely have much more memory available.

--NEXT TIME--
The next thing to consider is 'blocking' vs 'non-blocking' code.
No matter how fast your chipset is, it will be effectively stopped if you implement blocking code styles or structures.
Experienced responders have a nose for laziness, (they were beginners once)... Sure, there are trolls, chest-beaters, and pretenders - but the help you'll get here is about as good as it gets - if you try to help youself!.

bkucenski

What matters for beginners is the toolkit and what exactly you're "beginning" in and what you want to become "experienced" in.

And what is going to motivate you to learn.

PLC vs Arduino is really an apples to oranges comparison.

First figure out what you want to do and then figure out what tools will work to do that.  Then learn them.

The longer you avoid learning by looking for shortcuts the longer you avoid mastery.



sugandhan

I have used Arduino mega and uno in many industrial projects. They are still operating without issues. We can say that arduino is similar to PLC because i didnt find any of the arduino malfunctioned within 5 years under normal operating conditions

jackthomson42

Yeah both are quite similar but with PLC you don't need to add much electronics, they normally have builtin relays but with Arduino we get 5V at the output.

I have once worked on PLC designed using Arduino. Moreover, Ladder Logic is the main difference, a developer working on ladder logic, don't want to work on Arduino Programming.
If you want to fly, you need to try .....

seafox_c

Hi,

I worked a couple years with PLC's of Siemens and more recently Phoenix Contact mainly in the automotive sector (Volvo) I also worked with Arduino at home. I love both of them but they are indeed not to be compared.

In a PLC you can really see your program online in the code editor live with all the status of the inputs, variables, outputs, etc. This becomes critical when you need to find faults in a production environment. 

You also have a Hardware diagnostics when hardware fails. An Arduino will for example not let you know that an input is shorted or a communication cable is disconnected.

You can do certain downloads without the PLC program interrupts.

You can use communication standards and protocols like Profibus and Profinet to enable easy set-up and communication between components. These protocols are made for the time sensitive industrial networks (a message to position something very accurate at high speed needs this). You can also use Arduino and Profinet but not with the ease you can do with a PLC.

PLC's can be safety rated so you can implement safety functions in the PLC (you never may use Arduino as a safety component).

Arduino on the other hand has also many advantages over a PLC. For one thing the cost. Then you also have the flexibility of the language and all the great library's.
I also really like the small footprint you have with some models like the Arduino Nano.

So I like both but there is a reason I will never advocate to have a production assembly be run by an Arduino in a complex  industrial environment. I would not want to be the technician to download print(""); to troubleshoot :).

 
 


Go Up