Skip to main content

Python interface to Optotune focus-tunable lenses

Project description

opto is a Python module that allows you to control Optotune focus tunable lenses using the Optotune Lens Driver 4. Tested with an Optotune EL-10-30.


Opens the serial port, connects to the Optotune, sets the lens current to 50 mA, and closes the serial port, gently returning the lens to 0 mA current:

from opto import Opto

o = Opto(port='/dev/cu.usbmodem1411')

Alternatively, here we use the with statement to create a sinusoidal transition from minimum to maximum current and back:

from opto import Opto
import numpy as np
import time

with Opto(port='/dev/cu.usbmodem1411') as o:
    current_low = o.current_lower()
    current_high = o.current_upper()
    current_delta = current_high-current_low
    for i in np.linspace(0, 2*np.pi, 1000):


Use pip to install from github:

pip install git+

or clone the package using git:

git clone


Requires pySerial

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opto-0.1.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

opto-0.1-py2.py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page