Trying out the ExpEYES science and experimentation kit

Using the Python Library

It is very easy to use the ExpEYES Python library without any need for the GUI. While this is a bit more challenging than using the GUI, it allows a lot more versatility and enables you to use ExpEYES in your other programs, such as remote monitoring applications and a wide range of alternative applications.

In this example, I am using Python in an LXTerminal session; however, you can use this same code in any Python program. To load the ExpEYES library, all you need to do is import the library and then establish a connection to the ExpEYES device using the following two lines of code:

import expeyes.eyesj
p=expeyes.eyesj.open()

If you get an error message, check the connections and make sure that no other programs are already using ExpEYES: Only one program can access it at any one time. This next simple bit of code will allow you to measure the stray capacitance of the input socket IN1:

p.measure.cap()

You should see a result between 30 and 35pF printed in the terminal window. Now I'll play with some more digital input and output features. To test these features, you need to connect port OD1 to IN1 with a single piece of wire and connect SINE to A1 with another piece of wire, as shown in Figure 11.

Figure 11: Preparing to test digital input and output features.

Now in the LXTerminal window, type the following code:

p.set_state(10,1)
print p.get_state(3)

This code should set port OD1 to a logic high and should then print the status of IN1 to the screen. After the second line of code, the output state, 1, should be printed. Now I can try to generate and measure some voltages with the code:

print p.set_voltage(2.5)
print p.get_voltage(1)

This code will set the voltage to 2.5V to within 2 to 3mV; however, because the A1 input is connected to the SINE output, the generated voltage is a sine wave (and is therefore varying periodically). This means that the print command will give you a different result every time you execute it. Therefore, a much better idea is to monitor this output over a long period of time and plot it as a graph. You can monitor the output with the following code:

from pylab import *
ion()     # set pylab interactive mode
t,v = p.capture (1,300,100)
(plot t,v)

This code will sample the voltage on A1 300 times with a time delay between each consecutive reading of 100µsec. Each data point that is taken using this functionality is 1 byte in size, and the number of samples you are able to take is limited by the amount of RAM on the ExpEYES hardware to 1,800 readings.

Conclusion

I think it is fair to say that the ExpEYES Junior and accompanying components form an incredible kit for anyone looking to learn more about electronics, physics, and many other fields of science. I really have covered just a fraction of the experiments that this kit is capable of, and if you have enjoyed this article, I would strongly encourage you not only to purchase a kit but also to take a look at the full manual [7] and the accompanying website [1]. The potential for more experiments not listed either on the website or in the user manual really is huge, and this variety is what makes the ExpEYES Junior kit so great.

Personally, I think even the full version of the abbreviated name ExpEYES (Experiments for Young Engineers and Scientists) sells the kit a little bit short, in that it would be a useful edition to pretty much anyone's toolkit, not just young people in education. I am even more astonished now (since I have given it a good test drive) that this kit is not far more popular than it currently seems to be, and I hope this article will at the very least inspire some of you to purchase one and have a play! Please keep me posted with your progress either directly using my contact details [8], or via the Raspberry Pi Geek Facebook page [9].

Units

V volt Voltage

H henry Inductance

A ampere Current

Hz hertz Frequency

F farad Capacitance

Ohm ohm Resistance

Acknowledgement

This article was written in partnership with The MagPi magazine: http://www.themagpi.com

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content