I've started to play with the pretty nice Cozir CO2 sensor from GSS. This relates to research projects on air quality control.

For testing purpose, the sensor is connected to my computer through a USB-serial converter cable. In order to communicate  with the sensor (e.g. grab the CO2 concentration data), I've written a bit of Python code to wrap the low-level ASCII communication protocol into a higher level, more compact API.

For example, instead of exchanging byte codes, reading the temperature becomes:

>>> from cozir import Cozir
>>> c = Cozir('/dev/ttyUSB0')
>>> c.read_temperature()

For people that might be interested, all the details and the code are on the Github repository:

Also, the repo contains a basic logging program that can be customized to anyone's needs. Tested for now with Python 2.7, on Linux and Windows.


PowerTech 2015 article online

The article I submitted to PowerTech 2015 (Eindhoven, June 2015) has been accepted. I've put online the pdf manuscript. It is an author version, since the copyright will be transfered to IEEE.

Title: "Energy Storage Control with Aging Limitation"

[Update July 7, 2015] presentation slides are now also available.


Energy Storage Systems (ESS) are often proposed to mitigate the fluctuations of renewable power sources like wind turbines. In such a context, the main objective for the ESS control (its energy management) is to maximize the performance of the mitigation scheme.

However, most ESS, and electrochemical batteries in particular, can only perform a limited number of charge/discharge cycles over their lifetime. This limitation is rarely taken into account in the optimization of the energy management, because of the lack of an appropriate formalization of cycling aging.

We present a method to explicitly embed a limitation of cycling aging, as a constraint, in the control optimization. We model cycling aging with the usual ``exchanged energy'' counting method. We demonstrate the effectiveness of our aging-constrained energy management using a publicly available wind power time series. Day-ahead forecast error is minimized while keeping storage cycling just under an acceptable target level.

Fake Wind Energy Conference ?

I just received this email on an old academic email address of mine

Dear Mr. Pierre Haessig,

The purpose of this letter is to formally invite you to be honorable Speaker for the upcoming "World Congress and Exhibition on Wind Energy" during June 15-17, 2016 at Berlin, Germany.

The conference highlights the theme “Future Wind Energy Technologies”. The program is a rich mix of formats ranging from keynote sessions featuring many well-known and thought provoking speakers to intense and highly interactive discussion sessions.

Wind Energy-2016 is a remarkable event which explores the technology to showcase mature technologies from lectures, panel discussions, debates by world renowned experts who will discuss the latest advances in wind energy production and planning.

Your contribution and knowledge in the field pulls our attention to keep the proposal of joining our conference and enlighten the audience with your knowledge and experience. It would be our honor to have an eminent delegate like you in our summit.

I would be glad to answer your queries in this regard.

