Difference between revisions of "ExpEYES/C2/Communicating-to-ExpEYES-using-Python/English"
Nancyvarkey (Talk | contribs) |
Nancyvarkey (Talk | contribs) |
||
Line 26: | Line 26: | ||
* Measure external and internal voltages using '''Python''' | * Measure external and internal voltages using '''Python''' | ||
− | * Measure capacitance & resistance using Plot window & '''Python''' | + | * Measure '''capacitance''' & '''resistance''' using Plot window & '''Python''' |
* Generate a '''Square wave''' | * Generate a '''Square wave''' | ||
Line 41: | Line 41: | ||
* Measure external and internal voltages using '''Python''' | * Measure external and internal voltages using '''Python''' | ||
− | * Measure capacitance and resistance using Plot window & '''Python''' | + | * Measure '''capacitance''' and '''resistance''' using Plot window & '''Python''' |
* Generate a '''Square wave''' | * Generate a '''Square wave''' |
Revision as of 09:17, 7 August 2015
Visual Cue | Narration |
Slide Number 1
Title Slide |
Hello everyone.
Welcome to this tutorial on Communicating to ExpEYES using Python. |
Slide Number 2+3
Learning Objectives We will learn about,
|
In this tutorial we will learn:
|
Slide Number 4
System Requirement
|
Here I am using,
|
Slide Number 5
Pre-requisties You should be familiar with: ExpEYES junior interface. For relevant tutorials, visit our website. www.spoken-tutorial.org. |
To follow this tutorial, you should be familiar with:
ExpEYES Junior interface. Basic Python programming. If not, for relevant tutorials, please visit our website. |
Let's begin with introduction to Python. | |
Slide Number 6
Introduction to Python
|
|
Let's make sure that Python is installed on our system. | |
Press CTRL+ ALT and T keys. | Press CTRL+ ALT and T keys to open the Terminal. |
Type python, press Enter.
Point to the default version of Python |
To start Python interpreter type python and press Enter.
Details regarding default version of Python will be displayed on the Terminal. |
Point to the angle brackets. | The displayed three angle brackets indicate Python prompt(>>>).
Now you are ready to type commands. |
Slide Number 7
Details About Python For more details about Python programming www.spoken-tutorial.org. |
For more details about Python programming, please visit our website. |
I will discuss about the channels on the top Panel of the device. | |
Point to the top Panel | On the top Panel each terminal is assigned to a specific channel number. |
Point to A1
Point to A2 |
For example channel 1 is assigned to A1 and channel 2 to A2. |
Point to the device. | I will show how to connect wires to the device. |
Point to the screw terminals. | Device has screw terminals on either side. |
Point to the screw terminals.
|
To make the connection, we insert wires into the terminals and tighten the screws.
Here A2 is connected to SINE. |
Point to the circuit diagram. | This is the circuit diagram. |
Slide Number 8
To measure voltage of A2 and show its Sine wave' |
Let's perform an experiment to measure the voltage of A2 and show its Sine wave. |
Let's see the result on the Plot window. | |
Point to A2.
Point to voltage. |
On the Plot window, click on A2 to display the voltage of A2.
Voltage of A2 is displayed below. |
Click on A2, drag to channel CH1. | Click on A2 and drag to channel CH1
|
Move msec/div slider to show the Sine wave.
Click on A2, show changing voltage of A2. |
Move the msec/div slider to show the Sine wave.
Click on A2 to show change in voltages of A2. |
Click on CH1, drag to FIT.
Point to voltage. |
Click on CH1 and drag to FIT.
The voltage and frequency of A2 are displayed on the right. |
We will perform the same experiment and measure voltage of A2 using Python. | |
Slide Number 9
Note To avoid errors on the Python interpretor:
|
Please note to avoid errors on Python interpreter:
|
Type at the prompt:
import expeyes.eyesj press Enter. |
To import “eyes” library from ExpEYES, type at the prompt:
import expeyes.eyesj press Enter. |
Type at the prompt:
import expeyes.eyesj press Enter. Point to open() function Point to the lines |
Type p=expeyes.eyesj.open() and press Enter.
open() function returns an object if hardware is found. These lines will load the ExpEYES library and establish connection to the device. |
Type print p.get_voltage(2).
Point to voltage. Point to voltages. |
To view the voltage of A2, type
print p.get_voltage within brackets 2 and press Enter. Output shows voltage of A2 Similarly, we can show the various voltages of A2.
|
Slide Number 10
Install To generate plots using Python interpreter: Install python-matplotlib library using Synaptic Package Manager. |
To generate plots using Python interpreter:
Install python-matplotlib library using Synaptic Package Manager. I have already installed python-matplotlib library on my system. |
Slide Number 11
Install To generate plots on Windows OS: Download and install,
Copy the installed ExpEYES files and drivers and paste in C drive. |
To generate plots on Windows Operating system:
Download and install,
Copy the installed ExpEYES files and drivers and paste in C drive. |
Type import expeyes.eyesj, press Enter.
Type p=expeyes.eyesj.open(), press Enter. |
To generate Sine wave, at the python prompt,
Type import expeyes.eyesj and press Enter. Type p=expeyes.eyesj.open() and press Enter as before. |
Type from pylab import *(asterisk), press Enter.
Point to from pylab import * |
Type from pylab import *(asterisk).
from pylab import * is a program from matplotlib library. Press Enter. |
Type ion(), press Enter.
Point to ion() |
Type ion()
This command sets pylab interactive mode. Press Enter. |
Type t,v=p.capture(2,200,100), press Enter.
Point to “t,v Point to “2”, Point to “200” Point to “100” |
Type t,v=p.capture within brackets 2,200,100.
“t,v are time and voltage vectors. “2” is channel number for A2, “200” is the number of data points, “100” is a time interval between subsequent measurements. Press Enter |
type plot(t,v), press Enter.
Point to Sine wave. |
To view the output, type plot within brackets t,v
plot within brackets t,v generates a Sine wave on a new window. Press Enter. |
Show the screen. | We can generate a Sine wave, using the above commands on Windows command prompt, as well. |
Slide Number 12
External Voltage Measure voltage of A1 using a battery as an external voltage source. |
Next, let's measure voltage of A1 using a battery as an external voltage source. |
Show the circuit diagram | To measure external voltage source, Ground(GND) is connected to A1 through a battery of 3V. |
Circuit diagram image | This is the circuit diagram.
We will show the value of A1 using Python interpreter. |
At the python prompt:
Type import expeyes.eyesj, press Enter. Type p=expeyes.eyesj.open(), press Enter. |
At the python prompt:
Type import expeyes.eyesj, and press Enter. Type p=expeyes.eyesj.open(), and press Enter. |
Type print p.get_voltage(1), and press Enter.
Point to channel1. Point to voltage of A1. |
Type print p.get_voltage within brackets 1 and press
Enter. Here Channel 1 is assigned to A1. Voltage of A1 is displayed on the terminal. |
Slide Number 13
Internal Voltage Measure voltage of A1 using PVS as internal voltage source. |
let's measure voltage of A1 using PVS as internal voltage source. |
Show the circuit diagram. | In this experiment PVS is connected to A1.
|
Show circuit diagram | This is the circuit diagram. |
Type print p.set_voltage(3), press Enter.
Point to value of PVS. Point to voltage. |
Back to the terminal.
Type print p.set_voltage within brackets 3 and press Enter. Here voltage of PVS will be set to 3 volts. Voltage of PVS is displayed. |
Type print p.get_voltage(1), press Enter.
Point to voltage. |
Type print p.get_voltage within brackets 1 and press Enter.
Voltage of A1 is displayed on the terminal. |
Slide Number 14
AC and DC components of a voltage using a capacitor & resistor and generate a square wave. |
Now I will demonstrate AC and DC components of a voltage using capacitor and resistor.
And also 'generate a square wave. |
Show the picture.
Show the circuit diagram. |
In this experiment
|
Show the circuit diagram. | This is the circuit diagram. |
Let's see the result on the Plot window | |
Point to the Plot window.
Click on Measure C on IN1 button. Point to Capacitance. |
On the Plot window click on Measure C on IN1 button.
Capacitance of IN1 is displayed as -0.6pF(pico farads). |
Click on Measure R on SEN button.
Point to the Resistance value of SEN. |
Click on Measure R on SEN button.
Resistance of SEN is displayed as 560Ω(ohms)
|
Click on SQ1, drag to CH1.
Point to assigned value. |
Click on SQ1 and drag to CH1.
SQ1 is assigned to channel CH1. |
Click on A2, drag to CH2.
Point to assigned value. |
Click on A2 and drag to CH2.
A2 is assigned to channel CH2. |
Click on SQR1 check box.
Move the msec/div slider. |
Click on SQR1 check box to show the Square waves.
Move the msec/div slider to adjust the waves. |
Click on CH2, drag to FIT.
|
Click on CH2 and drag to FIT.
Voltage and frequency of A2 is displayed on the right side. |
Slide Number 15
Measure Capacitance, Resistance and generate a Square wave using Python interpreter. |
We will perform the same experiment to:
|
At the python prompt:
Type import expeyes.eyesj, press Enter. Type p=expeyes.eyesj.open(), press Enter. |
At the python prompt:
Type import expeyes.eyesj and press Enter. Type p=expeyes.eyesj.open() and press Enter. |
Type p.measure_cap(), press Enter.
Point to displayed capacitance value |
To display the Capacitance value:
Type p.measure_cap( ) and press Enter. Capacitance value is displayed on the terminal. |
Type p.measure_res(), press Enter. | To display the Resistance value:
Type p.measure_res() and press Enter. Resistance value is displayed on the terminal. |
Type from pylab import *, press Enter.
|
To generate a Square wave:
Type from pylab import *(asterisk) and press Enter.
|
Type print p.set_sqr1(100), and press Enter
|
Type print p.set_sqr1 within brackets 100 and press Enter.
Here 100 is the frequency of the square wave. Type t,v=p.capture within brackets 6,400,100 and press Enter. |
Type plot(t,v) and press Enter.
Point to generated square wave. |
Type plot within brackets t,v.
plot within brackets t,v generates a square wave on a new window. Press Enter. |
Let's summarize. | |
Slide Number 16
Summary We have learnt:
|
|
Slide Number 17
As an assignment, Measure the resistance of your finger using Plot window. Using python, generate a combination of Sine and Square waves. Show circuit diagrams for the above experiment. |
As an assignment,
Measure the resistance of your finger using Plot window. Using python, generate a combination of Sine and Square waves. Show circuit diagrams for the above experiment. |
Slide Number 18
Acknowledgement Watch the video available at /What is a Spoken Tutorial It summarises the Spoken Tutorial project. If you do not have good bandwidth, you can download and watch it. |
|
Slide Number 19
The Spoken Tutorial Project Team Conducts workshops using spoken tutorials Gives certificates to those who pass an online test For more details, please write to contact@spoken-tutorial.org |
* We conduct workshops using SpokenTutorials and give certificates.
|
Slide number 20
Spoken Tutorial Project is a part of the Talk to a Teacher project It is supported by the National Mission on Education through ICT, MHRD, Government of India More information on this Mission is available at /NMEICT-Intro |
The Spoken Tutorial Project is funded by NMEICT, MHRD Government of India. |
This tutorial is contributed by Kaushik Datta and Madhuri Ganapathi..
Thank you for joining. |