View Full Version : How to control Velleman K8055.VM110 card from Girder 6?

January 8th, 2016, 05:38 AM
Dear forum members,
this is my first post on this forum, and I offer all of you my sincere and best wishes for the New Year.

I am building a robotic interface to allow my wife (who is tetraplegic) to control her environment by voice commands.
Girder 6 could be a nice solution using the NetRemote Dynamic GUI to link to different modules such as USB-UIRT (for the radio/TV appliances) or a X10 or Z-Wave box (for domotic devices).
I have a Velleman K8055/VW110 card connected to my PC, that I can control through a small Visual Basic application (digital and analogic inputs and outputs). This works well with the Windows 10 voice recognition.
However, I would prefer to get the same controls in the NetRemote Dynamic GUI windows, so my wife would have a unique and consistent interface.
I searched the entire forum on this topic, but the related posts, which are already quite old (last post in 2009 with Girder 5), do not provide helpfull answers.

Is there anyone in this community who experienced interfacing a K8055/VM110 board with Girder 6/NetRemote? If yes, I would greatly appreciate your advices, and even more getting some plugins or Visual Basic codes to do so.

Many thanks in advance for your assistance.
With my grateful regards,
Vincent Euverte
NB.: I am not very knowlegeable in this domain, but I am ready to learn and able to do some simple programming (e.g. in VB).

January 8th, 2016, 08:25 AM
Hi Vincent,

Sounds like a great project. Do you need feedback from the unit or are you only setting outputs? If all you need are outputs you could potentially use a commandline tool to set the outputs and trigger that from Girder "File Execute" action.

Does that sound like it would work for you?

January 8th, 2016, 08:49 AM
Hello Ron. Many thanks for your swift answer.

In fact, I may need both inputs and outputs (mainly digital ones, for I have not developed any use of the analog input/output so far).
But to keep it simple, lets separate the two aspects :
* for inputs, I believe it could work by sending an action request via "csevent" from my Visual Basic program. I just installed the trial version of Girder 6 and need to test this approach. Should you have a script in Visual Basic, I could incorporate it in my current application.
* for outputs, your recommendation may work, but I do not understand exactly what should be the execution file triggered by Girder. Would you have an example that I could use (preferably in Visual Basic)?

By the way, a side question : where can I find documentation on the Lua language?

Again many thanks for your assistance. Regards,

January 8th, 2016, 08:58 AM
As far as outputs goes I think we are misunderstanding each other. Would Girder talk to your VB app, and then your VB app talks to the K8055? One possible way is to set up a small TCP server in m your app that Girder connects to. Would that fit with what you are trying to do?

Girder's Lua extensions are documentated in the manual under Help->Manual->Scripting

Lua is here: http://promixis.com/lua/contents.html

January 8th, 2016, 09:27 AM
Thanks for the Reference Manual on Lu Language. This will help me a lot.

Regarding the outputs to my K8055 card, I must admit that I am not familiar with this kind of programming.
If there is a way to use the DLL library from Girder/NetRemote, it would probably be the simplest solution. But how to do it ? Did anyone attempted such a thing?
If not, then the solution is probably for Girder to talk to my VB app ... But I have no experience with TCP communication. I undesrtand that it allows to pass character strings from a client to a server and vice versa, but I do not know the technique to do it. Again, a example script would help me (then I can work it around to adapt to my VB application).

Looking forward your insights.
Regards, Vincent

January 8th, 2016, 10:12 AM
I could probably do a quick wrapper for the 32bit DLL. Note that since Velleman only provides a 32bit version you'd have to run the 32bit version of Girder as well. My todo list is only growing here this week, but I've added it to the list. Hopefully I'll be able to make some more headway next week on all these items.

January 8th, 2016, 10:55 AM
Your proposal looks great, even if it requires some delay ... I have so many other things to progress in parallel in this project ! And being the latest requestor ... I must be patient !

