Introduction to automation – Programmable devices explained

Are you one of those, who have just heard about of all of those home automated systems, automated coffee makers, or college robot competitions? And want to start learning the subject and build your own automated systems, But overwhelmed with all the steps and tutorials from where to begin with. Don’t worry or don’t step back, all the best automation engineers have been there in the beginning. This is a complete introduction to automation for beginners. Well, the subject is called automation and its backbone is digital electronics. In colleges, it’s taught under a field called mechatronics. Here this article is not about mechatronics and probably you don’t need to have a mechatronics degree, to bring your creative idea to reality and build awesome automated inventions.

No matter what your idea is, It may be a simple night sensor or a complex CNC machine, It should be controlled by a control device/circuit which can be programmed and may act as a computer. It is the brain which controls the automation process according to the program. There are a number of such devices to choose from,

  • PLC controller
  • Microcontroller based circuit
  • Arduino based controller
  • Raspberry-based control system
  • Raw microprocessor based circuit

For a beginner at the starting point, I suggest it’s a good idea to have a clear view of the above-said control methods. So I’ll write this article in a such a way that, at the end of it, you will be able to,

  • Have a clear idea of the above-mentioned control methods.
  • Select a suitable controller to your project.
  • If you are already an Arduino user, keep reading as you might find some new facts about Arduino.

Well, sometimes you may be familiar with some of these control methods or wondering what really they are and from where, to begin with. The basic is they all takes inputs from sensors/switches and process the inputs according to the given program and then gives outputs. Usually, the outputs will be given to relays in order to drive motors, bulbs, solenoids, actuators or anything as required.

Here a sensor is a device which senses different conditions and transmits the data to the processing unit. Those devices use different techniques to do the sensing, such as capacitive changes, inductive changes or changes in resistance. Then it transmits the data to the controlling device in a digital format such as serial communication, or sometimes in an analog format. There are a large number of sensors and some of them are, proximity sensors, temperature sensors, PIR sensors and rotary encoders, etc.   We will discuss the basics of these sensors and interfacing methods in a different article (Will be available soon).

In this article, we will have a basic understanding of the control systems which industries/engineers/hobbyists uses to handle the automation process. I think it is the best way to make a meaning for our topic “Introduction to automation“. Well, as I mentioned above there are many controlling methods and we will discuss the most common types here. The types you tremendously need to know at the beginning – microprocessor, microcontroller, Arduino, and PLC.

The difference between PLC, Arduino, and microcontrollers.

Nowadays these three are the most commonly used electronic control systems by engineers. They all operate according to a program which the developer/user uploads to it. Usually, the manufacturer provides the required set of tools and IDEs for the development (Usually called as the development environment). But 3rd party solutions also can be found in some cases. Even when the tools are by the manufacturer, they all may not be freely available always. In the case of PLCs, most probably the development tools should be purchased separately. Arduino is an open-source project(hardware and software), so its software is always free. Hence for DIY automation projects, Arduino and microcontrollers are more frequently used. They all have their own advantages and disadvantages. Before having an in detail comparison let’s first see individually what they are.

What is a Microprocessor?

Before knowing what a microcontroller is, let’s see what a processor or microprocessor is. You all know that a computer program should be processed (Read and understood) in a device called a microprocessor. In PC’s most commonly Intel or AMD microprocessors are used. They are the leading microprocessor manufacturer for PCs and develops those PC microprocessors in 32 bit or 64-bit architectures (Those are advance architects). As you can see in PCs these microprocessors cannot operate as single devices. To operate they require a number of peripherals such as RAM, ROM, I/O cards… etc. Furthermore, they require complex electronic designs.

ARM, Intel, and AMD are some of the leading among several microprocessor manufacturers. The UK based company “ARM”, found the ARM-architecture and the cortex core which are now widely used in mobile phones, security devices, sensors and much more. “Qualcomm” another leading processor manufacturer who develops the Snapdragon processor series for use in modern smartphones, tablets, and wearables. Also, some of these Snapdragon processors use the ARM architecture and the Cortex cores.

You may be wondering why to know about all these brands and processors at the beginning. It all is just to finally say such a powerful and popular ARM architecture is also used in high-end microcontrollers. Prior to that let’s see what a microcontroller is? Using microprocessors are much complex as they require several peripherals connected to it, so here come the microcontrollers into action.

 

What is a Microcontroller?

pic18f4550 microcontroller
pic18f4550 microcontroller

