Language :

OpenZWave running on Synology DS1010+

October 20th, 2011

I have recently bought two ZWave micro-modules from Solution Domotique. These dimmer modules, branded Fibaro, will support up to 500W. Here is the Datasheet. A nice review (in French) can be found here: Fibaro Micro Module Review (Maison et Domotique).

To discuss with these modules, I have bought a cheap USB to ZWave controller. It might have been indeed a bit too cheap, since it came without any documentation. Once plugged-in, Windows was able to suggest to download a driver for the Prolific PL2303 usb to serial adapter. Afterward, the system recognized the controller as a standard COM port.

I have downloaded Homeseer trial, and was able to easily associate everything together. However, the price for this software is not cheap, and will need either a Windows computer or dedicated hardware to run. This did not make sense for me, especially since I do own a nice Synology NAS already running 24h/24.

A nice group of people is working actively on making an open source implementation of ZWave. The project is called OpenZWave and can be found on Googlecode. It is still stated to be in alpha stages, but already worked pretty nice. It was pretty easy to have everything working on Windows, however, it has been more tricky on the Synology. The software requires libudev or libusb1.0 for the HIDAPI implementation, both of which are not available for the Synology. It is probably possible to compile these using the toolchains provided, but there is a much simple solution if you are using a simple COM port controller.


1) Compile the appropriate modules

You will need usbserial.ko, ftdi_sio.ko, pl2303.ko.

An excellent tutorial is found here : How to compile modules on Synology

After you install the modules on your NAS, you should see the following when you plug-in your adapter (dmesg):

[443446.488043] USB Serial support registered for pl2303
[443446.493306] pl2303 7-2:1.0: pl2303 converter detected
[443446.510895] usb 7-2: pl2303 converter now attached to ttyUSB0
[443446.517255] usbcore: registered new interface driver pl2303
[443446.523084] pl2303: Prolific PL2303 USB to serial adaptor driver

Note on which TTY your adapter is mapped. If for some reason /dev/ttyUSB* does not exists on your system, you can create it using the following:

mknod /dev/ttyUSB0 c 188 0


2) Modify the Makefiles and Sources

- Remove every reference to HIDAPI that you can find in the makefiles

- In Driver.cpp, also remove the inclusion and reference to HIDAPI.

- I also had to add a newline character at the end of 3 or 4 source files.

- Edit Main.cpp to ensure it uses the same ttyUSB on which your adapter is connected.

You can cross-compile on the same system that was used to build the modules. If like myself you have one of these newer NAS with an ATOM processor, it is perfectly possible to compile directly on it. Don’t expect it to be fast, but it works Smile

From this point, you can experiment with your ZWave system on your Synology NAS.

Hopefully, more to come on this Smile

FisherTechnik–OecoTech Project 2

July 6th, 2011

The second project offered by the OecoTech kit reuses many of the things we have built during the first project. This time, the plan is to build a Water Turbine. Instead of transforming the energy into motion and stop there, we’ll further convert it to electricity.

To accomplish this, we’ll use the motor provided in the set, and use a simple system to have its drive wheel put into motion by the water’s energy. To verify that the motor is actually producing electricity, we’ll plug-in a LED (Light Emitting Diode).

FisherTechnik–OecoTech Project 2–Water Turbine

One tip for the model to work properly: Do not extend the rubber band making the link between the big wheel and the motor axis to its maximum. It would only create more friction, and possibly make it impossible for a water stream to make the wheel move. In any case, we should always try to build the most efficient system => With the least wasted energy.

In the set, there is also a capacitor (called Goldcap) of 10F, which can hold quite a charge. I tried using it in parallel with the LED, but somehow it did not seem to light up. Maybe having the capacitor induces a voltage drop too consequent for the LED to illuminate.

FisherTechnik–OecoTech Project 1

July 4th, 2011

I have just completed the first project from the FisherTechnik – OecoTech box. This project teaches how to convert water energy into motion. As mentioned in the book, it is not possible to store the energy using the current setup. However, this leads to many ideas. I somehow wish now that I move into a nice house, with a river running through the back of my yard!


Since I can’t keep all the models constructed, as I need the parts to build the other ones (and I wouldn’t have enough space in my appartment to store everything anyway), I took a short video of the sawmill in action.


FisherTechnik–OecoTech Project 1–Sawmill

Off to the next project Sourire

Testing Windows Live Writer 2011

January 18th, 2011

Just a quick test post to see how this free software from Microsoft can make posting on a blog more fun. Somehow, even if being able to post straight from the blog is fun, offline software can help especially in case of slow connections, which I seem to get quite often during business trips.


I’m posting from Hong-Kong, within Cathay City. Looks like adding a picture with a simple drag & drop is not supported, so I’ll have to create a file locally.



Let’s see how that goes online Smile


And what about a map…

Map picture

May 11th, 2009

I have installed the Windows 7 RC on my main computer. Everything works at least as good as in Vista, fast and stable.

However, there is only little glitch that I came about, which can be solved very simply. Somehow, when putting my computer to ‘Sleep’, it would power back up after a random time interval. I believe I used to have the same problem in Vista, and it can be easily solved. 

In Device Manager, select your network card, and make sure that it can wake-up your computer only if it receives a magic packet:


windows 7 network card management

windows 7 network card management

With this setting enabled, my computer can now rest ( and more importantly myself ) at night, without being waken up :)

TinyXML and std::wstring

April 22nd, 2009

Level management (and content) is easily done with XML files. On Windows Mobile, we can use MSXML which is part of the system. However, it sounds like it is slow to work with. Many people advise to use lightweight, non-validating parser. So I chose TinyXML.

However, everything related to the filesystem on WM is based on std::wstring. And TinyXML, even in it’s “USE_STL” implementation, only support std::string and char*. So I thought that before falling back to MSXML, I could try to convert TinyXML to std::wstring.

First, I searched and replaced everything => 

char* to WCHAR*

std::string to std::wstring

All methods ( such as atoi ) converted to their wide char equivalent (… _wtoi)

oh… and all these “String” to L”String” :)

Everything went pretty smoothly, and I was able to get it to compile. However, nothing was working. Here’s the 2 problems that needed to be solved :

1) My XML file was saved as a standard ASCII file, not containing wide chars. I used UltraEdit’s convert to unicode function, and this solved the problem. I could see in the debugger that the file content was all right. Still, it could not be processed.

2) TinyXML is “aware” of Microsoft’s UTF-8 headers – 3 bytes at the beginning of the file. But it does not check for UTF16 signature. I simply added a check for “FEFF”, at the same spot where the UTF-8 check is done, and this solved it.

I can not guarantee everything works, but all the functionality I needed, navigating through nodes and gettings values, work perfectly fine !

Current Directory on Windows Mobile

April 16th, 2009

So it seems there is no “Current Directory” on windows mobile. If you open a file like this : 

fopen(“MyFile.xml”, … )

it will look for it at the root of the pocket pc. While it can be sufficient for testing, you don’t want to mess up this directory with files related to your application.

What you can do, is retrieve the pathname of the module ( application ) that is currently running : 


WCHAR lPath[256];

GetModuleFileName(NULL, lPath, 255);

std::wstring lPathWStr(lPath);

lPathWStr = lPathWStr.substr(0, lPathWStr.find_last_of(‘\\’)).append(L”\\MyFile.xml”);


This way, you can navigate to the folder where your application is stored, and add your data files in there, where they belong.

Also something interesting, to move configuration, or additional data files to your Emulator, you can setup a shared folder. In  your emulator : File => Configure => General Tab

All files drag&dropped in this folder ( on your computer ) will appear in the “Storage Card” of your Emulator, and you can move them around with the file explorer.

VSync not really working on Axim X51v

April 16th, 2009

Some time ago, when I started the development of my application, I remember having an issue with the Diamond. If I let the screen refresh as fast as possible, I experience a strange flickering on a random part of the screen. Never the whole screen, but a spot large enough to be annoying. After much time spent, I found out that adding a sleep(8) after the hardware page flip fixes the issue.  By the way, “8″ is the least amount of time spent to make the flickering disappear.

Does this mean that I can’t start drawing in my backbuffer straight after it has been flipped ? I should give some time to the hardware for the flipping, and then go ahead with my business ?

Since the diamond now uses hardware page flipping, I realized that it’s performance dropped (!) This is obviously due to the sleep(8). What if I remove it ?

6-7 fps improvement on the Diamond

8-9 fps improvement on the Axim, but flicker is back

Now, does this only happen on the Axim ? Maybe it’s a flaw in the hardware ? Or maybe it only concerns my own ROM.

And what would be the fix ? Should I assume that only the Axim is impacted, and I can put in a special case for it, or should I add some options to let the user tweak it himself ?

Hardware page flip… or not ?

April 16th, 2009

Always more issues coming in. When I check the device caps of the diamond, I know that it is able of handling hardware flips, and a backbuffer. When I call DirectDraw’s CreateSurface, I receive an E_OUT_OF_MEMORY error. How nice is that ? So I implemented a fallback mechanism, doing a manual copy to simulate the page flip. It worked out nicely.

However, since I can’t stop playing with my device, I have installed a newer rom, from  Somehow, the device is now initialized correctly using hardware page flipping. Was it a bug in Windows Mobile, and the newer build fixed it ? Was it a bug in the device driver ? I probably will never know…

Fun with GetAsyncKeyState() and the Emulator

April 14th, 2009

This is something that made me waste enough time that I can spend a few more minutes to write about it.

I have been trapping key usage with the GetAsyncKeyState() method. Quite handy. But somehow, I have been unable to catch the “action” button of the D-Pad within the emulator. Just an annoyance, as I can map another key, and it works fine on my two devices ( Dell Axim and HTC Diamond ). But what if another device shows the same issues ?

So I looked around… I tried many things, such as GAPI ( GXOpenInput() ) as I thought maybe the key was being trapped. I tried to setup some hotkeys, … nothing would do. The sample I had started coding from did not implement the basic WM_KEYDOWN handling routine. Of course, as it was replaced by GetAsyncKeyState(). I made sure to trap this message, and miracle, I was able to catch this button.

Now, I am unsure how nice it is to have 2 separate bits of codes doing basically the same thing. Also, I guess I will need to make sure some actions are not done twice. But this is the only way I could trap the middle D-Pad button on the emulator. All else has failed.