For more details please visit our Website (

This really looks like an automated email: not any specific words about my "contribution and knowledge in the field". Only my name, and the words "Wind Energy". Not even a specific list of topics or keywords related to Wind Energy (could be "offshore", "grid integration", "wind power forecasting"). Also, the conference website ( is pretty empty, with no visible organizing and scientific committees. Clearly this seems a fake conference.

It's not the first time I receive such an email, so I wonder: what is the business model of this OMICS Group company? What do they want, how do they make money? Is it some kind of hidden travel agency for researchers?

Also, will there be any actual people gathering for this conference in Berlin in June 15-17, 2016?

I really wonder...


Visual timer app update

Back in July 2014, I made a small visual timer application for my PhD defense (45 minutes presentation in France, and then unlimited time for questions from the jury). It is a pure SVG graphic created with Inkscape, embedded in a lean html page, with some bits of javascript to control the animation. Also, it is meant to be fully responsive: it scales nicely on laptops, tablets and smartphones.

Visual timerApp update

This week, I've spent some time to update the app to significantly improve the useability. Beyond a strong visual refresh, key improvements are:

  • full offline mode support: no more need of an Internet connection after the first usage. This is achieved using a AppCache manifest file.
  • new pause/resume control button.

How to use the timer

This timer simply works in a (recent) browser: http://é On a desktop/laptop computer, using the fullscreen mode gives the best result.

Source code

The app is available under a CC-BY-SA license. Source code is on GitHub:

Possible future updates

I may take the time to add the necessary manifest file to turn this web app into an actual hosted Firefox OS app.

Original Arduino boards are uncertified ?

I just got a new Arduino Uno board this morning, and got bitten by a strange message in the Arduino IDE (version 1.6.3 from when uploading a first test program:

This board comes from an uncertified manufacturer

Since the board comes from a trusted distributor (Lextronic), I was pretty surprised!

The reason behind the madness

Searching for this error message, I was even more surprised to discover that this is a side effect of a split between two Arduino "kingdoms":

  •, where I downloaded the Arduino IDE. They use the Arduino logo.
  •, which manufactured my "original made in Italy" board. They use the Arduino ® logo. Their board can also be recognized by the Vendor ID 0x2A03.

I made a side-by-side picture comparison of the boards, using photos from the respective websites (the logo difference is particularly small: click to see it fullscreen).

The two official Arduino Uno boards side by side
The two official Arduino Uno boards side by side

How subtle! But behind this surprisingly minor cosmetic difference, I found a good report of the present situation (as of March 2015) in this article: It seems things are getting tensed (trademark lawsuits).

In practice

I shouldn't forget to say that, apart from the annoyingly frightening warning message, my "uncertified" board from is in perfect condition and works perfectly with the current IDE!

(maybe future releases will behave differently, especially with new generation of boards developed separately)

It's sad that probably many people will get bitten by this quite misleading message in the coming months.

PHP trick for FxOS Manifest file

While exploring the development of a Web App for Firefox OS, I encountered a small trouble with the app manifest file: this text file needs to be served with a specific Content-Type header.

As an illustration, this is the content of the manifest of my app (JSON-formatted description of the App). It's hosted at http://é

  "name": "ImmoCalc",
  "description": "Calculatrice de prêts immobiliers",
  "launch_path": "/immocalc/index.html",
  "icons": {
    "512": "/immocalc/img/house-icon-512.png",
    "128": "/immocalc/img/house-icon-128.png",
    "60":  "/immocalc/img/house-icon-60.png"
  "developer": {
    "name": "Pierre Haessig",
    "url": ""
  "default_locale": "fr",
  "type": "web",
  "appcache_path": "/immocalc/manifest.appcache",
  "version": "1.0"

Normally, this file served as plain text. This can be seen when clicking on the link and opening the Page information dialog in Firefox (Ctrl+I). While plain text may be fine in another context, it is required that the Content-Type header is set to application/x-web-app-manifest+json. More precisely, this is required for the App submission on the Firefox Marketplace. It is recommended on MDN to tune the Apache server configuration with a .htaccess file. However, with my shared hosting plan at OVH, this was not working: the .htaccess file had no effect. [Edit: it seems to work now, so this PHP trick may not be needed anymore !].

To bypass this hosting limitation, I tried with a snippet of PHP code that simply sourcing the original manifest.webapp file, but with the proper Content-Type header.

// Serving the manifest file with the appropriate header
header('Content-type: application/x-web-app-manifest+json');

These two lines were enough to successfully submit my app on the Marketplace. The effect of the header can be seen in the browser: it triggers the Download dialog when opening the url (http://é, instead of displaying the content.

Maybe this trick can help others ?

ImmoCalc app sur Firefox Marketplace


Ma petite application mobile Calculette de prêt immobilier, dite "ImmoCalc", est désormais disponible sur le Firefox Marketplace :

Grâce à l'utilisation d'un petit fichier manifest dit appcache, le site et l'application (car c'est la même chose dans Firefox OS) devraient parfaitement fonctionner hors-ligne,  après bien sûr une première connexion pour tout télécharger. Pour cet app très simple, la techno appcache présente l'intérêt d'être simple (cf. le fichier manifest.appcache).

Petit problème : j'ai remarqué que l'installation sur Android (en utilisant un système de génération automatique d'APK, cf. Open Web Apps for Android) donne une appli qui plante au démarrage. En même temps, cette installation n'est pas très utile à partir du moment où la page web est accessible simplement, avec fonctionnement hors-ligne.

Pour information, la validation de l'app (qui est faite par un humain) a pris une petite semaine.


A small web app for house loans

house-loan-iconOver the last few weeks, I've started to play with jQuery Mobile to build a small web app for mobile phones, and in particular my new Firefox OS phone (ZTE Open C). I've built a simple interactive calculator for house loans.

For now, the app is in French only (I don't know if house loans follow the exact same rules in other countries): "Calculette de prêt immobilier".

The app is hosted for the moment at http://é and it should be usable with any recent browser (mobile, tablet or desktop). Also I may take the time to package it for the Firefox Marketplace for a true offline usage.



New academic position

After graduating in July, I am now an assistant professor at Supélec, effective September 1st. I'm not moving too far away since I'll still be in Rennes, although another campus. I will work in the control team (IETR-ASH), in the field of energy management. This may include work on grid energy storage as I did during my PhD, but also energy management for building, and maybe also some control for the grid itself (e.g. voltage control on the distribution grid).

Many thanks to all my former colleagues at SATIE lab, at ENS Rennes and EDF R&D.The three years I spent with them for my PhD were really a great time!