Sending a byte to a RS232 port from a remote internet machine

J

Thread Starter

Jesper Thusgaard

Hi

I have an internet machine (P200) dedicated to a robotics project, it runs either Linux or Windows9x. I also have an robot (LEGO) that I need to control via the internet. But I need the software that runs on the machine (set up as server) and allows me to go to a webpage and control the LEGO robot. The robot has two engines that both have forward/stop/reverse functions. Where can I get such a software or can anyone write it for me?

At the moment the byte sent desides what happens with the robot. And these are the control characters at the moment:

Forward: 1111
Stop: 1100
Reverse: 0000

So if I want Engine1 to go Forward and Engine2 to reverse i send the byte 11110000.
And If I want the robot to stop I send: 00000000.

But I need everything that makes this work from the homepage on the server or
on the net to my RS232 plug at the back of the computer!!!
 
G

Gilles Habel

Are you aware that you can have a PLC's with a Web Server card ???
You should look at the Schneider Web site ( "http://public.modicon.com":http://public.modicon.com ) under FactoryCast Web Server for more details.

You could put your own Web pages inside the FactoryCast Web Server module and control your pattern of bytes with discret output module.

Gilles Habel
Schneider Electric (Canada)
 
C

Curt Wuollet

Hi Jesper.

Here's the simplest way do what you want to do.
Install c-kermit on the remote (linux) machine. (free).
Telnet to the remote machine. login.
Type kermit
set line <port>
set speed <speed>
set carrier off
c

You now have a screen up that will let you send any byte value you want to the port. I believe you use
/15 for 00001111
/12 for 00001100
/0 for 00000000
etc.

You can set up a user account for this with a .kermitrc that will do the setup for you so all you have to do is type the control bytes.

That's the simple way.

There are several other ways to do it with linux, the c-kermit simply gives you an easy way to enter byte values.

Doing it from web page would require some cgi stuff beyond our scope here.

It would also be fairly easy to write a sender and listener that would communicate with sockets. Any networking text would have boiler plate for this in C

If you have questions, go ahead and ask or contact me off-list.

Regards

cww
 
Curt:
> Here's the simplest way do what you want to do.
...
(snip c-kermit suggestion)

...
> Doing it from web page would require some cgi stuff beyond our scope
> here.

Actually, as written, it's about the easiest CGI stuff there can possibly be...

Just have nine cgi-scripts, one for each combination, that each say

#!/bin/sh

#do it:
echo -n X > /dev/ttyS0

#tell the user it's done:
cat response.http

where you replace X with the correct characters and response.http is a file containing a web page with the headers:

Content-type: text/html

<title>Command response</title>
<h1>Command response</h1>
'Tis done, my lord.

Somewhere in local.rc you do the appropriate bunch of stty commands to set up the baud rate and no parity.

Obviously, you want it to be controlling something particularly harmless if you're going to let random people around the Internet to do stuff...


Jiri
--
Jiri Baum <[email protected]> http://www.csse.monash.edu.au/~jirib
MAT LinuxPLC project --- http://mat.sf.net --- Machine Automation Tools
 
Top