Jump to content

RS232 Projector Control using Visual Basic


Recommended Posts

Posted

I have installed Hitachi projectors in several of our classrooms recently. The models we purchased do not have on board network ports, so I installed a Lantronix device server at each projector (the Lantronix device server converts the RS232 connection to an IP address connection).

 

I have been using Hitachi's projector control software on the classroom pcs for the teacher to control the projector (no lost remotes). While the software does work, there are several aspects of the application that are not ideal for us, so I've started looking at the possibility of writing a simple Visual Basic program to control the projectors, rather than using Hitachi's application.

 

I have downloaded Visual Basic Express 2008 and have done some research on Google looking for tips on connecting to an RS232 port through a Lantronix device server (which uses an IP address), but have had little success in finding useful information. It looks like the RS232 codes are hexadecimal values and that I would need to use Winsock in Visual Basic to send the hexadecimal string to the Lantronix IP address. I have not come up with any ways to make this work yet, however.

 

Does anyone have any tips? I am new to Visual Basic (I usually do website programming), so I would appreciate any possible help on this project.

 

My future goal, once I get this application working, is to then expand it to have a central console showing the status of all projectors. Once I get the first application working, the console should be fairly simple to create.

Posted

A quick look at how the devices work shows that there is a COM 'redirector' for Windows which makes the device appear as a local serial port.

 

I'm not much of a programmer but this should help point you in the right direction.

  • Thanks 1
  • 3 weeks later...
Posted
It looks like the RS232 codes are hexadecimal values and that I would need to use Winsock in Visual Basic to send the hexadecimal string to the Lantronix IP address.

 

a few quick pointers,

  1. WINSOCK is kind of outdated, i found this out when trying to get a VB6 project upto spec (VB 2008) and was curtly in formed multiple times by the MSDN people that winsock is out dated, supposedly it is possible to use it but nowadays its better to use the System.Net.Sockets class (which if you ask me is quite alike to that of winsock)
  2. Depending opon the card you bought it might be required to encrypt the data in a certain way before sending it, so that might be tricky
  3. VB is pretty good for this kind of thing, with the functionlity of it and what not, you made the right choice
  4. The MSDN guys are much more likely to have a really good answer to your problems, they're pretty into it

 

oh and one question, TCP or UDP? this one you will have to answer before continuing

  • Thanks 1
  • 5 weeks later...
Posted

claridentech

 

!st off - if you're going to ignore the Hitachi application and write your own tailored app

 

Get the Hitachi comms protocol / command set clear

These are the ONLY instructions that the projector understands & there may be certain command/responses that have to be understood to make it do what you want

 

Now intially write you VB app so that you can issue / respond to the set(s) of command/responses you need

 

Now plug in a projector to a serial port on your PC & have your App configure access to a serial port, then run up your app & make sure your command-set achieves what you want

 

At this point you know how to control the projector

 

Now we have to figure out how to stick the Lantronix device server in the middle of it all

Which Lantronix device are you using

 

From a quick look at their documentation - it looks like you're going to have some choices of how to talk over your LAN to this unit - but the idea will be that what you just got working over the serial interface (directly to the projector) will now be actioned by the Lantronix device

 

So you'll probably be establishing a socket based interface with the Lantronix device

Plug in the Lantronix - you'll probably want to fix it's IP address within your LAN

Find out what port it listens on

Establish a connection from your app to that IP:port

Now you can issue an instruction & the lantronix at the other end should spit it out as serial

 

When you establish a LAN connection to the Lantronix you may have to tell it what port to reply to you on - your App will need to listen on that port accept the incomming connection request, open up a socket and capture/process the incomming responses

 

Typically with Command/response serial comms you issue a command and wait up to a timeout period during which you expect to recieve the response

If a timeout occurs your app needs to decide if it should retry (how many times) or report a failure or whatever

 

You should study the Hitachi comms protocol and make sure your app handles all appropriate failure scenarios

 

 

With serial comms - one of the most important things is to manage the Receiver properly

It is very easy to accumulate received byytes but never be able to find the start/end of a message

 

If you think about writing a clean receiver right form the beginning things'll go smoothly

 

write your VB code in a simple event based manner and you'll be OK

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...