Yoctopuce modules: Introduction

Yoctopuce USB interface modules provide a very elegant solution to many different sensing and control problems, including measuring radiation. I have been interested in using them to acquire data directly from within R so as to be able to use the ‘r4photobiology’ suite of packages for real-time or near real time analysis and plotting of the acquired data.

The elegantly coded libraries supplied by Yoctopuce are available with interfaces in multiple computer programming and scripting languages. I have been trying different approaches to calling functions from these libraries in R scripts, but given the large number of functions needed to support the great variety of modules, writing an ad hoc interface for R was out of question. I first tried calling the command line version of the library functions from within R, but at least in Windows 10, the delay was too much and not consistent. Next I tried using the web server in the YoctoHub to send commands as http requests. This worked but it is a rather awkward approach, and not portable to accessing the modules directly through USB.

Two days ago, after reading about the ‘reticulate’ package I decided to test an approach similar to that I have used in package ‘rOmniDriver’ to access, with help from the ‘rJava’ package, Ocean Optics spectrometers through OmniDriver, a library written in Java. In the present case using ‘reticulate’ to access the Python version of the YoctoPuce library. It works extremely well, and the RStudio IDE provides in the editor even auto-completion and bubble help for functions and other objects defined in the Python library!

I have decided to describe here a few use cases for data acquisition or light source control using YoctoPuce models and R scripts. Most examples will be simple but useful, as they are real use cases rather than toy examples.

The YoctoPuce modules, hubs and the corresponding free libraries and the documentation are available at https://www.yoctopuce.com/. The ‘reticulate’ package is available through CRAN, and nicely formatted documentation can be found at https://rstudio.github.io/reticulate/. The first CRAN release of ‘reticulate’ appeared less than a year ago.


ooacquire 0.1.6

Improvements aiming at continuing the expansion of the support of different Ocean Optics spectrometers and of  additional measurement methods.

  • Update acq_irrad_interactive() adding alternative user-interface modes, allowing users to set comment and what.measured attributes, and to construct collections of spectra.
  • Add pre-built calibrations and methods for additional FLAME-S instruments.
  • Improve algorithm for automatic tuning of integration time to achieve faster convergence.
  • Fix various minor bugs.
  • Update vignettes.
  • Test against OmniDriver 1.2.56
  • Update read_ooov_files() for compatibility with ‘readr’ >= 1.2.0 which is now required

Add support for measurement of pulsed light sources (under development)

The new features described below are under development, subject to change without previous notice and not yet well tested!! (double-check any results and please report any bugs by raising an issue!)

Implement support for measuring output from xenon flashes, including use of such flashes as light sources for measurement of spectral transmittance and reflectance. Use of multiple exposures per integration is also supported and the number of exposures stored as metadata is used during later processing. In the case of pulsed light sources the first conversion of RAW spectra is into counts per exposure, and instead of spectral irradiance spectral fluence per exposure is computed. All changes are backwards compatible with raw data acquired with earlier versions of ‘ooacquire’ and the user interface remains unaltered for the measurement of continuous light sources.

  • Add function acq_fluence_interactive() for measuring spectral fluence of pulsed light sources.
  • Add acq_fraction_pulsed_interactive() for measuring transmittance and reflectance using a pulsed light source.

Documentation website is at http://docs.r4photobiology.info/ooacquire/.

Please raise issues concerning bugs or enhancements to this package through Bitbucket at https://bitbucket.org/aphalo/ooacquire/issues

NOTE: This package is NOT available through CRAN.

This version of the package is available through the r4photobiology repository  and through Bitbucket.


  1. from the binary or source packages from the CRAN-compatible repository at http://r.r4photobiology.info/
  2. from sources retrieved from the Git repository at Bitbucket.


devtools::install_bitbucket("aphalo/ooacquire", ref = "0.1.6")

devtools::install_bitbucket("aphalo/photobiology")  # only if not automatically installed/updated

devtools::install_bitbucket("aphalo/photobiologyWavebands")  # only if not automatically installed/updated

devtools::install_bitbucket("aphalo/ggspectra")  # only if not automatically installed/updated

from Data to Viz (external link)

from data to Viz is a new web site related to data analysis and R. Its aim is to make it easier to choose among different types of data visualisations. It looks beautiful, is easy to navigate, includes “trees” displaying a classification of visualizations and multiple individual examples with the corresponding R code.  Highly recommended!

To access the website and/or to buy the printed poster visit from Data to Viz.


Back to Top