10.Adding Nobs to the Analog Discovery 2 Using LabVIEW

FQF3YI7ITKLMC27.LARGE

Things Used In This Project

Hardware components:

  • Digilent Analog Discovery 2
  • Digilent chipKIT WF32: WiFi Enabled Microntroller Board
  • Digilent Pmod ENC

Software apps and online services:

  • Digilent WaveForms 2015
  • Arduino IDE
  • Digilent LabVIEW Home Bundle
  • Digilent LINX

Introduction
In our project, we used LabVIEW 2014 to interface with 3 Pmod ENC's connected to a WF32 to control a LabVIEW project we made called LabForms. This project lets you access the analog scope and wavegen functionalities of the Analog Discovery through LabVIEW. The LabVIEW code uses the LabVIEW driver for the Analog Discovery 2. Refer to tutorial " Analog Discovery 2 USB Oscilloscope + LabVIEW(2016 update)" where we walk through the Labforms user interface, the goal of the project was to create a project similar to Digilent Waveforms in LabVIEW. While the basic version of LabForms works for all versions of LabVIEW after 2014 this particular project only works with LabVIEW 2014.

IMG_8338-600x450

Many people prefer using physical knobs to configure a scope rather than using a mouse. In this project, We will show you how we used Pmod ENC's and LabVIEW to add physical knobs to the Analog Discovery 2. With these knobs you will be able to control the sample rate, base, range, and offset of both of your scopes.

Step 1: Materials

FO6VCR2ITKJ965A.LARGE
Hardware

  • Analog Discovery 2 USB Oscilloscope
  • 3 PmodENC: Rotary Encoders
  • chipKIT WF32

Software

NOTE: Installing LabVIEW requires you create an NI account. Your LabVIEW installation and any NI software keys you use will be tied to this account.

Step 2: Software Setup

FUIHYLYITKJ99G3.LARGE

Install LabVIEW

Step 3: WF32 Setup

F60E1TQITKJ9A5Z.LARGE

Once you have Arduino IDE downloaded you will need to install the chipKIT core. The chipKIT core is a plugin for Arduino-style development environments. It contains all the files you need to start programming a chipKIT™ board with the well-known Arduino API

FEL1WE3II21OOGP.MEDIUM

Refer to this tutorial "How to Install chipKIT Core" before continuing, it will walk you through this process.

Step 4: Firmware Setup

FY08YU2ITKJ9ABW.LARGE

FTAXEV3ITKJ9ADK.ino

Step 5: WF32 Circuit Setup

FQH5LRLITKJ955Y.LARGE

First, place the Pmod ENC in the center of the breadboard. Then, connect the 3.3V pin on the WF32 to the positive bus on one side of your breadboard and then connect the negative bus on the same side to the ground(GND) pin. Next run a wire from the voltage bus to the far right pin of each of the Pmod ENC's and then run a wire from the ground bus to the pin directly to the left of that pin.

Pin-Diagram-cropped-600x375

Next, place the slide switch on your breadboard, run a wire from your voltage bus to it's left outside pin. Then use a 240 Kohm resistor to connect the right outside pin to ground and then connect the center pin to digital pin 3.

Screen-Shot-2016-09-27-at-2.34.11-PM-600x393

Finally, connect digital pin 2 to the BTN pin of the first Pmod ENC, do the same with pin 7 for the second Pmod ENC and then pin 8 for the last Pmod ENC. Then connect Pin A, B and SWT of each Pmod ENC to digital pins on the WF32.

Pmod_ENC_top_600__04858.1449265145.1280.1280

Step 6: AD2 Setup

FRAIGATITKJ964B.LARGE

FVD74WXISCBO20E.MEDIUM

  • Using some of the jumper pins supplied with the Analog Discovery to connect the Scope Channel 1 Positive (Orange Wire labeled “1+” ) to Waveform Generator 1 Positive (Yellow Wire labeled “W1”).
  • Next, attach Scope Channel 2 Positive (Blue Wire labeled “2+” ) to Waveform Generator 2 Positive (Yellow and White Wire labeled “W2”).
  • Attach Scope Channel 1 Negative(Orange and White Wire Labeled "1-") and Scope Channel 2 Negative (Blue and White Wire Labeled "2-") to the 2 ground wires(Black wires labeled with a downward arrow).
  • Plug the Analog Discovery into one of your PC’s USB port.
    Note: It is important you plug the Analog Discovery into your PCs USB port before you proceed to the next step.

Step 7: LabVIEW Setup

FYTYBKXITKJCZ8P.LARGE

First, download and unzip and open the PmodENC_project zip file attached below. Once it is open you will see that this LabVIEW code is set up for up to 3 Pmod ENC's. In this project, we use three encoders so you will want to set the number of encoders to 3. The delay is used to debounce the encoder, I have found that 50ms works best. The momentum value is used to prevent bouncing from affecting your results, it is best to set this value to 2. Input your pin Values for the DO channels connected to the A, B and Switch pins of each of your Pmods.

FBTHUS8ITKJD5GI.zip

Step 8: Using Labforms
FGJ1YEOITKJ9BVV.LARGE

One of the knobs controls time, if it's switch is to the left it will adjust the sample rate and if its switch is to the right it adjusts the base.

Screen-Shot-2016-09-29-at-1.02.43-PM-2

The next knob controls offset, if its switch it to the left it controls offset for Channel 1 and if its switch is to the right it controls offset for Channel 2

Screen-Shot-2016-09-29-at-1.03.06-PM

The final knob controls range, if its switch it to the left it controls range for Channel 1 and if its switch is to the right it controls range for Channel 2

Screen-Shot-2016-09-29-at-1.03.18-PM

Each Pmod ENC has an integral push button in the encoder shaft. This button toggles between "standard" and "fine" adjustment modes. In standard adjustment mode, when the encoder shaft is rotated it scrolls through the list of preset options in that specific field.

Screen-Shot-2016-09-29-at-1.03.53-PM

When you switch to fine mode you will be able to make finer adjustments. If you select the settings tab you can select the size of the fine modes increment.

Screen-Shot-2016-09-29-at-1.01.31-PM-600x113

Since sample rate was set to 50 MHz (5E+7 Hz) and its increment was set to a tenth of that value, one click to the right will increase the value 5 MHz (5E+6 Hz) to 55 MHz (5.5E+7).

Screen-Shot-2016-09-29-at-1.13.01-PM

** Step 9: The End**

FPDBHUYITKJ9IGT.LARGE