ExpEYES/C2/Communicating-to-ExpEYES-using-Python/English-timed
From Script | Spoken-Tutorial
Revision as of 17:19, 12 May 2016 by Sandhya.np14 (Talk | contribs)
Time | Narration |
00:01 | Hello everyone. Welcome to this tutorial on Communicating to ExpEYES using Python. |
00:07 | In this tutorial, we will learn:
|
00:22 | * Measure capacitance and resistance using Plot window & Python
|
00:34 | Here I am using,
|
00:43 | To follow this tutorial, you should be familiar with:
|
00:52 | If not, for relevant tutorials, please visit our website. |
00:56 | Let's begin with the introduction to Python. |
01:00 | Python is simple and easy to learn powerful programming language.
|
01:15 | Let's make sure that Python is installed on our system. |
01:18 | Press CTRL+ ALT and T keys to open the Terminal. |
01:22 | To start Python interpreter, type: "python" and press Enter. Details regarding default version of Python will be displayed on the Terminal. |
01:36 | The displayed three angle brackets indicate Python prompt(>>>). Now you are ready to type commands. |
01:44 | For more details about Python programming, please visit our website. |
01:49 | I will discuss about the channels on the top Panel of the device. |
01:54 | On the top Panel, each terminal is assigned to a specific channel number. |
02:00 | For example- channel 1 is assigned to A1 and channel 2 to A2. |
02:07 | I will show how to connect wires to the device. |
02:11 | Device has screw terminals on either side. |
02:15 | To make the connection, we insert wires into the terminals and tighten the screws. Here A2 is connected to SINE. |
02:22 | This is the circuit diagram. |
02:28 | Let's perform an experiment to measure the voltage of A2 and show its Sine wave. |
02:36 | Let's see the result on the Plot window. |
02:39 | On the Plot window, click on A2 to display the voltage of A2. Voltage of A2 is displayed below. |
02:48 | Click on A2 and drag to channel CH1. When we drag A2 to CH1, input data of A2 is assigned to CH1. |
02:59 | Move the msec/div slider to show the Sine wave. Click on A2 to show change in voltages of A2. |
03:09 | Click on CH1 and drag to FIT. The voltage and frequency of A2 are displayed on the right. |
03:16 | We will perform the same experiment and measure voltage of A2 using Python. |
03:23 | Please note, to avoid errors on Python interpreter:
|
03:31 | To import eyes library from ExpEYES, type at the prompt "import expeyes.eyesj". Press Enter. |
03:40 | Type: p=expeyes.eyesj.open() and press Enter. open() function returns an object if hardware is found. |
03:53 | These lines will load the ExpEYES library and establish connection to the device. |
03:58 | To view the voltage of A2, type: "print p.get_voltage within brackets 2" and press Enter. |
04:08 | Output shows voltage of A2. Similarly, we can show the various voltages of A2. |
04:15 | Voltage of A2 changes as it is an AC voltage. |
04:20 | To generate plots using Python interpreter,
install python-matplotlib library using Synaptic Package Manager. |
04:30 | I have already installed python-matplotlib library on my system. |
04:36 | To generate plots on Windows Operating system: |
04:40 | Download and install,
|
04:49 | Copy the installed ExpEYES files and drivers and paste in C drive. |
04:55 | To generate Sine wave, at the python prompt, type: "import expeyes.eyesj" and press Enter. |
05:05 | Type p=expeyes.eyesj.open() and press Enter as before. |
05:12 | Type: from pylab import *(asterisk). from pylab import * is a program from matplotlib library. Press Enter. |
05:26 | Type: ion(). This command sets pylab interactive mode.
Press Enter. |
05:35 | Type: t,v=p.capture within brackets 2,200,100.
"t", "v" are time and voltage vectors. |
05:50 | 2 is channel number for A2, 200 is the number of data points, 100 is a time interval between subsequent measurements. |
06:02 | Press Enter. |
06:04 | To view the output, type: plot within brackets t,v. plot within brackets t,v generates a Sine wave on a new window. |
06:15 | Press Enter. |
06:18 | We can generate a Sine wave using the above commands on Windows command prompt as well. |
06:26 | Next, let's measure voltage of A1 using a battery as an external voltage source. |
06:32 | To measure external voltage source, Ground(GND) is connected to A1 through a battery of 3V. |
06:39 | This is the circuit diagram. We will show the value of A1 using Python interpreter. |
06:46 | At the python prompt:
Type: "import expeyes.eyesj", press Enter. |
06:53 | Type: p=expeyes.eyesj.open(), and press Enter. |
06:59 | Type: print p.get_voltage within brackets 1 and pressEnter. |
07:07 | Here, Channel 1 is assigned to A1. Voltage of A1 is displayed on the terminal. |
07:14 | Let's measure voltage of A1 using PVS as internal voltage source. |
07:20 | In this experiment, PVS is connected to A1. |
07:24 | This is the circuit diagram. |
07:28 | Back to the terminal. Type: print p.set_voltage within brackets 3 and press Enter. |
07:39 | Here, voltage of PVS will be set to 3 volts. Voltage of PVS is displayed. |
07:47 | Type: "print p.get_voltage(1)" and press Enter. voltage of A1 is displayed on the terminal. |
07:45 | Now, I will demonstrate AC and DC components of a voltage using capacitor and resistor. And also, generate a square wave. |
08:11 | In this experiment,
|
08:25 | This is the circuit diagram. |
08:27 | Let's see the result on the Plot window. |
08:31 | On the Plot window, click on Measure C on IN1 button. |
08:36 | Capacitance of IN1 is displayed as -0.6 pF (pico farads). |
08:42 | Click on Measure R on SEN button. Resistance of SEN is displayed as 560 Ω(ohms). |
08:51 | Please note you may get slightly different values of Capacitance & Resistance. |
08:57 | Click on SQ1 and drag to CH1.
SQ1 is assigned to channel CH1. |
09:04 | Click on A2 and drag to CH2.
A2 is assigned to channel CH2. |
09:12 | Click on SQR1 check box to show the Square waves. Move the msec/div slider to adjust the waves. |
09:23 | Click on CH2, drag to FIT. Voltage and frequency of A2 is displayed on the right side. |
09:32 | We will perform the same experiment to measure Capacitance, Resistance and generate a Square wave using Python interpreter. |
09:41 | At the python prompt, type: "import expeyes.eyesj" and press Enter. |
09:50 | Type: p=expeyes.eyesj.open() and press Enter. |
09:58 | To display the Capacitance value, type: p.measure_cap( ) and press Enter. |
10:07 | Capacitance value is displayed on the terminal. |
10:11 | To display the Resistance value, type: p.measure_res() and press Enter.
Resistance value is displayed on the terminal. |
10:24 | To generate a Square wave, type: from pylab import *(asterisk) and press Enter.
Type: ion() and press Enter. |
10:36 | Type: print p.set_sqr1 within brackets 100 and press Enter. Here 100 is the frequency of the square wave. |
10:49 | Type: t,v=p.capture within brackets 6,400,100 and press Enter. |
11:00 | Type: plot within brackets t,v. plot within brackets t,v generates a square wave on a new window. |
11:12 | Press Enter. |
11:14 | Let's summarize. |
11:17 | In this tutorial, we have learnt:
|
11:33 | Measure capacitance & resistance using Plot window & Python
|
11:45 | As an assignment,
|
11:56 | Show circuit diagrams for the above experiment. |
11:59 | This video summarizes the Spoken Tutorial project. If you do not have good bandwidth, you can download and watch it. |
12:07 | We conduct workshops using Spoken Tutorials and give certificates. Please contact us. |
12:13 | The Spoken Tutorial Project is funded by NMEICT, MHRD Government of India. |
12:20 | This tutorial is contributed by Kaushik Datta and Madhuri Ganapathi.
Thank you for joining. |