Home, Smart Home

Maio 24th, 2009

Although people are starting to take a better look at home automation (or domotics), there is still this idea that domotic are expensive, dispensable and a luxury. A mere toy, one that is quickly forgotten and seldomly used. And from what I’ve seen, they seem to be right.

Today, I’m starting to build my house. Being an electronics and telecommunications engineer it’s only natural that I’d like my home to have some kind of sutomation. I’ve asked around a bit, and from the proposals I saw, most people don’t get it. You should be building domotics from the users’ point of view, not from an engineer’s point of vue. It’s what’s really useful that should be implemented.

When we talk about home automation, most people think about automating lighting. Ok, so you can centrally (often through a kind of touch control on the wall) turn on/off every light in your house, or even dim them. What’s the *real* benefit in that? That’s something nice to have, but not amazing.

For me, a domotics system should be useful every day! By order of priority, it must:
* Protect me and my familly (by implementing a security system)
* Save money (by automatic energy saving)
* Save time (by doing things quicker, augmenting confort)

To comply with these requirements, these are some of the things the system should have, also by order of priority:

* A user-friendly, intuitive, distributed supervison and control system, based on touch screens with animated graphics.
* A data archiving system for energy and event analysis.
* A sofisticated alarm system. Several zones, several modes, motion detection, video recording.
* Automated window shutters.
* Automated entrance doors and gates.
* Climate control (temperature and forced ventilation).
* Energy monitoring (electric and thermic).
* Garden, Orchard, Horticulture and Greenhouse (hydroponics) irrigation and monitoring.
* House-wide speakers (for warnings and info).
* Daily-usage-appliances monitoring, to inform when long work cycles end (laundry, bread maker, oven, etc).
* Lighting control.

The order clearly shows it, lighting control really is the least important thing in my book. Unsurprisingly, the alarm system is the single most important thing in a smart home, and most people end up spending lots of money on (independent) security systems alone. So my ideia is to integrate all these into a very useful home automation system.

If you think about it, many pieces can be reused within the system. For example, the alarm’s motion sensors can be used to open doors and/or turn some lights on; the alarm lights and speakers can be used to warn about many other events; the alarm system can control the window shutters when securing the house; the climate control can also use the window shutters for efficiency, making the most of the Winter sun.

A system like this would be a natural part of my life, not a gimmick that quickly gets forgotten after the initial impact. But all this needs to be affordable, and most systems aren’t. 20000 Euro (that’s twenty thousand) for a system is NOT realistical these days. Things also need to be kept simple and standard. Proprietary buses and hardware is definitely not the way to go in my opinion (you simply get locked in). And finally, things need to be very dependable, and quickly amendable should a fault occur.

I’ll keep on searching for the perfect system. Meanwhile, I have my own ideias of how the basic system should be done… and some very advanced stuff too.

Stay tuned!

Indicator whoes

Abril 15th, 2009

Last week my 11-year-old Rover 200 iS just lost it’s indicators. The hazards also didn’t work.

This weekend I found some free time to look at the problem. The indicators did not light up when the stalk was moved. No green arrows on the dashboard. The hazards switch lit up the triangle on the dashboard, but it did not blink (and the indicators also did not light up). I could also not hear the distinct relay “click-click” sound when the indicators worked. I checked all fuses first, but everything was fine.

Then I realized there was an initial “click” sound coming from the relay on the fuses’ board, when the stalk was moved or the hazards’ switch pressed. I suspected the relay might be having problems, and took it out.

It was very easy to open, and inside I found a small copper tab broken. I think I found the culprit!

Unsurprisingly, my local supplier of auto parts did not have the Rover (actually, a Lucas) relay in stock, but could provide me with an electrically equivalent. I brought it home, but alas, it did not fit the slot on the board. Although unable to fit the new relay, I was able to test it (and use it temporarily) by creating a home-made adapter with a few copper tabs and a couple of “crocodile” leads. It worked, proving the relay was the only bad piece of this puzzle.

A few days later I finally got hold of an original Rover/Lucas relay, and now everything is working as it was for the past 11 years.

