Thursday, 21 July 2016

The gravest fear that has rippled through humanity from the technology industry is that, someday, almost all of our jobs will be replaced by robots.
While that fear is often laughed off as something that will only happen far into the future, the truth is that it's actually happening right now.
In Dongguan City, located in the central Guangdong province of China, a technology company has set up a factory run almost exclusively by robots, and the results are fascinating.
The Changying Precision Technology Company factory in Dongguan has automated production lines that use robotic arms to produce parts for cell phones. The factory also has automated machining equipment, autonomous transport trucks, and other automated equipment in the warehouse.
There are still people working at the factory, though. Three workers check and monitor each production line and there are other employees who monitor a computer control system. Previously, there were 650 employees at the factory. With the new robots, there's now only 60. Luo Weiqiang, general manager of the company, told the People's Daily that the number of employees could drop to 20 in the future.
The robots have produced almost three times as many pieces as were produced before. According to the People's Daily, production per person has increased from 8,000 pieces to 21,000 pieces. That's a 162.5% increase.
The increased production rate hasn't come at the cost of quality either. In fact, quality has improved. Before the robots, the product defect rate was 25%, now it is below 5%.
Shenzhen Evenwin Precision Technology, also based in Dongguan, announced a similar effort in May 2015. This region of China is often referred to as the "world's workshop" due to the high number of factories located there.
The shift happening with automation has been in the works for many similar companies in the area for quite some time. Foxconn, the controversial manufacturer of many gadgets such as the iPhone and iPad announced itsrobot initiative back in 2011.
Dongguan is about an hour's car ride north of Shenzhen, which is widely regarded as one of the top regions in the world for gadget manufacturing. The growth of robotics in the area's factories comes amidst a particularly harsh climate around factory worker conditions, highlighted by strikes in the area. One can only wonder whether automation will add fuel to the fire or quell some of the unrest.
Some of the influx of robotics in the region is due to the Made in China 2025initiative, and we will continue to see automation affect the area and potentially reduce the number of manufacturing jobs. Additionally, in March, 2015, the Guangdong government announced a three year plan to increase automation in the region by subsidizing the purchase of robots.
According to the International Federation of Robotics (IFR), electronics production was one of the biggest growth drivers for the sales of industrial robots. China was the largest market for industrial robotics in 2014 with nearly 60,000 robots sold.

Saturday, 2 July 2016

Nikon Digital Camera - PLC - Raspberry Pi 2

This PLC application about how to use Nikon Digital Camera for connecting to PLC with using Raspberry Pi 2. this application for photographing, example:
Automatically take picture when:
  1. products that are not good (NG) or reject
  2. at a certain time, the worker does not exist in the machine
  3. emergency stop in the machine, and etc.
In Nikon Digital Camera using USB Picture Transfer Protocol (PTP protocols) or another digital camera that is PTP Protocols support.
In Raspberry Pi using Raspberry pi 2 with Raspbian Wheezy OS and use python 2.7
In PLC using Siemens S7-200 with Modbus Support or another PLC with Modbus Support.


Hardware needed for Digital Camera Application

  1. Digital Camera with PTP Support, I use Nikon COOLPIX S2800 Compact Digital Camera
  2. Raspberry Pi 2
  3. PLC that is Modbus Support, I use Siemens PLC S7-200
  4. Male RS232 - TTL Module
  5. RS232 PLC Cable
  6. Power Supply for Raspberry Pi
  7. 2 pieces Push Button Switch for test

Hardware Connection for Digital Camera Application

Software needed for Digital Camera Application

  1. Raspbian Wheezy OS : https://www.raspberrypi.org/downloads/raspbian/
  2. gphoto2 reference : http://gphoto.sourceforge.net/doc/manual/ref-gphoto2-cli.html
  3. Project file for Raspberry Pi Setup, click here

Raspberry Pi Setup for Digital Camera Application

A. Serial Modbus Setup on Raspberry Pi 2

STEP 1:

In LXTerminal:

