A new touchscreen

Over the years our ASUS Eee TOP became slower and slower and it needed to be replaced by something else. But what should it be?

A 7, or even a 10 inch touchscreen would be too small for us. We need 16 inches or more 😉 After searching quite some time for a good replacement, I came up with this:

  • IIyama ProLite T2252MTS-B3
  • Intel STK1AW32SC (aka Intel Compute Stick)

A 22″ inch touchscreen with an Intel Compute Stick; connected to each other with HDMI (and USB for touch of course). And the Compute Stick can be easily tucked away behind the IIyama screen, so that would make a nice, ‘clean’ setup with enough processing power to run a web browser in kiosk mode to fulfill our needs.

More later…  I have to answer some comments first 😉

OK Homey, you’re fired

Well..OK, let’s just wait and see if you can evolve to a mature product in the next couple of months… you’re still beta, so who knows what’ll happen in the near future. I’m one of the backers of the Kickstarter Homey project – I already knew about it before it appeared on KS because there already were rumors about Homey on Tweakers before the Homey KS started. In the past I tried several other solutions to get speech going in my Home Automation but never really found a really good and reliable solution; maybe Homey then? So I decided to go for the GEEK Edition: “You will receive Homey, plus two wireless transceivers, enough jumper cables to hook it up and early access to the SDK including sample code for your Arduino projects!

 

Does it blend?

Does it blend? It sure looks cool with its rotating LED

 

ETA was May 2015 but I’m used to that on KS – either the projects don’t deliver at all (Plugaway, Zano) or much too late. And I don’t really mind the ETA actually, as long as the product meets the expectations. Expectations that were brought to life by the “über-cool” video’s provided on KS. But can the end product live up to those expectations? Here’s my verdict at this stage of the product.

The Homey arrived on February 10th. I was too busy with other projects so I couldn’t spend much time on the Homey, but I just couldn’t resist doing the initial setup. So I did and half-way (the 2nd trial to finish the setup) I came to the conclusion that Google Chrome was mandatory to successfully finish the initial setup. Hmm, someone could have told me so. Not much happened since then besides some late-night experiments with different languages, voices and such. Cause my primary objective is not to use Homey as my Home Automation system – I already have one 😉 Homey is too limited as a replacement; I’ve got too much ‘exotic’ hardware, a great rules/scene engine and don’t really want to rewrite my whole system to become a bunch of Homey Apps. I’m satisfied with my system as it is right now. Completely NodeJS based, running hassle-free for more than 2 years now.

All I want is a superb Speech Recognition system that I can embed in my own system. That’s all. Let’s examine some of the results of speech recognition.

After the Homey arrived, the first question I asked myself was: how do I get the speech recognition results from Homey to my HA system? First thing I did was looking for a Homey App that I could use in some way – the HTTP request flow charts App by Erik van Dongen looked interesting so I installed it and made my first flow which used Erik’s App to PUT the recognized text to some server and repeat what was recognized through the Homey speaker:

Homey Flow

A tiny NodeJS app was enough to display what was PUT : the JSON contains what was recognized and [..] contains the actual text spoken)

>node homeyspeech.js
14:26:45 > {"tekst":"radio aan"}
14:26:56 > {"tekst":"radio huis"} [radio uit]
14:27:24 > {"tekst":"tv aan"}
14:28:04 > {"tekst":"wat is het weer"}
14:28:27 > {"tekst":"hallo"}
14:28:51 > {"tekst":"nederland en aan"} [nederland 1]
14:29:03 > {"tekst":"de lampen aan"} [doe de lampen aan]
14:29:15 > {"tekst":"no"}
14:29:28 > {"tekst":"lampen aan"}
14:30:25 > {"tekst":"lampjes uit"}
14:30:41 > {"tekst":"alarmcentrale aan"}
14:30:55 > {"tekst":"alarmcentrale uit"}
14:31:07 > {"tekst":"alarmcentrale bosch"} [alarmcentrale home]
14:31:29 > {"tekst":"waarom luister je niet"}
14:31:45 > {"tekst":"het wordt niks zo"}
14:32:02 > {"tekst":"doe je oortjes is goed om te"} [doe je oortjes eens goed open]
14:41:05 > {"tekst":"hoe gaat het met je"}
<switched Homey language to English>
14:46:49 > {"tekst":"lol"} (my son taking a peek over my shoulder, laughing)
14:48:28 > {"tekst":"whats the time"}
14:49:00 > {"tekst":"whats the weather"}
14:49:32 > {"tekst":"no"}
14:50:11 > {"tekst":"how are you"}

Sorry, this is mostly Dutch (of course), which is still in Beta (as it seems, reading the Athom forum).