At first, instead of fiddling with it, I thought of leaving the car for service at a garage near my work place, but I’m a little eery of having people messing with my car. Firstly, I have to leave the car there, and only God knows what happens after I leave. Secondly, the problem might even be simple and cheap, but they decide to charge me 4 hours work and some replacement parts that weren’t. I have nothing to hold on to, and pay.

In fact, once I left the car in for service, but went on shopping with my wife in a nearby shopping center. After I came back to fetch the car, they charged me 5 hours work. This happened less than 4 hours after I left the car there. If I just left the car for a whole day, there was no way I could know, and payed happily.

We have to defend ourselves from this type of “robbery”, so I’m getting a Haynes service book to try and solve the small problems my car will start to develop. After all, it is 11 years old… and I want it to last until I get a brand new PHEV. Wich will hopefully happen in 2 to 3 years time.

I always loved my Rover 200 iS, because I think it is a great, balanced car. It was also very dependable through all these years. I’m glad to see it back on the road again! :)

Explosão de Sabores

Abril 8th, 2009

Nesta Páscoa, como em todas as outras Páscoas que passámos em Vale de Cambra, fomos abastecermo-nos de doçarias à Criju. É sempre uma maravilha para os sentidos…

Este ano trouxemos um sortido de “amêndoas” digno de uma família real! O interior das drageias eram variados: além das típicas amêndoas havia avelâs, noz, noz pecan, banana, o interior dos Maltesers, e chocolate. Os revestimentos eram igualmente emotivos: chocolate preto, branco e de leite, chocolate picante, açúcar, cacau em pó, café e moka. As formas, de redondas às típicas amêndoas, passando por ovos e “clusters”, evidenciavam a panóplia de sabores e texturas que iríamos descobrir.

Além dos doces divinais, a Criju tem também “pacotes de amêndoas” muito originais e criativos, longe de qualquer coisa que se possa encontrar em hipermercados ou centros comerciais. Coloridos, divertidos, sofisticados, fofos, grandes ou pequenos, é fácil encontrar a nossa felicidade na diversidade proposta.

Altamente recomendada, a Criju reflete aquilo que eu gosto de ver no comércio tradicional: propõe produtos diferentes, únicos até, muito difícil ou dispendioso de encontrar no comércio em massa. Além disso é dinâmica, propondo sempre coisas novas. É assim que conquista a sua clientela, e a mantêm. Um exemplo para muita gente.

Quando passarem por Vale de Cambra, não se esqueçam de dar um saltinho à Criju; quando provarem um dos seus deliciosos bolos-rei de frutos secos, vão ficar convencidos…

PVR #1 - Media Center - PVR #2

Abril 6th, 2009

Last week, while watching Un dîner presque parfait on M6 (a french channel), me and my wife realized it was a pity we couldn’t catch all of the shows during the week. We have a very busy life, and even when we are home when the show airs, we usually cannot just sit down and watch it. So we decided to get a PVR, and on our next visit to Aveiro we purchased a Samsung DVD/HD PVR (for 222€). When I finally found time to install and test the machine (about a week later), we realised just how much noise the fan on the back of the device made… still, that was not the worst of it. The DVD drive made an amazing whirring sound when reading a standard commercial DVD disc (matrix-created, not a recorded one). I could clearly hear it above my floorstanding speakers while watching Asterix contre Cesar. Assuming my unit was normal and had no defects, someone took a couple of awful engineering decisions…

We returned the PVR (thankfully, MediaMarkt is a great store, and gave us our money back). Then I started wondering about building a Media Center arond one of my old Macs and an Elgato EyeTV 250 Plus. But my old Macs are really, really old Macs (no USB 2.0), so using the EyeTV was not an option. Getting a new MacMini would be much more expensive, so I finally decided to postpone the Media Center to next year, when the Digital TV is settled here in Portugal (yes, we still don’t have digital here…).

After thinking a bit, we decided to purchase a PVR anyway, because we will make good use of it for the time being. We’ll hopefully be moving out in a year or so, and I’ll think about our Media Center by then. So, next time we were in Aveiro we searched around a bit and got a Panasonic DMR-EH58 PVR (for 215€).

 Panasonic DVR