sudo cp /boot/cmdline.txt /boot/cmdline.bak
sudo cp /etc/inittab /etc/inittab.bak

sudo nano /boot/cmdline.txt

Remove "console=ttyAMA0,115200"

Ctrl+X to exit, Y to save followed by enter twice

sudo nano /etc/inittab

Put a '#' before "T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Ctrl+X to exit, Y to save followed by enter twice

STEP 2:

Copy Paste All Project file to folder /home/pi on Raspberry Pi 2

STEP 3:


In LXTerminal

cd /home/pi
cd pyserial-2.7
sudo python setup.py install

STEP 4:

In LXTerminal

cd /home/pi
cd MinimalModbus-0.6
sudo python setup.py install

B. gphoto2 Setup on Raspberry Pi 2

STEP 1:

Raspberry Pi Connected to Internet via Ethernet/LAN
Install via Internet Access:
Open LX-Terminal and type:

cd ~
sudo apt-get install libltdl-dev libusb-dev libusb-1.0 libexif-dev libpopt-dev

Optional: Raspberry Pi Disconnected from Internet

STEP 2:

Camera do not Connected to Raspberry Pi
Already Project file to folder /home/pi on Raspberry Pi 2

STEP 3: libgphoto2-2.5.8 setup

in LX-Terminal and type:

cd ~
cd libgphoto2-2.5.8
sudo chmod 777 * -R
./configure
sudo make install

STEP 4: gphoto2-2.5.8 setup

in LX-Terminal and type:

cd ~
cd gphoto2-2.5.8
sudo chmod 777 * -R
./configure
sudo make install

STEP 5: Check the installed gphoto2 is Success

in LX Terminal type:

cd ~
gphoto2 --version

If Error:
gphoto2: error while loading shared libraries: libgphoto2.so.6: cannot open shared object file: No such file or directory

in LX Terminal type:

sudo ln -s /usr/local/lib/libgphoto2.so.6 /usr/lib/libgphoto2.so.6

If Error:
gphoto2: error while loading shared libraries: libgphoto2_port.so.12: cannot open shared object file: No such file or directory

in LX Terminal type:

sudo ln -s /usr/local/lib/libgphoto2_port.so.12 /usr/lib/libgphoto2_port.so.12

STEP 6: Camera Check

Camera Connected to Raspberry Pi via USB
in LX Terminal type:

cd ~
gphoto2 --auto-detect
gphoto2 --summary

If Error:
Camera already ..
From Remove Camera such as Storage Mass

sudo killall gvfs-gphoto2-volume-monitor 
sudo chmod -x /usr/lib/gvfs/gvfs-gphoto2-volume-monitor

C. Auto Startup Python Script on Raspberry Pi 2

STEP 1:

in LX Terminal type:

cd ~
sudo nano auto-startup.sh

in editor, type in this script:

#!/bin/sh
cd /
cd home/pi
sudo python take-photo-plc.py
cd /
and then:
CTRL+X ,  press Y, enter

STEP 2:


in LX Terminal type:

cd ~
sudo chmod 755 auto-startup.sh

STEP 3:

Script Test, in LX Terminal type:

sudo sh auto-startup.sh

CTRL+C for  Stop

STEP 4:

in LX Terminal type:

sudo crontab -e

In editor, go to bottom and type:

@reboot sh /home/pi/auto-startup.sh >/home/pi/startuplog 2>&1
CTRL+X ,  press Y, enter

STEP 5:


Auto Start the Desktop (LXDE)
  1. in LX Terminal type: sudo raspi-config
  2. 2.Select Enable Boot to Desktop/Scratch from the menu and press Enter
  3. 3.Select Desktop Login as user pi at the Graphical Desktop.
  4. 4.Select <Finish> and Enter, then select <Yes> to reboot.

PLC Programming for Automatic Capture Image

  1. Project file for Siemens PLC S7-200, click here
  2. Download PLC Ladder Programming to PLC using PLC Software











Wednesday, 29 June 2016

plc and scada interface using DDE.

