Home

Real PLC setup

You can upload the ladder program you write in CoilPath to a real Siemens S7-200 SMART PLC and run it live from your phone. For this, the CoilPath runtime is installed on the PLC once. After that, programs are always uploaded from CoilPath.

What you need

  1. An S7-200 SMART CPU with an Ethernet port (SR and ST series). Tested with SR20. Models without Ethernet and the classic S7-200 (CPU 222, 224, 226) are not supported.
  2. A Windows computer with STEP 7-Micro/WIN SMART, free from the Siemens website. You need it only once, for this setup.
  3. An Ethernet cable and the router at home or in the workshop.
  4. CoilPath Pro. The real PLC connection works in the phone, tablet and desktop apps, not in the web version.

The setup erases the program on the PLC. Do not install it on the PLC of a working machine. Use a PLC set aside for training and testing.

If a word is new to you (IP address, gateway, system block and so on), see "What these words mean" at the end of this page.

What an IP address is and why we change it

Every device on a network has an address made of four numbers, like 192.168.1.34. For your phone to find the PLC, both must be on the same network, which means the first three numbers of their addresses are the same. If the phone is 192.168.1.34, the PLC must be 192.168.1.something.

The S7-200 SMART ships with the address 192.168.2.1. Most home routers hand out addresses starting with 192.168.1 or 192.168.0. So you change the PLC's address once. The steps below walk you through it.

1. Look up your phone's address

Your phone should be on the Wi-Fi of the router you will connect the PLC to.

  1. iPhone: Settings, Wi-Fi. Tap the (i) next to your network. Look at the IP Address line.
  2. Android: Settings, Network & internet (or Connections), Wi-Fi. Tap your network. The IP address is shown directly or under Advanced. Menu names vary a little by brand.
  3. Write the address down. Example: 192.168.1.34.

2. Decide the PLC's new address

  1. Take the first three numbers of your phone's address as they are: 192.168.1.
  2. Make the last number 200: 192.168.1.200. Routers usually hand out small numbers to phones, so 200 is usually free.
  3. The gateway is the router's address. Usually the same first three numbers ending in 1: 192.168.1.1.
  4. The subnet mask is always 255.255.255.0.

If your phone is 192.168.0.12, the PLC is 192.168.0.200 and the gateway 192.168.0.1. If your phone is 10.0.0.25, the PLC is 10.0.0.200 and the gateway 10.0.0.1.

To make sure the address is free, on a computer connected to the router type cmd in Start, then type ping 192.168.1.200 in the black window and press Enter. If it says "Request timed out" or "unreachable", the address is free. If replies come back, another device uses it. Change the last number to 201 and try again.

3. Connect the computer directly to the PLC

The PLC is still at 192.168.2.1. For the computer to see it, the computer gets a temporary address starting with 192.168.2. You undo this at the end.

  1. Plug one end of the Ethernet cable into the PLC and the other into the computer. No router in between.
  2. On the computer, press the Windows key and R together. Type ncpa.cpl and press Enter.
  3. Right-click Ethernet and open Properties.
  4. Select Internet Protocol Version 4 (TCP/IPv4) and press Properties.
  5. Tick "Use the following IP address". Enter 192.168.2.100 as the IP address and 255.255.255.0 as the subnet mask. Leave the gateway empty. Press OK.

If you do not know the PLC's current address (someone may have changed it), it shows up with its address when you press Find in the Communications window in Micro/WIN. Give the computer an address with the same first three numbers ending in 100.

4. Prepare the project in Micro/WIN

  1. Open Micro/WIN SMART and create a new project.
  2. Double-click System Block in the tree on the left. In the CPU row, select your model (printed on the front of the PLC, e.g. CPU SR20). If you have an expansion module, select it in the row below.
  3. In the same window, under the Ethernet port, tick "IP address data is fixed". Enter the address from step 2 (e.g. 192.168.1.200), subnet mask 255.255.255.0 and the router's address as the default gateway (e.g. 192.168.1.1).
  4. Under Retentive Ranges, set the first range to VB1000 with 3200 elements, so the uploaded program survives a power cut.
  5. Under Startup, set the mode to RUN. Press OK.

