VM201 dll

I just have bought the VM201.

VM201 remote control allows to act on relays (close, open, get the state…)
Is there a dll that allows to use these functions in an own build vb.net program in visual studio for windows 7 environment?
If yes , is there a link to see the syntax of all the commands included in the dll?

Is there a program for smartphones like Nokia lumia series( like 800 for example) (Winphone)

Thank you for informations

Hi,

I don’t think you will find a DLL for this project as you control it through a web browser.
The only app for phone is for the iPhone.

If you would like a relay board to control from your system using software that you write you might want to look at the VM8090 (link below)

http://www.velleman.eu/products/view/?id=382512

This unit uses a USB port

Thank you for information.
I forgot to mention one of the requirements which I want to fullfil : these relays are not located near the PC but in another room of the house.
This room is 220V powered and CPL allows Ethernet communication without any cables.
VM8090 is intended for relays connected by the way of USB (not away from the pC).

Thank you for further information

Hereby a link to the VM201 protocol description.
Please allow 1h for server update.
http://www.velleman.eu/images/tmp/VM201_protocol.txt

VM201 dll
Thank you for the infirmation.
I was waiting informations in another form (at a higher level).
For the moment , I have to undersatnd what to dou with this protocol.
How to use it is my new probleme.
I think of it.
Thank you again
barbeblanche866 from Belgium (motherlanguage : French)

HI VEL427
…or anyone Velleman Support

I red carrefully the VM201 TCP protocol you sent me.
Thank you again.

a few questions about this text:

1.at the beginning has the 0x0F value (decimal 15)
At the end (when defining constants seems to be equal to 0x02(decimal 2)
Which is the good values?

  1. same probleme with values 0x04 and 0x03

  2. perhaps other conflicting values? Is there a more recent document over VM201 TCP protocol?

  3. The second byte of the packet is : number of bytes including STX and the
    BUT NOT
    When I Count this number of bytes I have a number lower (1 unit) than the number given in the syntax of each command.
    tells for 1 byte I suppose?
    How to explain this difference of 1 unit in the byte count ? shoul be incuded in the byte count?

After your answer I try to use tcp client in vb.net to send data (following VM201 TCP protocol you mentionned) to see if VM201 answers correctly

Thank you for further information

Velleman support,

Thank you for the protocol description and the fantastic support.
Now I really can’t wait to get my VM201.

The protocol file is a mess

The correct values are
STX = 02
ETX = 03

List of commands:

  VM201_CMD_AUTH_REQUIRED  = $41; // 'A'
  VM201_CMD_USERNAME       = $55; // 'U'
  VM201_CMD_PASSWORD       = $57; // 'W'
  VM201_CMD_AUTH_OK        = $4C; // 'L'
  VM201_CMD_AUTH_FAILED    = $58; // 'X'
  VM201_CMD_CLOSING        = $43; // 'C'
  VM201_CMD_CHANNEL_NAME   = $4E; // 'N'
  VM201_CMD_STATUS_REQUEST = $52; // 'R'
  VM201_CMD_STATUS         = $53; // 'S'
  VM201_CMD_SWITCH_ON      = $4F; // 'O'
  VM201_CMD_SWITCH_OFF     = $46; // 'F'
  VM201_CMD_TOGGLE         = $54; // 'T'
  VM201_CMD_PULSE          = $50; // 'P'
  VM201_CMD_ENABLE_TIMER   = $45; // 'E'
  VM201_CMD_DISABLE_TIMER  = $44; // 'D'
  VM201_CMD_TOGGLE_TIMER   = $47; // 'G'
  VM201_CMD_FORCE_STATUS   = $56; // 'V'

Checksum calculation in Delphi (pascal):

function VM201Checksum(Data: array of Byte; Size: Integer): Byte;
var
  i: Integer;
  n: Byte;
begin
  n := 0;

  for i:=0 to Size-1 do
    n := n + Data[i];

  Result := (1 + (not ($FF and n)));
end;

VM201

Thank you VEL 448 for cute informations.

Now I can calculate a ckecksum and I know the values of all bytes included in a command to be sent to the VM201.

But I want to explicit an example for the checksum.

Suppose I want to put ON the relay 1 (channel 1 and bit 0)

The syntax is :
<6> <VM201_CMD_SWITCH_ON>

is 1 because the least significant bit must be 1 to put relay 1 ON

would have heen 2 if I wanted to put ON Relay 2,
4 if I wanted to put ON Relay 3,
128 dec if I wanted to put ON Relay 8,

This Gives the sequence of bytes to be sent to VM201
STX=02 and ETX is 03
02,06,4F hexa or “O” ,01,checksum,03 in hexadecimal
or 02,06,79,01,Checksum,03 in decimal

Question 1

But what are the numbers taken into account in the checksum calculation given by your function VM201Checksum ?

are they 06,4F,01 ?
are they 02,06,4F ,01 ?
or …

2.Question 2

I do not understand why the is 6 because LEN is defined as the number of bytes in packet including and
For Me would be 5 .

I feel I miss something but what?

Thank you.

Step by step , the solution in nearing:-)
BB1866

Whatever happened to experimenting and figuring things out? :slight_smile:

The length is the length of the entire packet, every byte
<6><CMD_TOGGLE>

1
2 <6>
3 <CMD_TOGGLE>
4
5
6

The checksum is calculated by adding every byte up to the checksum byte
checksum = + <6> + <CMD_TOGGLE> +
Inverting the bits
checksum = not checksum
And adding one
checksum = checksum + 1

VM201
Hi Velleman support
Step by step…
Thank you very much for precisions.

I want to put the relay 1 ON which was OFF

I send the following bytes:
02,06,79,1,0,3
79 is the VM_201_CMD_SWITCH_ON
0 is the checksum

I receive from VM201 the following bytes
02,5,76,173,3,…

The last checksum (173) is right but how to interpret the 76 value?
Is it a status ? What are the rules? What is the syntax of the answer?
Do you see any reason to explain the relay 1 remains OFF?

Is there a new document (for VM201 TCP protocol) replacing the one posted earlier by a velleman support?
This document seems to have a few problems giving uncertainties

Thank you very much

BB1866

02 06 4F 01 ? 03

  1. Sum: 02 + 06 + 4F + 01 = 58
  2. Invert the result: 58 (01011000) → A7 (10100111)
  3. Add one: A8
    So your checksum of 00 is not correct, hence the board will not understand the packet to switch the relay off.

The decimal number 76 is 4C in hexadecimal

VM201
Hi Velleman support

I had a few problems when translating checksum routine from delphi to vb.net . I think it is solved.
The problem was whem a som becomes greater then 255 (more than 1 byte) .
The following commands are ok : switch on or off a channel, pulse an output channel , enable or disable an output channel timer…

A)
I have sent a status request command to VM201.(2,5,82,167,3)
I received this aswer:
2,22,78,1,86,111,108,101,116,49,0,0,108,0,135,134,238,100,154,247,2,3
I understand a few bytes :
,, , …Volet1 (86,111…49)// the name of the first relay is Volet1

but how to decode the remaining bytes 0,0, …154,247,2 , ?

B) if 12V disappears and appears again , the state of the relays is lost.
It implies a continues survey of what happens near the VM201 .
Have you the necessary hardware on board (eeprom …) to memorize the relay states before 220V falls down?
Do you consider this as an improvement? If yes to be included in a further software release?
is your card able to download a new software version ?

Thank you very much
BB1866

Retaining the status of the relay is not implemented.
At this time, there are no software updates planned.

VM201

Thank you for answer.
After my questions, I found a solution to switch on, switch off, pulse relays…
I found out how to request the output status and where to locate it an how to decode it.
But only in VB.net (using streams)
For each change state, I memorize all the relay states. At start up , I put relays on or off depending on the memorized state.

I saw yesterday a post with cgi commands .
I did not see that anaymore.
If available , the list of these commands would be appreciated.
This commands seems to be similar (syntax ) with those used for the web server included in most
IP cameras.

BB1866

Hello,
I want to use the tcp protocol to communicate with the vm201.
What clent tcp can be used on windows or linux?
What is the syntax do I use it to send packets?
How to get the message back?
Sample packets: February 06 A8 4F 01 03 is this correct?
Thank-you

A lot of information is available from other topics, like:
viewtopic.php?f=37&t=8598&p=33039&hilit=VM201+protocol#p33039

Hello,
I have an android application, I send a string characters type …Tÿ¥. but android can not send all of these characters at the beginning and the end. Do you have any idea?
Thank you

Why not?

I don’t know why, maybe the problem is with the character system of Android, even by saving the string in a file, the system does not display all characters.