Industrial control systems are always very complex and cumbersome to handle. For electronics engineers, it is becoming very essential to understand the computer control system using a programmable logic controller (PLC) and supervisory control and data acquisition (SCADA) system.
Here is a very efficient and expandable robust control system solution for industrial purposes. For the proposed system, we have used AB Allen Bradley MicroLogix 1400 PLC 1766, Wonderware InTouch 2012R2 SCADA system and KEPServer version 5 software for communicating between the PLC and SCADA. Wonderware InTouch SCADA is becoming increasingly popular due to its powerful user-friendly graphics as shown in Fig. 1.
Fig. 1: A typical Wonderware InTouch graphical user interface
Fig. 2: MicroLogix 1000 PLC (Model 1761-L10BWA features 120V/240V AC power, six 24V DC digital inputs and four relay outputs)
1. The RSLogix family of IEC-1131-compliant Ladder logic programming packages help you maximise performance, save project development time and improve productivity. This family of products has been developed to operate on Microsoft Windows operating systems. Supporting Allen Bradley SLC 500 and MicroLogix families of processors, RSLogix 500 was the first PLC programming software to offer unbeatable productivity with an industry-leading user interface. PLC is programmed using Ladder programming in RSLogix software. Different inputs and outputs have different addresses. Mostly the field devices, which are to be controlled, are connected to the PLC via digital input, analogue input, digital output and RS232, among others. The address of each device, module and register is specific to each PLC manufacturer, including Allen Bradley, Siemens, Schneider, Mitsubishi, Hitachi and Delta.
Fig. 5: Schematic diagram for PLC connections

2. The PLC is connected to the PC via the Ethernet. Since both PLC and SCADA are from different manufacturers, we used an intermediate OPC link (communicator) between these. This job is done by
KEPServer, which is installed on the PC.
3. The PLC IP address is configured using software tool BOOTPServer.
4. When the main SCADA is running, applications like KEPServer should be running in the background and PLC should be in online mode.
5. Using SCADA, a graphical user interface (GUI) is built to monitor and control various parameters like current/voltage and to switch on/off various devices.
Fig. 6: Interfacing the PLC via the Ethernet to a PC to make it available to software for configuration and programming
Fig. 7: Setting BOOTP server properties

