Intro to the N20K48 WiFi module - TCP/IP Communication

Free Shipping! - USA Orders Over $75

Customer Reviews

Intro to the N20K48 WiFi module - TCP/IP Communication

Description

The N20K48 WiFi module turns this powerful PID controller into an IoT device suitable for a wide range of applications. In this video, we'll walk through how to get started with using the WiFi Module for TCP/IP communication.

IOThrifty N20K48 WiFi bundle - https://www.iothrifty.com/products/temperature-process-controller-with-wifi-connectivity?_pos=2&_sid=bb5ecf5f0&_ss=r&variant=44127222923501

Getting Started with the N20K48 - https://www.youtube.com/watch?v=GVZczL65wnw&t=5s

Registers Table - https://cdn.novusautomation.com/downloads/communication_protocol_n20k48_v10x_en.pdf

Modbus Poll - https://www.modbustools.com/modbus_poll.html

Transcript

Overview

The N20K48 is a versatile and affordable PID controller. It’s built with extensibility in mind through plug and play modules that connect to the controller through a dock. The latest module that was released is the CG-Wifi Module. This powerful new module turns the N20K48 into an IoT device that can perform signal acquisition through the cloud. This allows for remote access and monitoring via WiFi which wasn’t before possible.

In today’s video, we’ll show you how to set up, configure, and access the N20K48 via your local area network through Modbus TCP IP. If you don’t have much experience with the N20K48, it might be helpful to check out our video on how to get started which is linked to in the video description.

Hardware Setup

In order to use the N20K48 with Wifi Connectivitiy, you’ll need the N20K48 Controller, the CG-DOCK Module Expansion Chassis, the CG-WiFi ClickNGo Module, and a WiFi Antenna.

IOThrifty sells the N20K48 with Wifi Connectivity as a package that includes everything you need to get started or you can purchase the controller and each of its accessories separately.

First connect your dock to the N20K48. Then Connect the Wifi Module to the dock. The Wifi Module will take up two slots in the dock. Last, you’ll need to screw your antenna onto the back of your Wifi module.

Once you’ve done this, you’re ready to configure your device.

Configuration

To set up communication to Wifi and Modbus TCP/IP you must first configure the N20K48 through the QuickTune desktop app via a USB cable or through the QuickTune mobile app via bluetooth. Today, we’ll be using the desktop app.

When you open QuickTune, the first thing you’ll want to do is select Read Device. You should see your device display on the screen. Click on that.

It may take a few seconds to update your configuration data.

Before doing any configuration, it’s important to note that you may need to update your firmware. To use the WiFi module, the N20K48 must have firmware version 103 or higher. You can update the firmware by clicking on the Firmware Update button in Quicktune and choosing the correct version. We’re currently on version 103 so we’ll proceed with configuration.

First, let’s head into the Cycles tab, we’ll set a setpoint to 20 degrees. This isn’t required for Wifi configuration, but we’ll use it to demonstrate how you can write to your controller later in the video.

We’ll also want to ensure that our controller is set to read a thermocouple input. You can set this on the Analog Input tab. We’ll change sensor type of the main input to a K type thermocouple or Tc k.

Now let’s jump over to the features tab. If you’re familiar with QuickTune, you’ll notice that there are a few new tabs at the end. We’re going to start with the WiFi Communications tab.

Set Enable CG-Wifi Module to activated. Once you do this several other options will display.

Set Enable AP mode to Disabled - Using AP mode means that your controller will become the access point.

Your Access Point SSID will be the name of your wireless network

Access Point Password is the password of your wireless network

Set your obtaining IP Address to DHCP because we’ll be using Dynamic IP and let our network server assign the IP.

Set Enable Modbus TCP server to Yes, because we’ll be demonstrating how to use Modbus TCP IP to communicate over the wireless network.

Set the port for your modbus TCP service to 502

There’s another tab that was added called MQTT. In this video we’re focused on setting up Modbus TCP/IP, but MQTT is the protocol used when connecting to the cloud. We’ll cover this in another video, so leave Enable MQTT function set to “No” for now.

Once all of those settings are filled out, you should be properly configured to communicate with your device over Modbus TCP/IP. Let’s send those changes to our device, by clicking send to device in the bottom right.

Once that’s complete, Quicktune will have a valid IP address for your device. You may not see it immediately, but if you return home, then head back into your device, then back into the Features, WiFi Communcations tabs you should see it. The IP Address is important, and we’ll need it for the next step.

Modbus TCP/IP

Now let’s test if we can read the process variable and set point from the controller, then change the setpoint over Modbus TCP/IP. We’ve connected a thermocouple reading room temperature to our controller. The temperature reading from that thermocouple will be our process variable. To test reading and writing over TCP/IP, we’re going to be using the Modbus Poll software which offers a 30 day free trial for new users.

Select connection, then Connect from the top menu. Then ensure your connection is Modbus TCP/IP. Under IP Address or Node Name, enter your device's IP address that was displayed in QuickTune. Next, ensure the server port is set to 502, and leave the other options unchanged. Then click OK to create your connection.

You’ll notice we’re still not seeing valid values. That’s because we’re reading from the wrong slave ID.

It’s worth noting that as of the time of filming this, the controller and the Wifi module have two different Modbus TCP/IP Slave IDs. The controller is at slave ID 255 and the Wifi module is slave ID 254. As of this video this isn’t properly documented in the manual.

For each of these slave ID’s there are different registers tables. The registers table shows you the address or register for accessing controller or module data. In our case we want to find the process variable, typically abbreviated as PV and the Set Point, typically abbreviated as SP. On the N20k48 registers table these live at address’s 201 and 200. We’ll provide a link to the registers table below the video, but you can also find the tables on the Novus Website.

To set the correct Slave ID and registers, we’ll head back into Modbus Poll and select Setup, read/write definition from the top menu.

On the next screen, you’ll want to set the slave ID to 255 to read from the N20K48.

Then you’ll want to set the Address to 200 and keep the Quantity at 10. The way this works is that it will show the 10 consecutive registers starting at 200. Since our process variable is at register 201 and our set point is at register 200, this should include both of them. We hit ok and our table is now displaying valid values.

In this case, the row at zero represents register 200 which is our setpoint. As you can see, this is correctly reading 20 degrees, which is what we set the set point to earlier in the video.

Row one represents register 201 which is our process variable. This is also reading the same as our controller at 25 degrees C.

We’ve proved that we can successfully read values over Modbus TCP/IP, but let’s attempt to write values. Let’s change the setpoint to 30 and see if it also changes the setpoint on the controller.

If I just click on the cell in row 200 representing our set point and start typing 30, I get a window to edit the cell. I’ll type 30 into the value field and hit send.

Almost immediately after hitting send, I can see that my setpoint has successfully been updated to 30 on my controller.

Throughout this video, we showed you how to connect your N20K48 to the Wifi module, configure it to connect to Wifi, and read and write to Modbus TCP/IP. We hope you found it helpful. All of the links we referenced should be posted in the description. If you’d like to purchase an N20K48 with Wifi Connectivity, head over to IOThrifty.com where you can always find great deals on quality brands.