CII C++ demo on Raspberry Pi 3

In this demo, the electricity meter pushes a ''DataNotification'' containing at least the instantaneous total power (1-0:1.7.0.255) to the optical port connected to the Pi 3. The self-refreshing value is then displayed on a smartphone. It works as follows:

  • On the Pi, the ''DataNotification'' carrying the instantaneous power is processed by the cii_demo application, the value of the power is extracted and stored into a file.
  • The Pi is configured as a Wi-Fi access point with the SSID ''PI3-AP-2'', and the fixed IP 172.24.1.1. The Pi also hosts a WEB server.
  • The smartphone is configured to access the network PI3-AP-2, and its  browser is pointed to 172.24.1.1.
  • The Pi WEB server replies with its default page, that we have configured to fetch the power from its file. The page refreshes itself automatically.

On the left, the Pi 3 with its power cable and the USB connector to the optical port. On the right, the smartphone displaying the self-refreshing instantaneous value of the power

The demos require the following components:

  • A meter pushing DataNotification APDUs to the optical port. The pushed information can be plain or ciphered. In that case, the 16 octets encryption key must be 0x101112131415161718191A1B1C1D1E1F (default global Consumer Information Push (CIP) encryption key)  and the 16 octets authentication key must be 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF (default global CIP authentication key). These values are only required in the demo version of the libraries. The release version accepts all keys.
  • An optical probe that connects to a USB port of the Raspberry Pi. The port is usually visible in the Pi as  ''ttyUSBx''.
  • It is also possible to run the demos without a real meter by using CIIPusher, a Windows application that pushes DataNotification APDUs to a COM port. Only a (null-modem) cable is then needed between the PC and the Pi. CIIPusher can be downloaded here.
  • Once started the demo runs for about 15 minutes. This limitation is not present in the release versions of the libraries.

The Pi must be prepared as follows:

  • Configure the Pi to be a Wi-Fi access point using these instructions.
  • Install Apache and PHP5.
  • Download the cii-demo here and extract it into a directory. Replace de default WEB server page file index.html (usually located at /var/www/) by index.php.
  • Build cii_demo, using make, and run it. It displays the DataNotification received and the value of the power. It also writes the power (as a simple string) into /tmp/power.txt from where the value is fetched by the default WEB browser page.
  • Connect the smartphone to the Pi access point, and browse the Pi address (172.24.1.1) and see the changing power.
  • cii_demo can be started as bootstrap using cron.