Fig. 10: SCL instruction set
For a beginner, it is better to start with the MicroLogix family of PLCs from Allen Bradley. MicroLogix 1000 controller offers control capabilities in an affordable, compact package. MicroLogix 1200 provides features and options to handle an extensive range of applications. The expandable MicroLogix 1500 controller helps you achieve high-level control in a variety of applications. MicroLogix 1100 and MicroLogix 1400 controllers increase application coverage with enhanced network communications at affordable prices. RSLogix 500 programming software and RSLogix Micro programming software provide an instruction set that is common to MicroLogix and SLC 500 controller families.
MicroLogix 1000 PLC system. MicroLogix 1000 PLC (Fig. 2) is available in 10-point, 16-point or 32-point digital input/output (I/O) versions. Analogue versions available with 20 digital I/O points, four analogue inputs (two voltage and two current) and one analogue output (configurable for either voltage or current) provides a compact form factor, with footprints as small as 120mm x 80mm x 40mm (4.72 x 3.15 x 1.57 inches).
It offers fast processing with typical throughput time of 1.5ms for a 500-instructions program and has a pre-configured 1kB program and data memory to ease configuration. It includes built-in EEPROM memory; hence, there is no need for battery back-up or a separate memory module.
The device offers peer-to-peer messaging (up to 32 controllers on a DH-485 network) through a 1761-NET-AIC communication interface. Communication takes place via DeviceNet and EtherNet/IP through 1761-NET-DNI and 1761-NET-ENI communication interfaces.
It also includes a built-in high-speed counter (only on controllers with 24V DC inputs) and lets you customise input response times and noise rejection using adjustable DC input filters.
The device supports simple connectivity through an RS232 communication channel to a PC for program upload, download and monitoring.
Fig. 12: A typical address for AB PLC
MicroLogix 1400 PLC system. The 1766 MicroLogix 1400 PLC system (Fig. 3) is built upon critical MicroLogix 1100 features, including EtherNet/IP, online editing and a built-in LCD panel. These controllers feature a higher I/O count, faster high-speed counters, pulse train output, enhanced network capabilities and a backlight on the LCD panel. Controllers without embedded analogue I/O points provide 32 digital I/O points, while analogue versions offer 32 digital I/O points and six analogue I/O points. You can expand all versions with up to seven 1762 expansion I/O modules.
The Ethernet port provides Web server capability, email capability and protocol support for DNP3 protocol support. The built-in LCD with a backlight lets you view the controller and I/O status. It also provides a simple interface for messages, bit/integer monitoring and manipulation.
Application capabilities can be expanded through support for up to seven 1762 MicroLogix Expansion I/O modules with 256 discrete I/Os, up to six embedded 100kHz high-speed counters (only on controllers with DC inputs), two serial ports with DF1, DH-485, Modbus RTU, DNP3 and ASCII protocol support.
There are 10kB words in the user program memory with 10kB words in the user data memory, and up to 128kB for data logging and 64kB for recipe.
PLC connections
One can buy a compact AB Allen Bradley MicroLogix 1400 PLC 1766, with eight DIO and two built-in serial ports (model 1766) for initial development. We used MicroLogix 1400 controllers, which are suitable for use in an industrial environment. Specifically, this equipment is intended for use in clean, dry environments.
Typical PLC connections for automation of an experimental facility are shown in Fig. 5. Allen Bradley Micro Logix 1400 has various digital input and digital output pins operated by +24V DC. An analogue input module is added separately. Another high-current 1000A power supply device is connected via RS232 protocol, where only three lines, namely, TX, RX and GND, are used for communication via a PLC serial port. Finally, AB PLC is connected to the PC via an Ethernet port.
RS232. RS232 is a serial protocol that converts parallel data to serial bits (pulses) and sends these across three wires, that is, TX, RX and GND. In most cases, the number of wires required is just three, but in special circumstances it may go up to nine wires, say, an RS232 modem.
Allen Bradley 1400 series has two serial ports. The first one is through a PPI cable with a 9-pin D connector at the other end. This needs a NULL modem connector to connect to any PC having a serial port or USB serial adaptor. NULL modem connections are shown in Fig. 4.
Interfacing the PLC to a computer. MAX1400 has three ports. First is COM1 (round connector); second is COM2 (9-pin D connector), which is for RS485/RS232 communications; and the third is Ethernet for Ethernet/IP driver based communications. Therefore it is pretty easy for anyone to configure Ethernet as download port and COM1 as serial port for RS232 communications.
Allen Bradley PLC is connected to the computer via the Ethernet. We need to interface the programmable controller in order to configure and program (Fig. 6).
Adding drivers. Adding a driver is required for RSLOGIX classic software. To do so, you need to click on the middle icon and add RS232 DF1 driver to it.
Software for interfacing. RSLinx Classic is a software tool from Rockwell Automation Networks and Devices. It is a comprehensive factory communication solution, providing Allen Bradley PLC access to a wide variety of Rockwell Software and Allen Bradley applications, ranging from device programming and configuration applications such as RSLogix.
fig. 13: Setting RS232 channel configuration

