Welcome, Guest. Please login or register.

Author Topic: Connecting Ethernet device to serial port  (Read 19035 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #29 from previous page: May 27, 2008, 07:26:04 PM »
Quote
odin wrote:
Ah...the joy of last minute studying and the relief of forgetting it all instantly the moment you walk out of the room where the exam was =).

The exam was actually quite fun :crazy:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #30 on: May 27, 2008, 07:28:22 PM »
Ok here's a packet being sent to the RFXCOM, sniffed from the Ethernet port of the computer, when it turns on a power socket:


00000000 21 70 00 00 12 04

3



So I'm guessing if I just write that to the socket from my test app, it should have the same effect as the original Windows app sending it? :-?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #31 on: May 29, 2008, 07:43:54 AM »
Hmm, ok the data inside that Ethernet packet (21 70 00 00 12 04) corresponds to the hex values you would send to the virtual COM port for the same command. So perhaps the COM port redirector isn't doing anything fancy after all, just wrapping those hex bytes up in a TCP packet. I'm going to try something which will probably seem overly elaborate, but will test a theory:

Windows machine running terminal emulator <-> real COM port <-> serial cable <-> real COM port <-> Mac <-> MultiCOM redirector <-> RFXCOM (over Ethernet)

If that works then I will know it's possible to use MultiCOM on the Mac as the COM port redirect. I am already in contact with the author of MultiCOM who reckons it should work with a virtual COM port, making the setup like this:

Application on Mac sending hex bytes <-> virtual COM port <-> MultiCOM redirector <-> RFXCOM (over Ethernet)

Bloodline, you reckon it's quite simple to set up a virtual COM port under OS X. I have Googled it but can't find out how. Would you mind pointing me in the right direction?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #32 on: May 29, 2008, 09:46:25 AM »
Right! First test worked. Snooped the serial port while pressing a button to turn a light on and got the hex values it sends. Then under Windows, opened a terminal and sent the same values to that COM port, and the light turned on! :-)

Next step is to make sure Multicom works as a redirect on the Mac side of serial data to the Ethernet port.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #33 on: May 29, 2008, 12:21:42 PM »
Eventually yes. I just snooped one code to test it.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #34 on: May 29, 2008, 12:26:35 PM »
By the way there is practically no documentation about what is actually happening "behind the scenes", which is why we don't know how to replicate it. That's why we're having to "reverse engineer" it piece by piece.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #35 on: May 29, 2008, 12:56:41 PM »
Yes, it has all the information you need to use it via the HomeSeer interface, but no information which is useful for developing your own interface.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #36 on: May 29, 2008, 02:40:57 PM »
Quote
bloodline wrote:
What you need to do is set up a loopback device... I used to use them all the time before we had Rewire and Core Audio/Network MIDI.

It craetes two COM device on the system that are actually conencted so that you put data in to one and it pop out the other... then you connenct one end to your Terminal and the other end to the MultiCOM software.

Do you know how to do it with serial ports in BSD? (Will Google loopback devices in the meantime)

Quote
bloodline wrote:
-Edit- If you can't do it in software... use two serial ports on the Mac and put a Null Modem cable between them... Einfach!:-)

That's the fall-back option :-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #37 on: May 29, 2008, 03:24:15 PM »
BTW just soldered up a serial cable and connected a PC running a terminal to the Mac Mini via its USB serial port. Ran Multicom and configured it to bridge the USB serial port to the IP address and port of the RFXCOM, typed a command in to the terminal emulator on the PC and it worked! Soooooo Multicom works as a redirector. Just need a virtual serial port or an additional USB one to loop back and we should be set! :-D

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #38 on: May 30, 2008, 01:36:36 PM »
Got another USB serial port and created a serial port loopback. I then pointed my test Applescript at one of the ports, and told Multicom to redirect the other one to the IP and port of the RFXCOM. Sent a serial command from my Applescript and....... it worked :-D I also knocked up a listener app which can detect commands coming back the other way and act upon them. So I now have total control over the RFXCOM from Applescript!

Anyone every used socat? It's a redirector which supports pty ports, so I believe I can use it to create a software loopback. The syntax looks extremely complicated though, and I don't really know what I'm doing!

Thanks for all the help so far :-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #39 on: May 30, 2008, 02:42:03 PM »
Quote
bloodline wrote:
Had you ever doubts?!?! ;-)

Of course not! Ok, well maybe a bit :-P It's an interim solution IMO. We need bidirectional control, which due to the way the RFXCOM works requires two separate connections on different IP ports. That means we need two serial interfaces, so two serial loopbacks, and therefore four serial ports! If I can get it working with socat then I will be very happy as it will be an entirely software solution.

Quote
bloodline wrote:
Now can we please figure out a way to get my damn PowerMac going :-D

BUY A KEYBOARD! :-P

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #40 on: May 30, 2008, 04:02:30 PM »
Quote
bloodline wrote:
A software solution is totally possible... I'm pretty sure you can use pipes or something... I foget how this all works on Unix...

I'm waiting for a reply on a Linux forum where I asked for help with the syntax for socat. Hopefully that will do the trick!

Quote
bloodline wrote:
But since the hardware solution proved it would work, I'm feeling quite satisfied!

Yeah, it's great that we finally got it working! At least now I can get the Applescript to a level where it can replace Homeseer, and then it's goodbye Parallels :-D

Quote
bloodline wrote:
To that sir, I say bum!

Hmm, not really sure how to respond to your bum...

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #41 on: May 30, 2008, 06:56:11 PM »
Done it :-D Here is the syntax for socat:

socat GOPEN:/dev/ptyp0 TCP:10.0.1.93:10002

Then I configured my app to send the commands to /dev/ttyp0 (the other side of the pty) and it worked! :-D

Cheers guys!

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #42 on: May 31, 2008, 09:28:13 AM »
Quote
bloodline wrote:
:-D

We rule, except when it comes to doing something simple... Like getting an old PowerMac up headless...

Well we don't even know whether that is working. The autorun VNC CD was a great idea, but obviously not much help if the OS isn't up!

When's your birthday? I'll get you the bloody VGA adapter! ;-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #43 on: May 31, 2008, 01:21:48 PM »
Or we just gave up to easily! If you don't want to buy an adapter, you'll have to solder a cable directly on to the old port ;-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #44 on: May 31, 2008, 07:08:31 PM »
Quote
Speelgoedmannetje wrote:
My washing machine has died recently...

Then you'll have to do it by hand...












...your washing, that is.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10