What a diference! The fan protrudes from the machine’s case, but is essentially silent. In fact, I can actually hear the hard drive spinning up! The DVD drive is not only silent (all I can hear is the laser seek movement), it is actually faster than my Sony DVD player when detecting discs and moving in menus. The remote control is very well designed, the commands are clear and easy to use. The case is very well designed, sleek and stylish.

As for performance, I’m very happy; menus respond immediately to remote buttons (slow-responding and slow-redrawing menus are a personal pet peeve of mine with appliances), power-on is quick, recording quality in XP mode is amazing (I see no difference from direct cable TV), programming the thing to record at a certain date is easy and quick (and complete, like recording every work day, Monday to Friday, or on every weekend), the menus are intuitive (and so is the remote).

All in all a joy to use, and recommended!

Hora do Planeta

Março 28th, 2009

Somos nós que decidimos se queremos ou não cuidar do planeta. Se a ideia for popular, então até os senhores com muito dinheiro se interessam. Porque se há “procura”, há “oferta”.

Vamos então pensar nisto a sério, e cuidar do planeta. E não, não temos de abdicar de nada no processo. Até podemos viver bem melhor! Tenho um post long due sobre isto que tenho de publicar.

Até lá, sejam biopositivos!

OPC - OLE (Open?!) Process Control

Março 9th, 2009

In my industrial meanderings, I’ve been using some I/O modules for wich I write device drivers (for my data layer abstraction). One of these involves the OPC protocol (OLE for Process Control). It’s actually a pretty good ideia (badly implemented).

The ideia is that all data devices should be easily accessible by a standard communications protocol. There’s the ideia of an OPC server, an application that connects to the devices and exposes their data on the OPC protocol. Then, an OPC client connects to these servers and reads/writes on those devices. The problem is that they based OPC on a Microsoft-only (thus Windows-only) technology, DCOM. DCOM has a history of being difficult and picky to configure remote access and, because of this, almost nobody goes to the length (and risk) of configuring a system remotely (permissions problems, etc), and clients and servers are usually run on the same machine (defeating half the purpose).

Still, the ideia is too good to let go, and there are OPC servers for almost everything on the market. Getting OPC to work was one of my first projects at work, but since I write almost everything in Java (so that it runs on Windows, Mac and Linux) I had to find a way to get access to OPC from Java.

Back then, I developed a small TCP/IP proxy, socket-based, with a simple ASCII protocol, on Visual Basic (using the native OPC DLL). It not only brought along the lost OPC purpose (distributed access), but I could have access from just about anything (Java, Ruby…). Still, it was slow, configuration was local, and it did not implement all of the OPC protocol.

Later, I found almost exactly what I was looking for: a couple of companies were proposing JNI-based Java wrapper libraries, giving access to OPC. The problem: they cost as much as the OPC server (about 600 Euro) and, just like the server, I had to purchase one library license for each deployment.

I never understood this business model; I would hapilly buy the library once and deploy to my hearts content, as this would probably be cheaper than developing the library myself (I do this with JFreeChart, for example). But if I have to pay for every deployment this is simply not economical, since with the money of 2 or 3 deployments I was definitely able to develop the library from scratch. I was seriously thinking of developing the library myself and selling it with JFreeChart’s business model (I had no competition anyway), until I found JEasyOPC.

Antonin Fisher developed an OPC wrapper library based on JNI (and Delphi) and offered it with a LGPL license. I’m testing the library now and it seems to perform very well on Java 5. It crashes on Java 6 though (apparently due to multithreaded issues).

If Antonin ever gets around to fix this issue on Java 6, we’ll have a winner! :)

Tempos medievais

Março 5th, 2009

Fui dar uma vista de olhos a um jogo de browser, online, que uns meus colegas de trabalho têm andado a jogar. Chama-se Tribos (ou Tribal Wars em inglês) e está em http://tribos.com.pt.

A ideia é engraçada, nada de novo claro, mas o facto de ser online e de ser de evolução relativamente lenta torna o jogo interessante. Podemos dar uma voltinha pela nossa aldeia todos os dias à noite e manter aquilo a evoluir.

