Affordable devices to use while learning Ignition

Inductive automation offers a great free learning system called "Inductive University"

Inductive University

This is the default entry point into Ignition for many people. However there is one recommendation I would make to anyone starting out with Ignition: don't just go through the videos and listen. Instead, have some real hardware you can work with to make it more interesting and applicable.

Some people may be lucky enough to have high end PLC's available to them (and the licensed software needed to program them) but unless its through work, most people will not. If you really want to work with a PLC, Automation direct offers a great PLC for working at home:

Click PLC

These will still cost about $150-200 dollars once all is said and done (you might find one cheaper on eBay or craigslist, but they're quite popular so probably not).

Here I will show a much less expensive alternative that lets you connect a real device to Ignition via Modbus TCP which is a very useful protocol used in every facility we integrate at.

ESP32 Feather ~ $20
Feather Relay ~$10

So for a total cost shipped to your house probably around $35, its an inexpensive way to have a real device to work with. You don't really need the relay but if you have one you can do actual control of anything that is powered by single phase 110VAC. There are many versions of the ESP32 feather board, including S2 and S3 which allow you to program in Circuit Python which is super cool. The example below will be written in C++ using the Arduino IDE.

Code
This example sets up one single coil to control the relay. This can easily be expanded on using "Hreg" to setup and write to and/or read from holding registers. For example you could add a LM34 or LM36 temperature sensor and log the data with Ignition using SQLite DB.

#include <WiFi.h>
#include <ModbusIP_ESP8266.h>

//Wifi Crednetials
char ssid[] = "Network Name";
char pass[] = "Password";

ModbusIP modbusTCPServer;

//Modbus coil mapping
const int modAddOnOff = 0X00;

//Program global variables
int onOff;    //0 = off, 1 = on

void setup() {
  Serial.begin(9600);
  while (!Serial);
  connectToWiFi();
  pinMode(LED_BUILTIN, OUTPUT);

//Set this device as a server (slave)
//Declare modbus coils and holding registers
  modbusTCPServer.slave(502);
  modbusTCPServer.addCoil(0x00, 0);
}

void loop() {
  modbusTCPServer.task();
  onOff = modbusTCPServer.Coil(modAddOnOff);
  digitalWrite(LED_BUILTIN, onOff);
}

void connectToWiFi(){
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

Then once the board has been programmed, you can grab the IP address from the serial monitor. An alternative to this is to hardcode the IP address in the program but you'll need to ensure its not used by any other device:

Device Settings
Now the device is on your local home network; setup a Modbus TCP Device:

If all is well, you will see connected:

OPC Tag Addressing
Ignition Modbus Addressing Guide

In order to control the coil or bit that turns the relay on and off, setup a single Boolean OPC tag. Addressing to the coil is done like this:

At this point you can already start to use the power of Ignition which allows you to control data and devices with scripting. Here is a quick script that will toggle the relay on and off:

path = "[default]Adafruit ESP32 Feather/control"
system.tag.write(path, not system.tag.read(path).value)

But you don't want to be limited to the designer, so its time to make a simple view. Below is a flex container with a total switch in it. The switch is bi-directionally bound to the control tag and the display text shows what state the coil is in, on or off:

On your desktop machine you can then access the view at the following:

http://localhost:8088/data/perspective/client/Test

But that is not what you want. You want to control the coil from your mobile device. To do that, simply replace local host with the IP address of your machine. You can also do this using the perspective app, but it is not required, you can do it from any browser.

Firewall Settings
If you find that you cannot access the view from your phone, you may need to setup incoming and outgoing firewall rules that allow traffic on port 8088, for example:

Finally you are able to control the relay state from your mobile device:

Cheers,

Nick

17 Likes

Great guide!

Another starter path is the one of REST APIs and scripting instead of PLCs.

Most of your typical smart home devices work well in this context, I believe we do college demos with Phillips Hue light bulbs.

2 Likes

Awesome stuff! As a person who was about to shell out money for a Click for learning purposes, it is nice that there is a cheaper way. Only thing is I guess you don't / can't do ladder logic on the ESP32 Feather?

That is correct, feather is just another form factor of Arduino which is based on C++ so the type of programming will resemble what is in the example above but no ladder logic.. If a person was wanting to learn ladder logic, a click PLC would be the most cost effective solution.

Here the main focus is on connectivity to the device for a really low cost.

Nick

1 Like

Nice write up.

I’ve used OpenPLC with an Arduino board. It is free software and gives you the ladder logic and structured text capabilities. So it could be an inexpensive alternative as well. In my case, I leveraged a RPi as well to play with Ignition Edge and interface with MQTT, where I ran a Mosquito broker on another machine.

1 Like

@dbailey I have seen the OpenPLC but it mainly looks like an arduino packaged to fit on a DIN rail:

Open PLC

They don't readily call it out on the page above but they do mention that you still program arduino with C++. Do you have an example of what it looks like to program Arduino with ladder logic like programming?

Thanks,

Nick

@nicholas.robinson I apologize for not being clearer earlier. The Open PLC Project (https://openplcproject.com/) is what I was referring to. It was developed by a grad student (I can't seem to find the name quickly) and made public. The editor interface is decent and no more difficult for a newbie than say Studio 5000 in my opinion. I do not have anything specific that I can show now. I did this about a year and a half ago in an effort to learn a bit about ladder logic specifically.

The bonus is you can run the OpenPLC (project) code on an arduino, RPi, or even a PC/Mac. It allows you to create virtual devices that can be manipulated/monitored via the web interface for OpenPLC. It was quite neat. I believe I had it running on a Pi and then also on an arduino mega connected to the Pi.

1 Like

That is interesting. I will try it out sometime and post back here.

Cheers,

Nick

You can create modbus servers / clients, and OPC UA Servers in Python. It is also a good way to make integrations between old equipment with proprietary protocols and Ignition.