View Full Version : Vizard output signals/voltages?

03-01-2005, 10:24 AM
We know Vizard can receive information from external hardware via plug-ins... But, can Vizard send data (e.g., voltage signal) to other hardware?

We have an experimental protocol in which subjects walk on a treadmill while viewing smooth/continuous motion simulations. The kind of motion and scenery changes every 30 seconds, and simultaneously we are collecting subject motion data via an optical tracking system. We would like to be able to accurately mark the changes in motion and scenery in time with signals (e.g., voltages) to another computer running LabView. This way, we can link changes in subject stability with changes in the scenes.

Can Vizard send signals, say through the COM port, to another device?

03-01-2005, 10:37 AM
Vizard directly supports a USB-based multifunction data acquisition and control device called LabJack. This can read voltages into digital values and convert digital values into voltages. This is probably the easiest solution since there is no direct support in Vizard to change the voltages on either serial (COM) or parallel ports.

LabJack multifunction data acquisition and control device:

You might be able to find some libs available from the Python community that provide direct control of parallel but I don't immediately know of any.

03-01-2005, 10:41 AM

Can Vizard call C or C++ code that will then trigger the desired signal through serial or parallel ports?

03-01-2005, 10:57 AM
Yes, if you have your own C/C++ code and want Vizard to execute it, that's very straightforward and relatively easy if you have a C compiler. The method is to buld a compiled Python module (DLL) that you "import" just as if it were a .py module. There's very accessible docs on how to "extend" the Python language on the Python website:


If you get stuck on this feel free to ask further.

03-01-2005, 11:22 AM

The Vizard SDK has an example on how to create a python plugin. You can download it here (http://www.worldviz.com/download/index.php?id=9)

03-02-2005, 04:09 PM
In preparation for developing a plug-in to send data to an external device, I have acquired a copy of the Visual Studio .NET version 2002... will this version work okay? And what version of Python is integrated with Vizard?

FYI, I ran across a Python plug-in module (Win32 Serial Interface Module) at http://starship.python.net/crew/roger/ that might do the trick. There seem to be a lot of interesting and potentially useful things for Vizard users on this website.

03-02-2005, 04:24 PM
Yeah, that version should work fine. Vizard uses Python 2.3. The Vizard SDK comes with the necessary python files in order to create a plugin.

03-02-2005, 04:30 PM
Great, thanks!

03-03-2005, 01:19 PM
I found a project on sourceforge.net called pySerial (http://pyserial.sourceforge.net/) in which someone has already developed a module for reading and writing data to the serial port(s). They provide a Windows installer as well as the source code. When I try to run the Windows installer, it crashes because there is "no python installation found in the registry." I click 'OK' and then the following window appears:


Why doesn't the installer find the version of Python that Vizard uses?

03-03-2005, 01:27 PM
Try running the attached script with Vizard. It should register Vizard as a python installation.

03-03-2005, 02:22 PM
That worked nicely... thanks!

03-03-2005, 02:45 PM
Okay, the module installed fine, but now when I try to import it within a script, I get the following error message:

ImportError: No module named serial

The installer placed files in the following directory:

C:\Program Files\Vizard25\bin\lib\site-packages\serial

The attached zip file contains all the source code. Only a subset of these was dropped in the above directory. The remainder are not able to be found at all on my hard drive.

Any suggestions?

03-03-2005, 03:00 PM
The pySerial library requires that you have the win32all python extension installed. You can download the installer here (http://starship.python.net/crew/mhammond/win32/Downloads.html). (Scroll to the bottom of the page)

03-03-2005, 03:18 PM
Thanks! After installing win32all, I was able to run my script (including 'import serial') without any error msgs.... however... near the end of installation process there were two successive error msgs.

The first is attached to this posting. The second is attached to the subsequent posting.

Is this something I should worry about?

03-03-2005, 03:19 PM
second error msg

03-03-2005, 03:22 PM
I'm not sure what the error is about, but if your script is working then I'm assuming that the files were installed correctly.

03-03-2005, 03:25 PM
Okay, I'll leave you alone....... for now! :D

03-07-2005, 11:08 AM
I've installed the opensource module for communicating through the serial port. Connected to the serial port, I have a numeric keypad. For any number I press, when I issue a command to read the port (e.g., "port.read()") a series of the following kind of data are shown:


Data encoded like this are called a "two's complement little-endian binary string"

By using the Python module "pickle," this data can be decoded into the following:


...which itself is encoded and is called a "long."

Have you ever dealt with this kind of encoded data? ...and decoding of said data? If not, can you refer me to a helpful resource ?

03-07-2005, 12:06 PM
The value '\xhh' represents a character with a hex value of hh. In your case the character '\x80' would be equal to the hex number 0x80, which is 128. If you wanted to convert a number to this character format you would do the following:val = chr(128)The variable val will now hold the character '\x80'. To convert a character to the number format you would do the following:val = ord('\x80')I'm not sure what the pickle module does and why it converted the character to -128L, but if you are going to be reading the data character by character, then the above functions should be enough.

06-28-2008, 09:30 AM

I am trying to access the serial port.

When I am doing

import serial

I am getting the error : No Module named serial.

I was going through the suggestion given in the Forum.

I found the following suggestion.................
The pySerial library requires that you have the win32all python extension installed. You can download the installer here. (Scroll to the bottom of the page)

When I am trying to download the installer, I am not getting it. Actually, the link given above is not working. Has the site changed?

If anyone has some information....it would be very helpful to me.



06-28-2008, 09:45 AM

I was trying to search the plugin.


Here we can find the latest as of June 19, 2008. This version being downloaded has solved my problem. It is detecting the serial port and error message is not coming.