5. Paste the runtime

MAIN.awl SBR.awl

  1. Download both files. They open in Notepad.
  2. MAIN and SBR_0 already exist in the program block. Right-click the program block, Insert, Subroutine to add SBR_1, SBR_2, SBR_3, SBR_4 and SBR_5.
  3. Choose STL from the View menu at the top.
  4. Open MAIN.awl in Notepad, select all with Ctrl+A and copy with Ctrl+C. In Micro/WIN open MAIN and paste with Ctrl+V.
  5. In SBR.awl, paste the part under each SUBROUTINE SBR_n heading into its own subroutine the same way (the SBR_0 part into SBR_0, SBR_1 into SBR_1…).
  6. Press Compile. There should be no errors. If there are, send us a screenshot of the error list.

6. Download to the PLC

  1. Double-click Communications in the tree on the left. In the network interface card row, select the computer's Ethernet card and press Find.
  2. The CPU appears in the list (192.168.2.1). Select it and press OK.
  3. Press Download. Program block and System block should be ticked. Press Download and confirm putting the PLC in STOP if asked.
  4. When the download finishes, the PLC moves to its new address (e.g. 192.168.1.200) and the computer loses the connection. That is expected.
  5. Close Micro/WIN.

7. Restore the computer and plug the PLC into the router

  1. Again Windows key and R, ncpa.cpl, right-click Ethernet, Properties, Internet Protocol Version 4, Properties.
  2. Tick "Obtain an IP address automatically" and press OK. The computer's internet works as before.
  3. Unplug the Ethernet cable from the computer and plug it into a free LAN port on the back of the router. Power the PLC.

8. Connect from CoilPath

  1. Your phone is on the same router's Wi-Fi. Guest networks keep devices apart, so the connection fails there.
  2. Open a project with a PLC in CoilPath (e.g. Library, the first circuit under PLC projects). Press Run and switch to the Ladder tab.
  3. Tap Real PLC in the strip at the bottom. Enter the PLC's new address (e.g. 192.168.1.200) and press Connect.
  4. Press Upload program to PLC. When you see "Program is running on the PLC", live mode turns on.
  5. Buttons you press in the app now go to the real PLC, and the contactors in the simulation follow the PLC's real outputs. Buttons wired on site work too.

You do this setup once. Next time it is only step 8: open, connect, upload.

Addresses and limits

Inputs I0.0 to I1.3, outputs Q0.0 to Q0.7, expansion module outputs Q8.0 to Q8.7. Timers T1 to T16, counters C1 to C16. Memory M0.0 to M7.7. Analog inputs and outputs are not available yet.

Stop and overload inputs that are not wired on site are supplied by the app, so the circuit can be tried before the wiring is finished. If CoilPath stays silent for one second, the PLC releases remotely pressed buttons by itself. If the connection drops, the app keeps trying to reconnect for 30 seconds.

Remote buttons are for training and testing only. Emergency stop and protection must cut power in hardware on site.

Troubleshooting

It says it could not connect

Look up your phone's address again and check that its first three numbers match the PLC's. Guest Wi-Fi does not work. Close Micro/WIN if it is open, the PLC accepts one programming connection at a time. You can ping the PLC from a computer on the router to see whether it answers.

Micro/WIN cannot find the PLC

Check that the cable goes directly from the PLC to the computer and that you gave the computer the temporary address from step 3. If the computer's Wi-Fi is on and uses the same address range, turn Wi-Fi off for a moment.

It says "The CoilPath runtime is not installed on this PLC"

The connection works, but the runtime was not found on the PLC. Make sure you pasted the runtime and downloaded the system block together with the program block.

The program is gone after a power cut

Check the retentive range in the system block: VB1000, 3200 elements. Then download the system block again.

I changed my router and it no longer connects