Well, the microcontroller is a single device consist of a processor and the other required peripherals such as ram, ROM, EEPROM… etc in a single device. It may also include other useful peripherals such as A/D converters, I2C modules, serial communication modules… etc. They also come with special features such as ultra low power consumption, High performance, capacitive touch, etc.  So microcontrollers are easy to use and good for fast development. You should select the most suitable microcontroller for your project depending on the required speed, needed I/O channels, needed memory, unit cost… etc.

Tools and IDEs for programming microcontrollers are not always totally free. But most probably they offer a free version of commercial software with some limitations. However, the paid version offers more features, such as optimized outputs. The free versions are more than enough for a beginner at the beginning, and that’s a good thing.

There are many microcontroller manufacturers. Some leading companies among them are,

  • Microchip (PIC, dsPIC series).
  • Atmel (AVR, Atmega series).
  • ST semiconductors.
  • NXP Semiconductors.

Note: Out of these Atmel and Microchip had a big competition among the DIY hobbyists. In Jan 2016 Microchip company bought Atmel, And now they both belong to the Microchip company.

Usually, microcontrollers can be found in toys, remote controllers, digital cameras, home electronic appliances. etc.

This was just a brief introduction to microcontrollers, If you are further interested in studying microcontrollers, read our tutorial microcontroller Introduction.

What is an Arduino?

Arduino mega 2560 board
Arduino Mega 2560 board

 

The image is an Arduino Mega 2560 board.

I’m pretty sure everyone reading this article are familiar with Arduino, or at least heard about it. But to make the article complete I’ll give a brief introduction and give some additional information sometimes you may not be knowing.

Arduino is a very popular control board mainly among the DIY hobbyists. It’s an opensource project (Both hardware and software), So all the hardware designs, programming software, bootloaders, and firmware are all free. Since it’s open source anyone with the knowledge are free to modify Arduino as needed. This is the main advantages of Arduino. There are a large number of manufacturers who manufacture and sell Arduino boards. Thus, on E-bay, you can buy a Chinese made one under a very cheap rate.

There are few Arduino boards to choose from depending on the application/project. You may consider, the needed number of inputs and outputs, needed A/D channels, PWM pins, size, etc. Some of them are,

  • MEGA 2560
  • UNO
  • NANO
  • MINI

The construction of Arduino.

At the beginning, Arduino was based on Atmel’s 8-bit microcontrollers (Atmega-2560 and Atmega-328 chips). Then in certain boards, they started to use 32-bit ARM Cortex-based microcontrollers from Atmel. And finally, now they have released a board powered with an ST microcontroller. So we can suspect in future they will design new boards powered by different microcontrollers without relying on one brand itself. However, the above-mentioned boards are based on Atmel microcontrollers (The MEGA board uses an Atmega 2560 microcontroller while the other three uses Atmega328 microcontroller chip). The Arduino star-otto is a new board which is based on ST’s STM32F469 microcontroller. It supports wifi and several onboard peripherals such as a micro SD card slot, a speaker output, an onboard microphone, and an LCD-audio-camera connector.

Usually, the recommended input voltage is 7-12v clean DC. Then an onboard regulator regulates it to the operating voltage. It is 5v for Atmega based boards, while ARM-based boards operates on 3.3v

To communicate with the PC, Arduino doesn’t require any external intermediate communication devices. All the required circuitry is built on the board itself. So it’s able to directly plug the Arduino to the PC using a USB cable, and do the programming/debugging/communication task.

The process of programming Arduino

Arduino IDE is the official IDE provided to program Arduino boards. however, there are several third party IDEs also available. The IDE comes with the compiler(avr-gcc) and the Arduino libraries. These Arduino libraries and the Arduino bootloader are the things which make the particular microcontroller, an Arduino. When connects the Arduino board to the PC via USB port the Arduino IDE can communicate with it (with the bootloader which is discussed below).

The official IDE is not much user-friendly and lacks many features, of a rich IDE, such as syntax autocorrect, code suggestions, etc.  Personally, I prefer using visual micro which is an extension of Visual Studio. So you can get the full power of the world most popular IDE, visual studio.  To visit visual micro homepage click here. visual micro and visual studio, they both have free versions. So nothing to worry, the total solution is available freely.

Here’s our tutorial – The Arduino IDE alternatives (link will be available soon).

In the Arduino’s main microcontroller, there is an initial program which is called as the bootloader. This bootloader is programmed in such a way, it can download a second program by communicating over a serial network. The above-said bootloader occupies some space from the total available memory. It also takes few milliseconds to start the uploaded program, which is called as the bootloader delay. If you need the whole programmable space or if you need to avoid the bootloader delay, simply you can erase the bootloader and upload your program via an external programmer directly to the microcontroller. Under the next heading, I’ve provided a link for a tutorial which explains this task.

Using Arduino in real world applications.

“Hey Lakshitha I love using Arduino, it’s easy to learn, there are many resources, a large number of libraries are available, development is pretty quick and easy. But…. how can we use it in real applications. I mean in commercial applications” This was a question that I came across in college by one of my friends. I figured out many newbies are facing the same question. So here is the reply in brief.

Using Arduino boards are ideal for experimental purpose or development purpose. But using the boards itself in commercial applications are really not nice. Mainly because the connections are made via headers and jumper wires. So it’s good for development but, cannot ensure a solid connection as a product in the final output. In your product, you may need not to have an odd looking board which takes a considerable amount of space. So now comes the question, once the development is done how to prepare a commercial product.

After doing all the fine tunings and adjustments now you have the final design and the program. Now you have to get a separate microcontroller, which was on the board you used for development. Then upload the program file(.hex file) to the microcontroller using its appropriate tools and software. Now you are done, map the pins with the Arduino board and build the rest of the circuit. Here you use the power of the Arduino core libraries in a commercial application.

Hears our tutorial “using Arduino code in a standalone microcontroller” which explains it. (link will be available soon)

OpenPLC is an open source PLC project which is based on Arduino, have a look at it.

 

 

What is a PLC?

The three letters refer to “Programmable Logic Controller” which, Engineers usually consider as ultra high-end and highly reliable control devices. So they are widely used in industry automation, robot arm controllers, machine control, production lines automation, and elevator controllers. etc.

PLC is a digital computer with an operating system uploaded to it by its manufacturer. Then it operates according to a program which the user/developer uploads to it. When talking about the programming task in PLCs, usually there are several programming language options available, such as ladder logic, function block diagrams, statement list, continuous flow chart, c++  and structured text. Here ladder logic, function block diagrams, and flow charts are high-level graphical programming languages which make PLCs special from the others. Most commonly developers use ladder logic for PLC development. There are many advantages of graphical programming languages over traditional text-based languages.

  • The main advantage is fast development.
  • The program is easily understandable by other developers/programmers. So it’s easy for a new engineer to update an old system.
  • Easy debugging and error handling. Because there are methods to inspect the program working in real time.
  • Updating the system is easy and quick. So system downtimes are minimized.

In many cases, PLCs programming tools are not free, and the user must purchase them separately. Furthermore, sometimes the software license is expensive than the PLC unit. :), Yes that’s true. The reason is, they spend a lot on the IDE and compiler development. And they cannot cover it only by selling the hardware.

PLC systems are developed by leading companies such as,

  • Siemens
  • Allen Bradley
  • Hitachi
  • ABB
  • Mitsubishi
  • Omron

 

Basic construction of a PLC

Allen BradleyPLC
Allen BradleyPLC

Here is an image of an Allen Bradley PLC unit.

PLCs mainly consist of a power supply unit, CPU unit, I/O modules, and other modules. The user can expand the PLC rack easily, by plugging extra modules as required. There are several pre-built modules such as analog modules, input modules, output modules, networking modules, etc. All modules are plug and play type and very easy to configure via software. Some PLCs comes with a fixed number of ports and such units cannot be expanded.

Most probably the manufacturer builds the PLC using microprocessors, However, some old PLCs used microcontrollers also. Manufactures specially designs PLCs to work for years continuously even in rough environments, such as environments with high EMI (Electromagnetic interference). Hence PLCs are popular in industry automation.

To refer more about PLCs, here’s our complete article Introduction to PLC controllers. (will be available soon)

Introduction to robotics, the final words.

If you read the article up to this level now you may be thinking that the PLCs are the best. But that’s not always correct and the answer is, it depends according to the application. For a remote controller, using a low power microcontroller is the best. For a simple home automation system, it’s better to use an Arduino based control circuit. If you are designing a large machine its good to use a PLC. Manufacturers specially design PLCs for such applications.

If your application doesn’t require much security and, If you can design it using an Arduino, then preparing an Arduino based control circuit is the best.

If you are developing a small application and there is no Arduino board or shield that suits your need, such as ultra low power or hardware encryption. In this case, you have no other options than getting a microcontroller which have the needed functionalities. And then write the program from the sketch.

As an introduction, here we discussed the controlling methods of automation.  If you found this useful and interesting please leave a comment, maybe say “thank you :)”.

Sharing is caring!

AUTHERED BY : LAKSHITHA DIAS
Lakshitha Dias

Yes I'm Lakshitha Dias from Sri Lanka, who is interested in digital electronics, microcontroller technology, and computer science.

Stay connected with me

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz
shares