How-To: Acquiring Images From IP Cameras with NI CompactRIO and NI Single-Board RIO
Overview
This document discusses the use of NI CompactRIO hardware as a machine vision platform and provides a tutorial for adding machine vision to your CompactRIO application. For installation and configuration of the moviMED AF-1501 C Series module see Vision on CompactRIO using the MoviMED AF-1501 C Series analog frame grabber.
Table of Contents
Introduction
The NI CompactRIO programmable automation controller (PAC) is an advanced embedded control and data acquisition system designed for applications that require high performance and reliability. With the system's open and embedded architecture, small size, extreme ruggedness, and flexibility, you can use commercial off-the-shelf (COTS) hardware to quickly build custom embedded systems.
When combined with the NI Vision Development Module 2009 or later, CompactRIO is an effective platform for embedded and industrial, real-time machine vision applications. Potential use areas include autonomous robotics, medical devices, industrial monitoring applications, and embedded applications. You can choose from two options for image acquisition on CompactRIO systems: (1) IP cameras through NI Vision Acquisition Software, and (2) analog cameras through the AF-1501 C Series module made by moviMED custom imaging solutions.
This article covers the installation and configuration of IP cameras on CompactRIO. For installation and configuration of the moviMED AF-1501 C Series module, see Vision on CompactRIO using the moviMED AF-1501 C Series analog frame grabber.
Setting Up CompactRIO
To install the proper software on CompactRIO hardware, you must first install it on the host PC. The two necessary components are NI Vision 9.0 and NI-IMAQdx 3.4 driver software. You can verify this software in Measurement & Automation Explorer (MAX) by expanding the software tab under My System.
Once you have verified that the host PC has the correct software, you need to install that software on your CompactRIO controller so you can acquire from an IP camera. The CompactRIO controller should appear in MAX under the Remote Systems tab. Expand the target and then right-click on Software and select Add/Remove Software. This opens the LabVIEW Real-Time Software Wizard. Select Custom software installation and click Next. Select Yes to continue with the manual installation. The two required pieces of software are NI Vision RT 9.0.0 and IP Camera Support. Find IP Camera Support under NI-IMAQdx RT. Once you have selected both of these to install, click Next to begin the installation.

When you have finished installing the required software and the system has rebooted, click on CompactRIO under Remote Systems to open the Network Settings. By default, the secondary Ethernet port on the CompactRIO controller is not enabled, so you must set up your IP camera to communicate over the network. To do this, select Advanced Ethernet Settings. Once the Settings window is open, click on the secondary MAC address listed under Ethernet Devices, change the mode to TCP/IP, and set the IP address to 169.254.0.x for link local and the Subnet Mask to 255.255.0.0. When these settings match the screen shot below, click OK and Yes when prompted to reboot the system.

Setting Up the Camera
Now that you have enabled the CompactRIO controller to use the secondary Ethernet port, the IP camera appears along with MAX, which you use to configure the camera properly. Plug the camera into the secondary port on the CompactRIO controller. If the Ethernet port lights up, you have configured it properly, and the network should detect the camera.
Under the CompactRIO module in MAX, expand Devices and Interfaces and then expand NI-IMAQdx Devices, and you should see the IP camera named as camX where X is a value assigned to your camera by the driver.

At the top of the menu bar, you should be able to click Snap to obtain one still image or Grab to obtain a video from the camera.
![]()
This is also the screen where you can change the Acquisition Attributes and Camera Attributes by selecting the tabs at the bottom.
When you can see the camera in MAX and acquire an image, you can close MAX. Keep in mind the name of the IP camera to use it in LabVIEW (for example, cam1).
Setting Up LabVIEW
Now that the CompactRIO controller and the IP camera are configured properly, you need to set up the LabVIEW VI to use both pieces of hardware.
To do this, open a new project in LabVIEW by going to File»New… Then expand Project and select Empty Project. LabVIEW then creates a project named Untitled Project 1. Rename this project to Vision by selecting File»Save As and typing "Vision" into the filename.
Then right-click Project:Vision.lvproj and select New»Targets and Devices…

Expand Real-Time CompactRIO. The name of the CompactRIO controller that is using the IP camera should be listed. Select it and click OK. Select Continue — scan interface is acceptable for this application because it is not necessary to use the CompactRIO FPGA for IP cameras.
The CompactRIO controller is now listed as a target in the Vision project. To acquire from the IP camera, use an example program called Grab.vi. To add this VI to the target, right-click the CompactRIO option in the project and select Add»File… Then select the root drive where National Instruments software is installed and navigate to C:\Program Files\National Instruments\LabVIEW 2009\examples\IMAQ\IMAQdx Examples.llb\Grab.vi and click Select. Double-click on Grab.vi in the project and the front panel opens. Select the down arrow under Camera Name and choose the name that corresponds to the IP camera that was configured in MAX (for example, cam1). Clicking the Run Arrow should show a video acquired from the IP camera.

Reader Comments | Submit a comment »
Single Board RIO
Does this work with single board RIO if i
set the primary (and only) ethernet
interface to use that same ip-net?
-
Marcus Johnson,Endevo.
marcus.johnson@endevo.se
- Feb 17, 2010
To antonlr@yahoo.com.mx. This method
specifically documents how to acquire from IP
cameras (Axis and Basler IP/network cameras
are supported) and not GigE Vision cameras.
GigE Vision cameras are supported since
August 2011 on the Multicore CompactRIO
platform.
More info here:
http://zone.ni.com/devzone/cda/tut/p/id/13045
- Jan 24, 2012
Yes, as long as the camera is reachable via
IP and on the same subnet, it will work via
any network port.
- Jul 11, 2010
I can't see a basler scA640-70gc linked to crio 9024
dear ni's members,
I followed the procedure explained here
to set up a camera Basler 70gc scA640-
9024 connected to a second ethernet
port of a crio 9024 but I can not see the
camera in max. I've noticed that when I
connect the camer to 10/100/1000
ethernet port of my laptop, I can see it
from my computer using the max but
when I connect the camera to a 10/100 I
can not see the camera. I think it may be
because the camera is not working well
at 10/100 and as the second port of
crio9024 is 10/100 that's the problem.
Please if you can help me to know that I
make the cryo 9024 can communicate
with the camera.
-
antonlr@yahoo.com.mx
- Nov 27, 2011
I am using the NI robotics Starter kit.
There is only one Ethernet port. I am
using a router to expand the existing port
so that i can connect IP Axis camera. I
follow the procedure detailed in the
above document. I can see the a video in
MAX, but I get an error when I try to see
the video in LabVIEW.Can you help me
with this problem please ?
-
Fayaz Faheem,Student.
elff@lboro.ac.uk
- Jun 21, 2011
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
