Coding Thread, RS232 Projector Control using Visual Basic in Coding and Web Development; I have installed Hitachi projectors in several of our classrooms recently. The models we purchased do not have on board ...
10th October 2009, 03:26 AM #1
- Rep Power
RS232 Projector Control using Visual Basic
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.
IDG Tech News
10th October 2009, 07:35 PM #2
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 to Ric_ from:
netadmin (27th October 2009)
27th October 2009, 07:25 AM #3
Re: hitachi controls over the LAN
a few quick pointers,
Originally Posted by claridentech
- 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)
- 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
- VB is pretty good for this kind of thing, with the functionlity of it and what not, you made the right choice
- 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 to sbrooks from:
netadmin (27th October 2009)
27th November 2009, 01:37 AM #4
- Rep Power
!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 IPort
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 to mrwITch from:
netadmin (28th November 2009)
By DSapseid in forum Coding
Last Post: 24th June 2009, 12:03 PM
By firerescue in forum Coding
Last Post: 17th December 2008, 12:10 PM
By Samson in forum Windows
Last Post: 30th August 2007, 01:41 PM
By Halfmad in forum Windows
Last Post: 11th June 2007, 03:57 PM
By netadmin in forum Hardware
Last Post: 11th May 2007, 01:06 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)