Learn how the PID algorithms work with hands-on real world demos instead of theoretical math. In this video we will experiment with the PID coefficients to help give you a better feel for how they work together and how to adjust them to give you the best possible PID tuning.
Check out this playlist to see all of the videos in this series: https://www.youtube.com/playlist?list=PLPdypWXY_ROpXvgmlUuKDKViOFFW8YnoV
Check out all of our videos at https://www.AutomationDirect.com/Videos
Or go to the Automation Video Cookbook at: https://www.AutomationDirect.com/Cookbook
To subscribe: https://www.youtube.com/user/automationdirect?sub_confirmation=1
**Prices were valid at the time the video was released and are subject to change.
To talk to a WEG variable frequency drive via Modbus RTU, you just: wire it to your controller, configure the drive for serial communications, send Modbus commands to run/stop the drive, change direction, jog, etc., and read and write Modus registers to change or view parameters in the drive. Let’s do a quick example using a CLICK PLC and a WEG CFW100 drive. And while I am using a CLICK PLC for this demo, the same concepts will apply to any PLC. The WEG drives don’t have communications built-in, so you’ll need to add an RS485 module and wire it to the controller like this. Let’s add an external selector switch on digital input 4 so we can quickly switch between local operation of the drive from the front panel keypad and HMI and remote operation where we will control the drive from a PLC via Modbus RTU. And remember that while we are using a WEG CFW100 drive in this demo, everything we do here applies to the WEG CFW300 drives too. Wiring is done, time to configure the drive. I’m going to reset the drive to factory default, so you know exactly where I am starting from. Before we do anything though, let’s go to parameter 12 and make sure the drive sees the switch on digital input 4. Yep, the 4th bit lights up. Perfect. We need to configure the serial port, configure the digital input, configure remote mode for serial operations and enter our motor specs. To configure the drive’s serial communications, you just setup these parameters. We’re gonna use these default values, so we don’t need to do anything here. Of course, we will have to make sure the CLICK PLC matches these . Next, we need to add the local-remote switch. I’ll go to parameter 220 and set it to a 4 to tell the drive we are using a digital input to control switching between local and remote modes. And let’s go to parameter 266 and set it to a 9 to tell digital input 4 it will be used as the local remote switch. Now we need to tell the drive that when it is in remote mode, to get the speed reference, forward reverse, run/stop and jog from the serial interface. Give me a second to enter those. One side note: Parameter 226 is set to a 5 and while that tells the drive forward and reverse will be controlled by serial commands, it also tells the drive that if power is lost that it should default to forward when power returns. If you put a 6 here, it still tells the drive to use serial commands for forward and reverse, but to resume in the reverse direction if power is lost. Normally you will want a 5 here, but it’s nice to know you have the option. Ok, the drive is now configured to use Modbus RTU for its commands when in REMOTE mode. Finally, these are the values I entered for my motor, yours will probably be different, of course. If we go to parameter 680 we can see the device status and if I switch the local remote switch, sure enough, the switch is changing the drive between modes, so we must have configured it correctly. Perfect. Ok, well, there are only two things you need to know to talk to the drive via Modbus RTU. First, to control the drive your controller needs to write to parameter 682 and set or clear the appropriate bits. For example, to run the motor in reverse, you would set the run bit, the enable, clear the forward bit and write the result to Parameter 682. Second, to read and write any parameter in the drive, all you have to remember is the parameter number IS the Modbus address offset. Depending on your controller, you may need to add the base address and/or the plus one yourself. We’ll have to do both of those in the CLICK PLC so let’s bring up a little four rung program I threw together to demonstrate Modus communications. On the rising edge of C1 we send the contents of register DS1 to slave 1 using the single register write, to this address which is parameter 682 plus the ModBus base address and the plus one we need. How did I know to use 400000 for the base address? Easy, I just looked it up in the Help file. For an 06 register write I need the 400,000 range starting at ONE, not Zero – which is what told me I needed that plus one to shift the WEG parameters into this range because the WEG parameters start at 0. So, to command the drive to run, we just set the appropriate bits in DS1 - which I listed here for quick reference - and toggle the C1 contact. To reverse direction, clear bit 2 and toggle C1 again. That’s all there is to commanding the drive. I added an identical instruction except it sends register DS2 which I have preformatted with a stop command so I can quickly stop the drive by toggling C2 without having to remember which bits to set. Toggling C3 is identical except it sends a new drive frequency in DS3 to parameter 683. And the last rung reads the drive status register when we toggle C4. These are all of the bit definitions for the status register. I created a data view to make it easy to see what’s going on. These are the control bits, the data registers and the error bits. I connected to the PLC, transferred the program and the PLC is currently running. Ok. Let’s switch the drive over to remote mode so it can accept our Modbus messages. Let’s send a run command. That is, we want to RUN, with the drive enabled, in the forward direction, so we want to send a 7 which I’ll put in register DS1 and write the value to the PLC. Now we toggle C1 to issue the run command we stored in DS1 and we see the motor start to turn at the default min frequency. To change that to reverse we want to RUN, with the drive enabled, in the reverse direction, so we put a 3 in DS1, write that value out to the PLC and toggle C1. And sure enough the motor ramps down and then ramps back up in the opposite direction. To change the motor speed, we just put the frequency we want here – BUT – it’s important to remember this isn’t a frequency number like 33 Hz. Instead it’s a number in this range. Where 0 to 60Hz corresponds to this range or this in hex. So a quarter of the 60 Hz – which is 15 Hz – would be a quarter of this. So, to get 15 Hz we would put a 2047 here. But, just to remind us this isn’t a direct frequency number, I’m going to change this to a hex format and enter that number in hex to get the 15 Hz and update the value to the PLC. I’m also using hex because if you look at the drive frequency in parameter 681 on the LCD display, it shows up in hex – another reminder that this isn’t a direct frequency number. So now when we issue the change frequency command it takes the value in DS3 and sends it to the motor and we see the motor ramp up to 15 Hz. A negative number will reverse the direction. So, the good news is you can easily change the frequency of the drive via Modbus. The bad news is you will have to scale it to the correct number before sending it. Finally, let’s take a look at the drive status by watching DS4 and toggling the get status bit. This is easier to view in hex, so I’ll switch that. 1302 looks like this in binary so we see that we are in remote mode, we are running in the in this direction – forward and reverse is relative to your setup of course - the drive output is enabled, the motor is running, and we don’t care about these bits. I’ve already created the STOP command, so we just toggle the STOP command to stop the motor and it ramps down to zero. Now if we toggle the status bit we see this which says we are in remote mode and the drive is enabled, but it is not running. So, given those couple examples, you should now be able to read and write any register you want in the drive and command the drive all via Modbus. By the way, I got all of this from the WEG Modbus manual, so be sure to check that out if you need more details. In particular, if you get a Modbus error, the manual tells you what each error is. Click here to see all of the videos in this series. Click here to subscribe to our YouTube channel so you will be notified when we publish new videos and click here to learn about all of AutomationDirect’s free award-winning support options.
Voted #1 mid-sized employer in Atlanta
Check out our job openings