The new router may hand out different addresses. Start from step 1 and look up your phone's new address. If the first three numbers changed, change the PLC's address again with steps 3, 4, 6 and 7. This time give the computer a temporary address starting with the first three numbers of the PLC's old address.

The connection drops now and then

The app reconnects by itself. If it drops often, cable the PLC directly to the router rather than through a Wi-Fi extender or a switch.

What these words mean

Words in this guide that not everyone has to know. Tap one to open its explanation.

PLC

Programmable logic controller. It reads signals from buttons and sensors and drives outputs such as contactors and lamps according to its program. It does the job of relays and timers in a control circuit with software.

CPU

The main body of the PLC, the part that runs the program. S7-200 SMART CPUs have names like CPU SR20 or CPU ST30, printed on the front.

Expansion module

An extra input or output card clipped next to the CPU. For example EM DR08 adds eight relay outputs. Skip these steps if you have none.

Ethernet cable

The network cable that plugs into the back of the router, with a plug a bit larger than a phone plug. The PLC has the same socket on its front.

Router

The internet box at home or in the workshop. It broadcasts the Wi-Fi and has LAN sockets on the back for cables. Some people call it a modem.

LAN port

The Ethernet sockets on the back of the router, often yellow or numbered. The PLC's cable goes into one of these, not into the socket where the internet line comes in (WAN).

Guest network

A second Wi-Fi some routers offer for visitors. For safety it keeps devices apart, so the phone cannot see the PLC. Use the main Wi-Fi.

IP address

Each device's address on the network, four numbers like 192.168.1.34. The phone reaches the PLC by this address, like a house number.

Subnet mask

A setting that says which part of the address belongs to the network and which to the device. At home it is always 255.255.255.0, meaning that devices whose first three numbers match are on the same network.

Gateway

The door out of the network, which is the router's own address. Usually the address ending in 1 (e.g. 192.168.1.1).

ping

A small command that asks an address "are you there". If replies come back, a device is there. If not, the address is free.

cmd

The Windows command window. Type cmd in Start and a black window opens where you type the command.

ncpa.cpl

A shortcut that opens network connections in Windows. Press the Windows key and R, type it, and the window with the Ethernet and Wi-Fi icons opens.

STEP 7-Micro/WIN SMART

Siemens' free computer program for programming the S7-200 SMART, Micro/WIN for short. You use it only once for this setup.

System block

The Micro/WIN window with the PLC's settings: which CPU, the IP address, what survives a power cut, whether it starts running on power-up.

Program block

The program that goes into the PLC. It holds the main program (MAIN) and the subroutines (SBR_0, SBR_1…).

Subroutine (SBR)

A separate piece of program called by the main program. The runtime is made of six subroutines, so you add six, SBR_0 to SBR_5.

STL

A view that shows the program as lines of instructions instead of a ladder drawing. Micro/WIN is switched to it so you can paste the text from the file. You do not need to know how to write STL.

Compile

Micro/WIN checks the pasted program and turns it into something the PLC understands. Errors show up here.

Download

Sending the program and settings from the computer to the PLC through the cable.

RUN and STOP

The PLC's operating states. In RUN the program runs, in STOP it halts and outputs switch off. The PLC goes to STOP briefly during a download.

Retentive range

The part of the PLC's memory that survives a power cut. The CoilPath program is written there. If it is not set, the program is lost at every power cut.

CoilPath runtime

A small program installed on the PLC once. It reads and runs the ladder program sent from CoilPath, so you do not need Micro/WIN for every new program.

Ladder

A PLC program drawn with contacts and coils, similar to a control circuit. It shows in the Ladder tab in CoilPath.

Live mode

The app's simulation runs connected to the real PLC. A button you press in the app goes to the real PLC, and the contactors on screen follow the PLC's real outputs.

Notepad

The simple Windows text program. The .awl files open in it and you copy the text from there.

If you get stuck, write to us: destek@akademi.muhendisizhepimiz.com