What puzzles me is your statment about the 32bits version : My PC currently runs under Windows 10 / 64 bits using the standard K8055D.dll from Velleman, with a VB program derived from the demo provided on Velleman's website. I used Visual Studio Community 2013 to adapt the control application.
So I wonder if I will be really forced to install the 32bits version of Girder (and what I will loose from the 64bits one) ... and would that mean that I will have to create a 32 bits environment on my PC (I hope not) ?
(I apologize for these naive questions ... I am really not familiar with these technical aspects).

Regards, Vincent.

January 8th, 2016, 11:10 AM
No losses w.r.t. 32 vs 64 bit. You can run 32bit applications on a 64 bit windows no problem. What is impossible is for a 64 bit application to load a 32 bit DLL. Thus when installing Girder you must choose the 32bit version.

January 8th, 2016, 03:41 PM
Well it's your lucky day. I've worked on a quick implementation. Please download the attached zip file, make sure you have Girder 6 32 bits and extract the archive into the Girder directory. After install verify that you have k8055.dll in the plugins directory and k8055d.dll in the main directory. Then restart Girder (make sure it's not continuing to run in the traybar). I didn't get a chance to write the docs yet but this plus the velleman docs should get you going:

Preliminary K8055 docs. The API is based closely on the Velleman K8055 DLL. To use first enable the K8055 plugin. All function names have been changed to camelCase with first letter being small.

myk8055 = k8055:create( cardNo )

if ( myk8055:open() )
print("k8055 opened succesfully.")
print("could not open k8055")



myk8055:open() doesn't take a cardNo ( cardNo was already passed to create)

val1, val2 = myk8055:readAllAnalog() (parameters are returned not passed by value).

January 9th, 2016, 04:12 PM
Dear Ron,
First of all, great congratulations and thousand thanks for your incredibly swift and very efficient devolpment.

Following your instructions, I replaced the 64bits by the 32bits Girder 6 trial version, installed the two DLL as recommended, and started to test the different functions.
I have been successful with most of them under Girder, being able to control the analog and digital outputs, as well as capturing the analog and digital inputs in "Scripting" actions in Girder.
There are just three minor functions that I was not able to implement under Girder (this is not critical at all, so there is no urgency to develop them) :
* 'SearchDevices' function: provides all the K8055 cards which are connected (in theory, it is possible to have up to four cards running in parallel).
* 'Version' function: provides the current version of the k8055D.dll (currently
* 'SetCurrentDevice(CardAdress)' function: the DLL documentation refers to it but I have not found its purpose and I never used it.

Now, regarding the implementation in NetRemote Dynamic, I have few "beginner's questions". I spent hours in the manuals and in the forum without finding the answers which nevertheless must be very simple. So I apologize in advance for my ignorance.
As I said above, I have available in Girder/Lua all the values (boolean for digital inputs and outputs, integer byte 0-255 for analog inputs and outputs). I placed them in variables in separate "Scripting actions" in Girder. So I can control the outputs to the K8055 card, and read the inputs from the Lua Console.
Under NetRemote, I prepared the User interface with sliders (for analog I/O) and toggle buttons (for digital I/O). My objective is obiously to control the outputs and to display the status of the inputs in a NR control board.
I succeeded to action the digital outputs by assigning an event when the toggle button is changed in NR ; however, I need to keep the status in a global variable in Girder for the next toggle, as I did not find how to exchange variables between my Lua scripts in Girder and the elements in NetRemote.
So my questions are:
* What is the syntax in Lua to obtain the current value of a NetRemote element (toggle button or slider)?
* What is the syntax to modify the value of a NetRemote element (toggle button or slider) from a Lua script in Girder?
I believe I will succeed to complete my project with these answers, and stop worrying you with my naive questions.

Looking forward your help, and again with my great thanks and regards,

January 10th, 2016, 08:46 AM
My DLL docs are here: http://www.velleman.eu/downloads/0/user/usermanual_k8055_dll_uk.pdf

'SearchDevices' probably just does an 'open' on all 4 possible cardNo's. So that's not really important.
'Version' is not documented but it looks like I can figure out what it does.
'SetCurrentDevice' can't find any details on this either, but I don't think we need it.

I don't have time today (it's Sunday) to go into detail but what you are looking for is the "kv" system. This is a shared variable pool between NetRemote and Girder. Both can change the value and are notified of changes by the other. There are some examples in the ui directory and NetRemote Dynamic has support for "KV Sliders" and "KV ToggleButtons". Look into that a bit and see how far you get. (Girder's side documented under scripting/kv )

January 10th, 2016, 05:48 PM
Dear Ron,

Again many thanks for taking time on my questions even during the week-end!

Yes, I fully agree that the three missing functions are not essential, and workarounds can be found easily. My comment on this topic just in tended to have the complete features of the K8055 DLL (by the way, the attached PDF documents these missing functions).

Now, regarding my question on exchanging values between a Lua script in Girder and an element in NetRemote, I understand that it works through the KV system. I am able to see the updated values in the Variable Inspector when it is changed in NRD.
I even found a dummy trick to get the updated NR value in my Lua script and send it to the K8055 card with the following code (picked from an example in the Girder Manual p.154). However, I amguess there is a simpler syntax to do the job.

kv.get("Digital_Output1", function( values, success )
for key, value in pairs(values) do Out1 = value end
if(Out1=="1") then myk8055:setDigitalChannel(1)
else myk8055:clearDigitalChannel(1)

The other way around, I have not been able to find the syntax to modify the value of a NR element (toggle button or slider) from a Girder Lua script. I am looking at something simple like : "MyNetRemoteObjet = NewValue", where MyNetRemoteObjet is the KV-name of the toggle button or slider, and NewValue is either a boolean (toggle button) or a integer (slider).

I apologize for this very basic question ... I spent hours in the documentation and the forum. I found a dozen of topics since 10 years raising the same questions ... without finding a clear answer. Being French mother's speaker, may be my English is not good enough, but I really have difficulties to understand the syntax to be used for the KV system, and there is no example to follow, apart the one on the 'kv.get' function. As well the Lua Manual does not refer at all to the KV system (or may be I do not have the right reference manuals?).

Looking forward your assistance, with my grateful regards,

January 11th, 2016, 12:41 PM
Ah I see. I've added support for those functions, but made it optional. If someone has an older DLL with those missing ( like the Linux library ) it could still work. Note the Linux library is currently untested. These updates will roll out with the next release.

As far as the KV stuff. I've put something together that you can use directly. Download the attached zip file and import the GML file into Girder ( file -> import ). Then hit script reset.

Next open Netremote Dynamic and click on "Import Pages..." in edit mode. Note that importing will overwrite the currently displayed page, be-warned. I've put a few controls in place that show values from Card 1. If you have a different card number adjust the KV values in the control properties.

January 12th, 2016, 12:30 PM
Hi Ron. You are really brilliant!

These two small files run perfectly and efficently (I increased the refresh frequency to 0.25 second without impacting the processor load ... and very small impact at 0.1 sec).
Moreover, the way you put the code makes it very easy to understand for me.
You know, I am from the Old School, and can read and speak "ancient languages" (say Fortran, Basic, Cobol, Visual Basic, ... even Assemblor), but I am not familiar with C++, JavaScript, ... So I generally practice with cut & paste and by trial & error ... therefore practical examples are the best for me !

From now on, I will try not to disturb you anymore and will post new questions only in case of real stonewall.
Again many thanks for your great assistance.
With my best regards, Vincent

January 12th, 2016, 01:04 PM
I'm glad this works for your Vincent! Now you can add "Lua" to your language list!

Feel free to ask, if you have a question there is probably several more people with the same question and they'll find your threads here.