A maior parte das pessoas pensa em atacar os vizinhos para ganhar supremacia na sua área, mas eu (só para ser do contra) estou a assumir uma postura altamente defensiva (treino muitas tropas de defesa, tenho muralhas gigantes, e ajudo o pessoal a defender-se). Há uma aldeia mesmo pertinho da minha que já me atacou várias vezes e não respondia aos meus pedidos de paz:

Senhor(a),

Os meus mensageiros não me trouxeram boas novas no regresso. Aliás, não trouxeram novas nenhumas de vossa parte. Se estes mensageiros não retornarem com uma mensagem de paz, vou assumir esse facto como um acto hostil.

Sinceramente prefiro ter amigos a ter inimigos, pelo que rogo que respondeis pacificamente a esta missiva. A vossa aldeia está muito mal vista pelo meu povo (e pelo povo dos nossos amigos e aliados), mas ainda estamos a tempo de podermos viver pacificamente e com objectivos semelhantes.

Apesar de sermos pacíficos e defensivos, não responderei pelo meu Mestre de Armas se esta situação se mantiver por mais algum tempo.

Paz!

O povo de Albergaria da Serra

Tive de atacar a aldeia (por motivos de defesa própria, claro). Vamos a ver se o jogo premeia esta estratégia ou a castiga! :)

O jogo faz-me lembrar vagamente o The Settlers, que adorava e jogava horas a fio no meu Amiga 4000T, com um amigo meu. A velocidade de evolução das coisas era obviamente mais rápida no The Settlers (cada jogo demorava 1-3 horas), mas mantinha-se muito lenta em relação a outros RTS (como por exemplo o Dune 2 - Battle for Arrakis, um dos primeiros RTS).

Depois de jogar um bocadinho, fiquei a pensar em como seria interessante mesclar um jogo destes com uma engine 3D em tempo real. Uma coisa tipo Tribos, mas com o mundo modelado em 3D estilo MMORPG. O jogador poderia a qualquer momento encarnar o seu Paladino e passear-se pelo mundo. As batalhas, ao invés de serem resolvidas instantâneamente (como são no Tribos), seriam mais tipo The Settlers (demoravam alguns minutos) e poderiamos utilizar o Paladino para ajudar os nosso guerreiros (e talvez procurar o Paladino do oponente e dar-lhe uma sova… ou não). Claro que nada nos deveria impedir de passearmos pelo mundo, ver a nossa aldeia a crescer perante as nossas ordens (tipo The Settlers), viajar a cavalo pelas paisagens e florestas do mundo (tipo Zelda), etc.

A propósito do Tribos, lançaram hoje o Mundo 8, caso alguém queira experimentar.

Farewell Zubidou

Fevereiro 11th, 2009

I wrote the post below two years ago (24/01/2007, when doing some maintenance on my blog that was powered by Blosxom), but it never got posted because it got misplaced in the slipstream of files that find their way into (and out of) my server. I found this file today, and I feel I must post it.

Zubidou, “our” cat, is not amongst us anymore, having been caught by a car. I think that, more than say that I miss the darn cat, this old post transmits better the way we feel.

Here goes the old post:

Up and running

Finally I found the time to re-place my blog online, following my server maintenance. No comments this time, too much spam. Maybe later.

Meanwhile, I’ve been enjoying my land. Nature is all around you here, and it’s not shy to show itself. I’m starting to understand the land, learning many new tricks of nature. Preparing and tending the vine for the 2007 wine season is my challenge for this year.

Vale de Cambra is a wonderful place to live in. It’s mountainous area greets us with beautiful landscapes and ravines, the Sun loves to shine up and down it’s slopes, and the Wind playfully dances amongst it’s peaks. The air is pure, the life is simple, tradition is just around the corner (as is the most modern technology). Stray yourself a bit from the main street and you’ll be soon diving into the woods or old villages. Traffic jams are nonexistent (unless it’s wireless network traffic jams, there’s a free hotspot near just about every public structure), and the road surfaces are generous. The climate is a bit harsher than the rest of Portugal (Summer is warmer and Winter is colder), but also gives us many, many beautifully balanced days.

In one of these days of sunny equilibrium, namely my wife’s birthday, we had an unsuspecting visitor: an adult cat, very dirty but very sweet, appeared out of nowhere and just laid there under the table while we had lunch outside.

We cuddled it a lot, and the cat seemed to be very accustomed to people, and to being well treated. It was definitely a house cat. From that day on, the cat just wouldn’t let go. Living around our house, and managing to keep his bit of territory amongst the other cats of the neighborhood (expelling our neighbour’s dominant cat), Zubidou won us over. For that’s how we came to call it.

Zubidou feels right at home here; although he normally wants to come into our home, lay on our tapestry by our side and just follow us around all day, we almost never let him in.

 

He does have a problem with being alone, and when he sees us he just follows us around and lays there by our feet when we stop. Even when we delve deep into the city by foot…

He conquered his place in this World, and we help him out with good food, lots of attention and petting when we’re outside.

Amiga Research Operating System

Janeiro 23rd, 2009

Estive a dar uma primeira voltinha com o AROS, e gostei muito do que vi! Para quem não sabe, o AROS é um sistema operativo desenvolvido de raiz, pensado para ser API-compatible com o AmigaOS 3.

A ideia é ser um OS moderno, que corra em várias plataformas (mas principalmente em arquitectura x86), e onde se possa recompilar o software escrito para AmigaOS 3 com poucas ou nenhumas alterações.

A ideia é muito boa, funciona por bounties (se pegas num projecto e o fazes, podes receber dinheiro por isso das donações), e não precisamos de hardware específico. Não posso correr o AmigaOS 4 sem uma Sam440, mas este posso começar já a explorar (e, quem sabe, contribuir)! E o AROS tb já corre na Sam440!

Gostei mesmo do que vi, e vou preparar um dos meus PC antigos especialmente para correr o AROS!

P.S.: A gatinha do logo foi desenhada pela Eric Schwartz!

WayTooSimpleDateFormatToBeBelieved

Janeiro 20th, 2009

Why is it always the things that are supposed to be simple that come around and byte you in the behind? In my present (Java) project (a quasi-real-time data aquisition and archiving module), I had a SimpleDateFormat for parsing and formating dates in UTC format. Things were all cute and sweet, until I got more than one client loading the server. Then, all hell broke loose on the dates that got to the tags; here’s an example:

 

2008-07-14 10:33:52,valor_calculado1,40.0,1

2008-07-14 10:33:52,SetPointZito0,14.42,1

2008-07-14 10:33:52,SetPointZito1,50.0,1

2008-07-14 10:27:25,Posição do elevador A17,43,1

2040-01-31 10:27:00,Freq. oscilacao da plataforma A17,8,1

0037-01-01 00:27:00,Valvula IN 01V001 A50,0,1

2008-07-01 00:00:00,Valvula IN 01V004 A50,0,1

2008-06-30 00:00:00,Pressao Vapor Caldeira A17,1.256,1

2008-01-01 10:00:55,Consumo - Agua da Rede A17,3.74,1

2008-07-14 10:27:58,alarmezecovisual0,1,1

2008-07-01 00:00:00,valor_calculado0,10.25,2

2008-01-14 00:28:00,alarmezecovisual1,1,1

2008-07-14 10:28:00,valor_calculado1,25.0,1

2008-07-14 00:00:00,SetPointZito0,20.25,1

2008-01-01 10:28:25,SetPointZito1,35.0,1

2008-07-14 10:33:58,Posição do elevador A17,26,1

2008-07-14 10:33:58,Freq. oscilacao da plataforma A17,-20.0,2

2008-07-14 10:33:58,Valvula IN 01V001 A50,0,1

 

This is supposed to be the transition from 2008-07-14 10:33:52 UTC to 2008-07-14 10:33:58 UTC, but as you can see there are a lot of bogus dates in between… the problem was a transient one (and darn difficult to track down), apparently the SimpleDateFormat class is not Thread-safe (I have 7 different work threads on this baby, not counting the dynamic RMI ones of course). Oh, oh, wait, what’s this on the SimpleDateFormat API docs?

 

Synchronization

Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.

 

RTFM situation, I guess. Oh well.