Skip to Content
Author's profile photo Noël Hendrikx

Project HomeControl – Smart meter / IOT / UI5 – Introduction

The European Union has decided that every house in Europe must be equipped with a Smart Meter. Here in The Netherlands the electricity company are replacing the old ones house by house, so it will take some time to replace them all, but that will be done before 2020.

It is possible to speed up the process by requesting a smart meter at some cost. Since I have an electric car, I thought I needed the smart meter for it, since the charging station can detect power usage of other equipment at home. I am charging the car at night, so no real issues fortunately. But the smart meter was ordered beforehand, so let’s make use of it 🙂

Here is what I am going to do:

1) Connect the Smart meter via a P1 port to Arduino Uno (one of the many ways to get telegram messages from the Smart Meter);

2) Create a database (mySQL or MongoDB) and write a script for the Arduino to push every xx seconds a telegram message into the database located at my NAS;

3) Develop a service to request information from the database (NodeJS or php);

4) Develop a ui5 application to retrieve the information from the service and display it.

2016-03-10 11_23_03-homecontrol.pptx - Weergave voor PowerPoint-presentator.png

Part 1:

The hardware has arrived and ready to be installed! What did I use:

– Arduino Uno card;

– LAN shield (for part 2);

– SD card (for later purpose);

– p1 cable to connect to Kaifa MA304C and breadboard);

– Breadboard – and after a week I ordered jumper cables as well;

IMG_8977.JPG

I got a scheme from DomoticX how to connect the cable to the breadboard and Arduino. I never worked before with a breadboard, but after a while it looks quite easy. For easy usage I mounted the Arduino and the breadboard to a wooden board.

IMG_9144.JPG

With the Arduino software I tried a simple serial test to see if the card is reading information. Ouch… the serial test did not work unfortunately. I tried to connect the wires from the p1 cable to the Arduino as well, but no luck. Now it is time to find out why this is not working properly 🙂 (to be continued)

26-03 update:

Even a simple RS232 test did not succeed. This hardware solution can be found at P1 poort slimme meter uitlezen (hardware)

IMG_9183.JPG

Update 31-03:

It seems Arduino boards do have difficulties with the speed of communication (baud rate 115200 is not supported). With software – which is slow – the speed could be possible handled, but I don’t like that. So let’s see what we can do more!

Raspberry PI with P1 <> USB cable

Instead of the Arduino let’s try the Raspberry PI 3 with a cable that has a RJ11 connector and an USB connector. The hardware arrived yesterday and in about 3 hours I finally managed to get my first P1 telegram out of the Kaifa meter!

What I did was following the next blog: Installatie RaspBerry PI | eMBeZon (google translate may help you). This solution has many options, even export to JSON, mySQL and much more. You can easily enable or disable functionality. Uitlezen Slimme Meter | eMBeZon

With the 1st test to read the communication port, ~ $ cu -l /dev/ttyUSB0 -s 9600 –parity=none [Enter]

I knew I had to change the 9600 baud to 115200 baud. But in the first place still no result. I tried to set the parity to even but no luck again. By mistake I removed the -parity option and voila! My first p1 telegram:

2016-03-31 12_10_55-pi@raspberrypi_ _.png

Cool! Phase one completed – ok… with different hardware! Let’s examine Part 2 first before building the next step.

Some ideas to log the data:

1) JSON for the last p1 telegram – realtime data

2) A pull to HCP IoT (thanks Robin van het Hof for the idea!)

3) mysql (and for part 3 nodejs / php / jpa) or other database like mongodb / derby

Part 2

31-03:

Managed to log all information into a mysql database located at my QNAP! Every minute a job will run and push the information to the database:

2016-04-01 11_49_54-peppienas _ localhost _ verbruik _ verbruik _ phpMyAdmin 4.1.13.png

This will not be the final solution, but it is good to see I can log data already. Yesterday evening a closer look at HCP IoT has been done and that might be interested as well.

13-04:

At the moment I am retrieving realtime data (with a maximum of 10 seconds interval) in json format! I have developed a fiori app (tilecontainer) and within the tiles I am displaying the electricity meters and gas meter now. Besides these information I have connected my solar / heating system to this application also (Technische Alternative).

The next image will be the UI5 application (part 4) and the basics for the application are done now.

/wp-content/uploads/2016/03/037558d9_a4d1_4452_a0ce_9dd38b3106ef_original_928718.png

More improvements incoming:

* Statistics – part 3 – mysql database is being logged;

* Information regarding pumps will be added;

* Gas meter will be fixed;

* Temperature in living room (Woonkamer) will be fixed;

* My own colours will be added (styling)

To be continued again 🙂

Noël Hendrikx

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Robin Van Het Hof
      Robin Van Het Hof

      Looks like a great project! Just out of curiosity, what do the plotted key-value pairs represent?

      Author's profile photo Noël Hendrikx
      Noël Hendrikx
      Blog Post Author

      There is a lot of information from the smart meter, like serial number, low or high rate, current energy consumption, total energy consumption (low and high), gas meter (once per day) and even - I don't have it yet - solar energy production.

      http://domoticx.com/wp-content/uploads/DSMR_telegram_codes.png

      Check out DSRM 2.x or 4.x messages, my smart meter is a Kaifa and uses DSRM 4.2 protocol.