Announcement

Collapse
No announcement yet.

Need Rs-232 Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need Rs-232 Help

    I am trying to control my projector thru rs-232. I cant get anything to work. I tried connecting to it in hyperterminal but it does not respond to any of the commands. How do I know if my device is detected by my computer? In the device manager it just show COM1. Should my projector name show up there?

    #2
    Can only speak for my own experience but for the most part I think you will not know when a serial device is connected and not know what it is in device manager - they don't exchange data in the same way a USB device does. Only the software that connects to the device will be able to tell if its connected or not - what sort of commands is it expecting? Does it come with any software that you could monitor the port to see exactly what data is being exchanged (there are some freeware port monitor programs out there somewhere)? Have you searched on here aswell...someone may have written a script for it at some point..

    Comment


      #3
      Do you have the projectors connect parameter correct? Do you have the projectors directions on how the commands need to be formated and the communication protocols?
      -Rupp
      sigpic

      Comment


        #4
        Yes and Yes. But i'm not sure if my computer is seeing the device. How could I test this?

        Comment


          #5
          Originally posted by comgle64 View Post
          Yes and Yes. But i'm not sure if my computer is seeing the device. How could I test this?
          I would expect one of the commands supported to send to the device is an Acknowledgment command that can be sent and the device replies...i'm not sure there is another way to test it - if the port works (connecting another serial device to the same port?) and the cable works then the data must be getting to it...

          Comment


            #6
            http://files.support.epson.com/pdf/pltw1_/pltw1_cm.pdf
            Page 4 Shows how the command should be.

            this is the scrip I am trying to run.

            Sub Main()
            hs.OpenComPort 1,"9600,N,8,1",1,"",""
            hs.SendToComPort 1, "SOURCE A0"
            hs.CloseComPort(1)
            End Sub

            Does this all look right?

            Comment


              #7
              Years (over 10) with my Sony DTV box I would have to hit escape and some control keys to get a prompt on the RS-232 port. If you have an old modem with an RS-232 port on it I would connect it to the computer to test the port. Find the com number then type ATZ and see if you get a response. If you do you are fine with the com port on the computer. I would then maybe do a google search for the command structure, baud rate etc for your device to make sure you set your terminal for the right configs. You have to make sure too if its using a straight thru RS-232 or a null cable (cross over).

              -break working on a receipe for lentil soup with italian sausage....great stuff....
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X - HSTouch on Intel tabletop tablets
              Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
              HS4 Pro - V4.1.17.0 - Ubuntu 20.01/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono
              6.12.0.122
              HS4 Lite -

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

              Comment


                #8
                Try running this (call it projector.vb);

                Code:
                Sub Main(ByVal Parms As Object)
                
                Dim COMPort As Integer = 1
                
                hs.openComPort(COMPort, "9600,N,8,1", 1, "projector.vb", "Receive")
                
                hs.SendToComPort(COMPort, "SOURCE A0" & vbCr)
                
                hs.closecomport(COMPort)
                
                End Sub
                
                Sub Receive(ByVal Parms As String)
                
                hs.writelog("Projector", "Received From Projector: " & Parms)
                
                End Sub
                I can't test it and i'm a bit confused in those documents about the colon placement (as to why it would come before the data if it has been sent from the projector? Would think it would come after)...does anything go into the log?

                Comment


                  #9
                  Got it working with my original script. I had a couple of pins backwards on my db9 connector .

                  I did have to add +vbcr to the end of the string... Thanks for the help, I'm sure I will be needing more later on.

                  Comment


                    #10
                    Good News!

                    I make up my own RS-232/RJ45 cables and always have problems with the colors for the connectors - IE typically the red and brown wires. My wife helps me a bit with a very bright light to make up for my color blindness.
                    - Pete

                    Auto mator
                    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X - HSTouch on Intel tabletop tablets
                    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
                    HS4 Pro - V4.1.17.0 - Ubuntu 20.01/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono
                    6.12.0.122
                    HS4 Lite -

                    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                    Comment


                      #11
                      Originally posted by mrhappy View Post
                      Try running this (call it projector.vb);

                      Code:
                      Sub Main(ByVal Parms As Object)
                      
                      Dim COMPort As Integer = 1
                      
                      hs.openComPort(COMPort, "9600,N,8,1", 1, "projector.vb", "Receive")
                      
                      hs.SendToComPort(COMPort, "SOURCE A0" & vbCr)
                      
                      hs.closecomport(COMPort)
                      
                      End Sub
                      
                      Sub Receive(ByVal Parms As String)
                      
                      hs.writelog("Projector", "Received From Projector: " & Parms)
                      
                      End Sub
                      I can't test it and i'm a bit confused in those documents about the colon placement (as to why it would come before the data if it has been sent from the projector? Would think it would come after)...does anything go into the log?
                      I tried Your script and it sends the command to the com port but it does not write anything to the log.

                      Basically what I want to do is get the data from the comport and use that data to update the status of a virtual device.

                      Comment


                        #12
                        Originally posted by comgle64 View Post
                        I tried Your script and it sends the command to the com port but it does not write anything to the log.

                        Basically what I want to do is get the data from the comport and use that data to update the status of a virtual device.
                        It may be closing too quick to get a reply and/or that command may not give a reply, the way I think I would do it is to open it using the

                        hs.openComPort(1, "9600,N,8,1", 1, "projector.vb", "Receive")

                        line maybe putting it in your startup.vb (that way it opens when HS starts), then put another line in shutdown.vb so it shuts when you close HS down;

                        hs.closecomport(1)

                        that way anything received during the course of HS running would be sent to the Receive subroutine in the projector.vb script and hopefully then in the log. As long as the com port has been opened by whatever means you can send the data to it using hs.sendtocomport (perhaps from an immediate script command)

                        You would then need to examine what sort of replies you get in the HS log and look at the string to further examine it and set a virtual device, i'm not sure what else apart from the source you can get from the projector but it would then be something like (this is very rough coding, no error checking)

                        (This is based on the sample reply of 'SOURCE=21' in that PDF document if you give the command SOURCE?)

                        Code:
                        Sub Receive(ByVal Parms As String)
                        
                        Dim SplitStr() As String
                        Dim DeviceCode As String = "Z1"
                        Dim StartStr As String = "Projector Source:"
                        
                        SplitStr = Split(Parms, Chr(61))
                        
                        'this splits the string on the = sign, split(0) should hold SOURCE, split(1) =, split(2) should hold the actual source
                        
                        If SplitStr(0) = "SOURCE" Then
                        
                        Select Case SplitStr(2)
                        
                        Case "A0"
                        hs.setdevicestring(DeviceCode, StartStr & " HDMI", True)
                        Case "41"
                        hs.setdevicestring(DeviceCode, StartStr & " Video (RCA)", True)
                        Case "43"
                        hs.setdevicestring(DeviceCode, StartStr & " Video (YCbCr)", True)
                        
                        End Select
                        
                        End If
                        
                        End Sub
                        It would be something like that anyway...
                        Last edited by mrhappy; March 26, 2011, 06:07 PM. Reason: used a reserved name by accident...

                        Comment

                        Working...
                        X