Good? Bad? I don’t know yet. Homey seems rather sensitive to background noise, a small pause between “OK” and what you named your Homey (here it’s named Ultron right now) can help a lot, Dutch language seems to be harder than English (what the … ???) and after placing the Homey in the living room, near a TV (with its speakers off, sound is provided by a surround system) the results got worse…

More later…

Adding a Plugwise Smile to the Fibaro HC2

Yep, I’m still alive 😉 The ‘silence’ since April this year was simply because I really needed some sort of ‘sabbatical’ after almost 10 years of spending a great deal of my spare time to Home Automation – and some other (more important) things happened in the past months as well. But last week something happened that brought back the inspiration to write a new post.

I think it must have been about 2 weeks ago when Marco from Mood LedLight contacted me to help him to get some information the Plugwise Smile can provide into his Fibaro HC2. He was probably inspired by my post about getting Smart meter data into a HC2. And Marco is the one that advised me on my Gazebo LED project some years ago and he’s my LED strip supplier. I don’t own a Plugwise Smile but thought I’d give it a try – if it can be done I should be able to do it, right? 😉

Marco sent me some info about the progress he had already made – he used a PHP script to query the Smile and write the result to a file on a Windows 2008 IIS server and read that file from a lua script in a Fibaro virtual device and actually wanted to get rid of the PHP part.

The only part I did was getting the authentication working so that it was possible to get the Smile XML data without the use of the Win2k8 Web server. For the last part, XML parsing in Lua, I didn’t have enough time so I asked Marco to seek for help on that from the real Fibaro Lua script cracks – cause I only know the basics. 3 days later Marco had found the solution; here it is… have fun!

--[[
%% properties
%% globals
--]]
 
-- Virtual device id
vDevId = 102
 
-- url van PI met meterconnectie
PI1 = Net.FHttp("192.168.xx.xx");
PI1:setBasicAuthentication("smile", "fake");
 
-- ophalen JSON info
response, status, errorCode = PI1:GET("/core/modules");
--fibaro:debug(response);
 
-- Meter info ophalen 
--local a = string.match(response, "^.+<vendor_name>(.+)</vendor_name>.+$");
--local b = string.match(response, "^.+<modified_date>(.+)</modified_date>.+$");
--local c = string.match(response, "^.+<created_date>(.+)</created_date>.+$");
--local d = string.match(response, "^.+<vendor_model>(.+)</vendor_model>.+$");
 
-- Uitlezen meters
local e = string.match(response, "unit='W' directionality='consumed'>(.+)</measurement>.+$");
local e1, e2, e3, e4, e5, e6, e7, e8, e9 = string.match(e, "(%x.+)%s(%x.+)%s(%x.+)%s(%x.+)%s(%x.+)%s(%x.+)%s(%x.+)%s(%x.+)%s(%x.+)");
 
-- omzetten naar decimalen
local e1 = string.match(e1, '%d+')
local e2 = string.match(e2, '%d+')
local e3 = string.match(e3, '%d+')
local e4 = string.match(e4, '%d+')
local e5 = string.match(e5, '%d+')
local e6 = string.match(e6, '%d+')
local e7 = string.match(e7, '%d+')
local e8 = string.match(e8, '%d+')
local e9 = string.match(e9, '%d+')
 
-- Totaal tellers (dag+nacht-teruglevering)
local e10 = e8 + e9 - e6
 
-- delen door 1000 voor KwH
local e6 = e6/1000
local e8 = e8/1000
local e9 = e9/1000
local e10 = e10/1000
 
-- afronden op 2 decimalen
local e6 = string.format("%.2f", e6)
local e8 = string.format("%.2f", e8)
local e9 = string.format("%.2f", e9)
local e10 = string.format("%.2f", e10)
 
-- waardes weergeven
--fibaro:debug("vendor name :" .. a);
--fibaro:debug("vendor_model :" .. d);
--fibaro:debug("modified date :" .. b);
--fibaro:debug("created date :" .. c);
fibaro:debug(" Huidig gebruik : " .. e1 .." Watt" );
--fibaro:debug(" waarde 2 : " .. e2 );
--fibaro:debug(" waarde 3 : " .. e3 );
--fibaro:debug(" waarde 4 : " .. e4 );
--fibaro:debug(" Nachtteller totaal : " .. e5 .." KiloWatt uur");
--fibaro:debug(" Dagteller totaal : " .. e6 .." KiloWatt uur");
--fibaro:debug(" Totaal tellers : " .. e7 .." kiloWatt uur");
--fibaro:debug(" waarde 5 : " .. e5 );
fibaro:debug(" Terug Levering totaal : " .. e6 .." KwH");
--fibaro:debug(" waarde 7 : " .. e7 );
fibaro:debug(" Nachtteller totaal : " .. e8 .." KwH" );
fibaro:debug(" Dagteller totaal : " .. e9 .." KwH" );
fibaro:debug(" Totaal tellers : ".. e10 .." KwH" );
 
-- Update virtual device
fibaro:call(vDevId, "setProperty", "ui.lbldagverbruik.value", e9.." KWh");
fibaro:call(vDevId, "setProperty", "ui.lblnachtverbruik.value", e8.." KWh");
fibaro:call(vDevId, "setProperty", "ui.lblactueelverbruik.value", e1.." Watt");
fibaro:call(vDevId, "setProperty", "ui.lbltotaalverbruik.value", e10.." KWh");
 
-- Temp dag start ophalen en aftrekken van totaal om dag totaal te berekenen
local myVar1 = fibaro:getGlobalValue('Watt_today_start');
fibaro:debug ("waarde van de variable dag start is ".. myVar1);
local myVar2 = fibaro:getGlobalValue('Watt_Temp');
fibaro:debug ("waarde van de variable dag totaal is ".. myVar2);
local myVar3 = (myVar2 - myVar1);
local myVar3 = string.format("%.2f", myVar3)
fibaro:debug ("waarde van de variable dag gebruik is ".. myVar3);
fibaro:call(vDevId, "setProperty", "ui.lbltodayverbruik.value", myVar3.." KWh");
 
-- Gisteren
local myVar4 = fibaro:getGlobalValue('Watt_yesterday');
fibaro:call(vDevId, "setProperty", "ui.lblyesterdayverbruik.value", myVar4.." KWh");
fibaro:debug ("waarde van de variable gisteren gebruik is ".. myVar4);
 
-- update global variable
fibaro:setGlobal("Watt_current", e1);
fibaro:setGlobal("Watt_Temp", e10);
fibaro:setGlobal("Watt_today", myVar3);
 
-- ff 20 seconden slapen
fibaro:sleep(20*1000)

 

 

Happy Days

Solar Production 1Who said that starting with solar panels during the winter ain’t fun? Wrong, it’s the best time of the year! 🙂
Soon after our solar panels were installed it became a habit to take a peek each day at what the panels had produced. And not being used to large production numbers, you can’t be anything else than happy with what you see; even if the production is just a few kWh.

But then, somewhere in January, you’ll start to notice that the production gradually becomes higher and higher – wow! The sun still has its bad days of course, but the production on sunny days just keeps on getting higher and higher.

So every day there’s the possibility of a new record in terms of energy production and it’s soo nice to witness that – it’s addictive. Nowadays, when I get up in the morning, I take a look outside to see whether it will be a sunny day or not; while at work I keep an eye on the cloudiness and monitor the solar production to see if another record is in the making. So, if spring itself wouldn’t cheer me up (I hate winters), our solar panels would – so right now, every day is a happy day.

If you’re considering solar panels: start in the 2nd half of winter and watch the energy production increase each week; I’m sure you’ll have the best spring you’ve ever had! 😉

Solar2

ESP8266: testing deep sleep & interrupts !?


This weekend I’ve been testing one of my ESP-12 module for more than just a few minutes; more like a few hours. Just to see how ‘robust’ the ESP8266 actually is. The story about ‘zombie mode‘, where the module didn’t restart after the deep sleep period had ended, made me curious whether the ESP8266 was stable enough (to use at all).

So I created these 2 scripts to make it do something useful for a change:

init.lua:

FileToExecute="gettemp.lua"
l = file.list();
for k,v in pairs(l) do
  if k == FileToExecute then
    print("*** You've got 5 sec to stop timer 0 ***")
    tmr.alarm(0, 5000, 0, function()
      print("Executing ".. FileToExecute)
      dofile(FileToExecute)
    end)
  end
end

gettemp.lua:

require('ds18b20')

serv_ip = '192.168.10.168'
serv_port = 8001
gpio4 = 2
interval = 20000000
ds18b20.setup(gpio4)

function getTemp()
  temp = ds18b20.read()
  conn = net.createConnection(net.TCP, 0)
  conn:on("connection", function(socket)
    socket:send(""..node.chipid().." "..tries.." "..temp.."\r")
  end)
  conn:on("sent",function(conn)
    conn:close()
  end)
  conn:on("disconnection", function(conn)
    node.dsleep(interval-tmr.now(), 0)
  end)

  conn:connect(serv_port, serv_ip)

end                   

function connect()
  tries = tries + 1
  wifi_ip = wifi.sta.getip()
  if wifi_ip == nil then
    if tries < 5 then
      tmr.alarm(0, 1000, 0, connect)
    else
      node.dsleep(interval-tmr.now())
    end
  else
    getTemp()
  end
end

tries = 0
connect()

Nothing spectacular – it reads a DS18B20 sensor, sends the temperature and some other data to a NodeJS TCP server, goes to deep sleep and wakes up 20 seconds after the previous wake-up, so that the module does this 180 times per hour. It has been running since Friday night.

ESP8266 measuring DS18B20 and going to deep sleep

But then I found another interesting post about deep sleep and interrupts. And if my interpretation is right, this could be what I’ve been looking for – I just had to try it out:

You can easily esp8266 wake from a deep sleep. Just bring on to the RST short negative pulse. I use it.

 

Well…it works! (on a ESP-12 that is, haven’t tested any other model).

ESP8266 wake-up wire

 

Whenever the black wire at the bottom of picture makes contact with the RST pin and effectively pulling it to GND, the ESP8266 wakes up – this needs further research! 🙂

For now, I resumed the reliability test for another night.

ESP8266 in deep sleep

With the ESP-12 modules on a breadboard adapter I was finally ready for some tinkering. The plan for today was very simple: flash NodeMcu firmware, start programming the ESP8266 in Lua and try deep sleep mode.

I put an ESP-12 on a breadboard, used a FTDI-ish thing to connect the ESP-12 to my Windows PC and used a 3.3/5V breadboard power supply (set to 3.3V) to power the ESP-12.

ESP-12 in deep sleep

Flash!

Time to flash the thing! I knew that sometime in January MQTT was added to the NodeMCU firmware so I searched for a recent firmware version that contained the MQTT code. I read some rumors that MQTT seemed to be broken in the latest NodeMcu firmware releases – on the ESP8266 forum I read that v20150127 was the latest release where MQTT still worked; yesterday I read that it was due to the addition of MQTT v3.1.1 support.

Tools and other things I downloaded to get started with the ESP-12 were:
NodeMcu firmware
NodeMcu flasher
LuaUploader
LuaLoader

The latter 2 have some overlap in functionality – it looks like LuaLoader will be my favorite. OK; now that I have a flash tool and the v20150127 firmware – what’s next? After some trial and error I found out that I had to change something on the ‘Config’ page of the flash tool:

NodeMCU Flasher

I unchecked items 2, 3 and 4 and let the first item point to the right firmware image I wanted to use. Figuring this out took me longer than soldering the breadboard adapter … A wire from GPIOØ to GND followed by a cold boot set the ESP-12 in firmware upload mode, clicking “Flash” on the Operation tab was enough to flash the firmware.

After some playing around with “Hello World”- and “Blink”-like Lua scripts it was time to do something that would be a bit more exciting – things like interrupts, deep sleep and some MQTT of course.

First I wanted to know everything about deep sleep; I found this forum post and read about another mode the ESP8266 could be in – zombie mode. I wanted to avoid that mode of course so I took the suggested zombie counter measures which is pulling up GPIOØ & GPIO2 to VCC with ~5kΩ. And for using the deep sleep mode RST & GPIO16 have to be connected to each other and also pulled up to VCC; and of course CH_PD as usual.

Boot loop protection!

And of course, the first script I made with a node.dsleep() in it didn’t work .. well, it did what it was supposed to do, but not what I meant it to do! Some error in the code caused a reboot within a few seconds and there was no way I could stop this boot loop; nothing helped. Only after re-flashing the firmware I regained control over my ESP-12… So the first thing I did was searching for a workaround/solution for this and found one here, so now my init.lua (the NodeMcu autoexec.bat 😉 looks like this:

FileToExecute="printtext.lua"
l = file.list()
for k,v in pairs(l) do
  if k == FileToExecute then
    print("*** You've got 5 sec to stop timer 0 ***")
    tmr.alarm(0, 5000, 0, function()
      print("Executing ".. FileToExecute)
      dofile(FileToExecute)
    end)
  end
end

Yeah I know,  this adds an extra delay of 5 seconds after a restart, but this is much, much better than the need to re-flash each time you make a mistake – and since my experience with Lua is like 1~2 hours, I think that this will be my init.lua for a loong time.

Results for this evening: Deep sleep seems to be working… onwards!

New ESP8266 (ESP-12) modules ready

Today, while my son and I were visiting the NMM, the breadboard adapters for my new ESP8266 type ESP-12 modules arrived. Finally …

ESP12_on_breadboardI was a bit surprised by their size though; the adapter covered the whole middle area of the breadboard, leaving no room to plug in wires as you can see. So instead of using the headers that came with the adapter, I used headers with a length of 18 mm. This way the adapter board is still held at its place on the breadboard and I can use female wires to connect to the ESP-12.

Now let’s see what has happened in the ESP8266 scene during the time I was away 😉

WordPress on Banana Pi?

WordPress is one of those applications of which I was not sure whether a small couple-of-watts computer like a Raspberry Pi, Banana Pi or Odroid could handle it. WordPress always felt a bit sluggish… Well, there’s only one way to find out, right? Just do it 😉BananaPi

So this afternoon I moved my WordPress site from a Hyper-V Fedora Linux VM to a Banana Pi that didn’t have that much to do yet – and right now, you’re looking at it! (WordPress on a Banana PI, that is)