How to use NI ELVIS III with Python

Publish Date: Oct 09, 2018 | 1 Ratings | 5.00 out of 5 | Print | Submit your review

Overview

In this document, we will walk you through the setup, transfer of files, and the use of a Python program on NI ELVIS III. The NI ELVIS III solution for project-based learning can be programmed with python to help students or educators who are familiar with Python syntax to rapidly acquire measurements using common SSH clients. Attached there are a total of 18 examples included which illustrate the use of the NI ELVIS III helper library, various IO types, and the ability to record data in CSV files. The purpose of these examples is to introduce you to how to setup NI ELVIS to be programmed with Python, and act as a starting point for anyone to leverage Python as needed for acquisition.

Table of Contents

  1. Software Setup
  2. Installing NI ELVIS III Python Examples
  3. Running the Python Examples
  4. Exploring the API, Examples, and Additional Information

1. Software Setup

Configuring the NI ELVIS III Device

In this section we will install the software needed to communicate to the NI ELVIS III.

  1. Install the NI Measurement Live Support Files
  2. Connect the NI ELVIS III to the Internet using the Ethernet Port or Wifi so that the Python libraries can be installed from the Internet.
  3. Enable the Secure Shell Server on the NI ELVIS III
  • Open Internet Explorer and visit the NI ELVIS III Configuration website: <IP Address of the NI ELVIS III>/WIF.html

url.png

Note: The IP Address can be found on the display of the NI ELVIS III. Press BUTTON 0 until the IP address appears. Enter the IP address from the display.

  • Navigate to the Home tab at the left of the page if not already there
  • Enable the Secure Shell Server (sshd) checkbox in the Startup Settings section.

  • Click Save

4. Set up Time Configuration on the NI ELVIS III configuration website

  • Click on the tab at the left of the page.
  • Configure the Date, Current time, and Time Zone to your current local time.

  • Click Save
  • Restart the device

Installing Prerequisite Python Software for NI ELVIS III

1. Install and open your favorite SSH client. If you do not have one, we recommend PuTTY

  • Configure PuTTY or another client as follows:

 

Host Name: <The IP Address found at the top of the NI ELVIS III on the Display.>

Port: 22

Connection Type: SSH

6. Click the Open button. Note: Sometimes the SSH client will alert a Potential Security Breach due to a key mismatch. Simply click Yes to proceed the change it detected is expected.

Once the connection opens Log In as:

Username: admin

Password: <blank> (Just hit enter, there is no password by default)

7. Run the following Commands

opkg update

opkg install python

opkg install python-pip

pip install nifpga

pip install pyvisa

    

Back to Top

2. Installing NI ELVIS III Python Examples

1. Open PuTTY, connect to NI ELVIS III as done in the previous step, and install git on the NI ELVIS III by running the following command:

opkg install git

2. Download the NI ELVIS III Python helper livrary and Python Examples from GitHub by running the following command

git clone https://github.com/ni/NI-ELVIS-III-Python-Examples.git

NI ELVIS III Python examples can now be found in the /home/admin directory on NI ELVIS III

(Option 2) Installing NI ELVIS III Python Examples from a ZIP file

Prefer to download a ZIP of the NI ELVIS III Python examples and move it using SFTP to the NI ELVIS? Follow this link for instructions.

 

Back to Top

3. Running the Python Examples

1. Open a PuTTY session to the NI ELVIS III and change the directory to the NI ELVIS III Python examples:

cd /home/admin/NI-ELVIS-III-Python-Examples/

2. Run an example by typing the following command:

python examples/<example_category>/<example_filename>.py

Where <example_category> is the category of example such as Analog, Bus, Digital, or Interrupt and the <example_filename> is the name of the specific example. For example:

python examples/analog/AI_singleChannel.py

 

The examples available for NI ELVIS in Python include:

 

Analog

 

AI_configurationOptions
AI_multipleChannels
AI_singleChannel
AO_multipleChannels
AO_singleChannel

Bus

Encoder
I2C
SPI
UART

Digital

Button
DIO_multipleChannels
DIO_singleChannel
LED
PWM

Interrupt


AIIRQ (Analog Interrupt)
ButtonIRQ (Button Interrupt)
DIIRQ (Digital Interrupt)
TimerIRQ (Timer Interrupt)

 

Back to Top

4. Exploring the API, Examples, and Additional Information

For more information about programming NI ELVIS III in Python or to dive into the code, visit our GitHub page.

 

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit