Introduction: Adding Nobs to the Analog Discovery 2 Using LabVIEW
In my project, I used LabVIEW to interface with 3 Pmod ENC's connected to a WF32 to control a LabVIEW project I 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 my instructable " Analog Discovery 2 USB Oscilloscope + LabVIEW(2016 update)" where I 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.
Many people prefer using physical knobs to configure a scope rather than using a mouse. In this project, I will show you how I 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
- WaveForms version 2.6.2 or later
- LabVIEW driver for the Analog Discovery 2
- Download through VIPM
- LINX 3.0
- Arduino IDE
- chipKIT core plugin
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
Step 3: WF32 Setup
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
Refer to this instructable "How to Install chipKIT Core" before continuing, it will walk you through this process.
Step 4: Firmware Setup
Step 5: WF32 Circuit Setup
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.
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.
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.
Step 6: AD2 Setup
- 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
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.
Step 8: Using Labforms
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.
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
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
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.
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.
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).
Step 9: The End
Thank you for reading my instructable, if you are interested in making this project yourself but don't have the right supplies you can purchase the LabVIEW physical computing kit with chipKIT WF32. This kit includes a copy of LabVIEW 2014 home edition, a WF32, and everything you will need to run LINX 3.0 and start making projects. Also if you are a student the Analog Discovery 2 has an academic discount available. Please comment with any questions or comments you may have.