Fig. 14: Downloading the Ladder program to the PLC
BOOTP server is a suitable server to establish communication between PC and Rockwell PLC.
Communicating to hyper terminal. How does one know that the PLC is transmitting characters out of its serial port? You can view the pulses or protocol produced using a hyper terminal window.
For that, you need to set the hyper terminal settings to 19200, N, 8, 1, which is same as the settings of PLC serial DF1 driver.
Double-click MAC and enter the IP (Fig. 7).
Ladder programming. Once the AB PLC is successfully interfaced to the PC, we need to properly program it using RSLOGIX provided by Rockwell Automation. For programming the PLC, we use Ladder programming. Typical PLC programs use blocks like timers on and off, counters, digital I/Os, RS232 communication blocks and others.
Ladder program is similar to the wiring diagram of the circuit. We redraw the wiring diagram using two vertical lines to represent input power rails and stringing the rest of the circuit between these. Sub-routines are implemented as another ladder.
A typical example of a block used for RS232 programming is AWA (Fig. 9).
ASCII write append (AWA). The AWA instruction sends a specified number of characters (for example, 50) of the source tag (ST14:0) to a PLC serial port 2 and appends either one or two pre-defined characters. It is used for RS232 communication.
Similarly, an SCL is an instruction used to read and scale an analogue input to a corresponding physical value like temperature or pressure.
In the above example, the address for the analogue input is I: 1.0 and the converted raw data is divided by 10,000 and added to offset to implement a linear transfer function like
y = mx + c
A number of free Ladder programming tutorials are available on the Internet. Inside the PLC, we have various registers like output, input, status and binary. Each bit in these registers specifies a function. Addresses of the devices are built on the basis of names, PLC slot numbers, words and bit numbers. Address representations differ from manufacturer to manufacturer.
The table above shows some of the bit addresses of the PLC and how these are related to field devices.
A typical address of an AB PLC for output coil is built as in Fig. 12.
Once you write your Ladder code for the PLC, download the code into the PLC. Let the PLC be in Run mode after that.
Fig. 13 shows how an RS232 port can be configured for handshaking a power supply device, which has settings 9600, N, 8, 1.
Wonderware InTouch SCADA
Wonderware’s InTouch HMI software for visualisation and industrial process control offers outstanding ease of use and simple-to-configure graphics. For having an interactive GUI to control outputs of PLC, RS232 devices via PLC, we use Wonderware InTouch SCADA. A simple GUI can be made in Wonderware by following simple steps:
1. Open Wonderware Development tool by double-clicking on Desktop icon.
2. Start a new project.
3. From the palette on the right side, choose the appropriate graphical object to be inserted.
4. Click on the screen to insert the object.
5. Double-click on the object to add a suitable tag name and type of object. Type defines usage; it may be analogue or discrete.
6. Double-click on the tag to assign properties to the object. Different operations like visibility or blink can be controlled on the basis of scripting.
7. If the tag is I/O type (meant to read or control a device), specify the address of the device.
8. Address of the device can be obtained from registers of the PLC, which can be viewed in RSLogix.
9. In Modify Access Name window, keep the access name as KEPServerEX_SL. KEPServer acts as a communicator between RSLogix and Wonderware InTouch.
10. In this fashion, develop the entire GUI with specific tag names, addresses of devices and PLC variables used in Ladder logic.
Access name. Each PLC uses a specific protocol to communicate with the I/O server or DA server. InTouch then uses an access name concept to continue this communication for dynamic data exchange (DDE). Typically, because here KEPServer is acting as a communicator between PLC RSLogix and Wonderware InTouch, we specify access name in InTouch as KEPServerEX_SL. Access names are selected in the tag name dictionary for each tag used in the application.
Scripting. In all control systems, it is essential to provide software interlocks to prevent human errors. So the best method would be using Window Scripts in InTouch. Window scripts execute periodically when an InTouch window is opened, or one time when an InTouch window is opened or closed.
Programming here is done using scripts, which is similar to any programming language. A typical scripting example is shown in Fig. 18.
Fig. 16: Wonderware development tool
Fig. 17: Setting tag properties
KEPServer
KEPware’s OPC server KEPServerEX provides an easy and reliable way to connect the Allen Bradley PLC to HMI, SCADA, Historian, MES, ERP and countless custom applications. Here, you can use KEPServer for communicating RSLOGIX to Wonderware InTouch using the Ethernet/IP protocol.
Be careful while specifying tagnames in KEPServer. Tag names and their corresponding addresses should match those mentioned in Wonderware InTouch development.
Running the final application
Once your PLC code is downloaded into the PLC and run from RSLogix, run KEPServer. Open the runtime application of Wonderware InTouch software and open your GUI file. Always make sure that KEPSersver is running in the background while you run Wonderware InTouch application.
Applications
Such a control system can be very useful for industrial automation, in research laboratories and big industries. The graphical interface makes it easy for the operator to operate switching and controlling operations. The PLC provides a very rugged solution to control relays and RS232 devices.

Arvind soni is masters in ECE from the BHOPAL RGTU,
and is currently working as engineer-at Arist automation Indore.9111225438







Question : What is a PLC?
Answer: Programmable Logic Controllers are industrially hardened micro computers, designed to replac e electromechanical relays, used to control machines and processes.
Question : What are the main advantages of PLC?
Answer:
1.      Modular design
2.      Increased reliability  
3.      Lower cost
4.      Compact size
5.      Ease of programming
6.      Rugged construction and designed to withstand vibrations, temperature, humidity and noise
7.      Ability to communicate with computer
Question : What are the major areas of application of PLC?
Answer:
1.       Sequence control, timing, counting, and data calculation
2.       Batch or continuous process control
3.       Precise position/motion control
4.       Open loop or feedback control, process data acquisition and display

Question :  What are the advantages of PLC over Relays?
Answer:
1.       They have to be hard-wired to perform a specific function
2.       No hard-wire requirement
3.       When the system requirement change, the relay wiring has to be changed or modified
4.       Can be easily changed or expanded through program
5.       Higher power consumption
6.       Lower power consumption

Question :  Explain the classification of PLC.
Answer:
There are five major classification of PLC based on number of inputs and outputs, cost, functionality and physical size. They are
i.                 Nano : 16 I/O pins
ii.                Micro : 32 I/O pins
iii.              Nano or micro PLC could used on applications such as elevators, car washes or mixing machines.
iv.              Small : 128 I/O pins,2Kbytes memory, capable of simple to advanced level of machine control
v.                Medium: 2048 I/O pins, 32Kbytes memory, used for process control applications
vi.              Large: 8192 I/O pins, 750 Kbytes memory, mostly used to control individual production process or entire plants like paper and pulp, chemical and automotive and power plants.
 Question :  Explain the functions of PLC-input and output modules
Answer:
1. Input interface modules accept signals from the machine or process devices (120Vac) and convert them into signals (5Vdc) that can be used by the controller.
2. Output interface modules convert controller signals (5Vdc) in to external signals (120Vdc) used to control machine or process.
Question :  List out the programming languages in PLC.
Answer:
a. Ladder Logic Diagram
b. Sequential Function Charts
c. Instruction List
d. Function Block
e. Structured Text Diagram


Question: What is Ladder LogicDiagram?
Answer:
Ladder Logic Diagram is a symbolic language used in PLC. This diagram consist of series of symbols interconnected by lines to indicate the flow of current through the various devices. In ladder logic diagram the sides of the ladder forms the power sources and current flows through the various –logic input devices that form the rungs of the ladder.

Question: List the conditions for drawing thw ladder logic.

Answer:
a.      Contacts may be always inserted in the upper left.
b.      Coils must be inserted at the end of the rung.
c.      All contact must run horizontally.
d.      The number of contacts per network are limited
e.      Only one outout may be connected to a group of contacts
f.       Flow must be from left to right.
g.      The contact must be nested.
h.     Contact progression should be straight cross.
Question : Explain On-Delay and Off-Delay Timer instruction in PLC

Answer:
a)      The on delay timer operates such that when the rung containing the timer is true, the timer tiomed out period commences. At the end of the timer time out period an output is made active.
b)     The Off delay timer operation will keep the output energized for  time period after the rung cotaining the timer has gone false.
c)       
Question: What is PLC SCAN ?

Answer:
During each operating cycle the processor reads all the inputs , takes the values and energizes or de-energizes the output according to the user program. This process is known as PLC Scan . A single PLC scan consists of the I/O scan and the program scan.