+ Post New Thread
Results 1 to 4 of 4
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 ...
  1. #1

    Join Date
    Dec 2006
    Thank Post
    Thanked 17 Times in 16 Posts
    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.

  2. #2

    Ric_'s Avatar
    Join Date
    Jun 2005
    Thank Post
    Thanked 770 Times in 598 Posts
    Rep Power
    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.

  3. Thanks to Ric_ from:

    netadmin (27th October 2009)

  4. #3
    sbrooks's Avatar
    Join Date
    Oct 2009
    Thank Post
    Thanked 4 Times in 4 Posts
    Rep Power

    Re: hitachi controls over the LAN

    Quote Originally Posted by claridentech View Post
    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

  5. Thanks to sbrooks from:

    netadmin (27th October 2009)

  6. #4

    Join Date
    Feb 2009
    Thank Post
    Thanked 5 Times in 5 Posts
    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

  7. Thanks to mrwITch from:

    netadmin (28th November 2009)

+ Post New Thread

Similar Threads

  1. Visual Basic 2008 help
    By DSapseid in forum Coding
    Replies: 1
    Last Post: 24th June 2009, 11:03 AM
  2. Im New To Visual Basic 2008....HELP!!!!!
    By firerescue in forum Coding
    Replies: 2
    Last Post: 17th December 2008, 11:10 AM
  3. Visual Basic 6
    By Samson in forum Windows
    Replies: 4
    Last Post: 30th August 2007, 12:41 PM
  4. Visual basic 6
    By Halfmad in forum Windows
    Replies: 9
    Last Post: 11th June 2007, 02:57 PM
  5. Projector rs232 control
    By netadmin in forum Hardware
    Replies: 1
    Last Post: 11th May 2007, 12:06 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts