Networking over serial with Webserver and Telnet

Since I upgraded my RSMedia to RSMV2 software I have been playing with networking over the serial port.....and I am VERY exicted to say that it is working really well.

I have it setup so that as RSMedia boots it will connect using PPP over the serial port to Windows PPP server. Once the connection is made you can create mulitple telnet connections from windows and get access to the linux console on the robot. At the same time I can also use the browser to see multiple web pages from RSMedia. (RSMedia is running the 'webs' webserver which can serve web pages. ) I have written a basic webpage (and a CGI-bin program) to allow some robot actions to be triggered from the webpage (eg ,dance, wave and say something using Text To Speech).

Here are some screen shots:The Telnet console:

The Test Webpage:

All the setup and programs needed for the RSMedia are all started from the rsupdate script as the robot boots.

Theres a zipfile with all the needed files at the RSMedia Robot Development Kit project on SourceForge. Click here to download them. It includes detailed docs on setting it all up , including setting up Windows PPP server (The instructions are for WIndows XP. Connecting via PPP will also be supported on Windows Vista, Win7 and Linux - but the setup will be different!!)

Whats next:-1)Write some more web pages/cgi-bin/java script todo some cool things: -Should be fairly easy to trigger almost any bodycon/robot command/macro from buttons on a webpage. - Could a webpage that does most of the function of the remote. - Could make a Webpage to show a jukebox to play music/playlists on RSMedia - Improved screen capture and then display the pics on a webpage. 2)Also now this is working well, I maybe able to go back to trying it over USB (instead of serial). Then anyone can use it without needing the serial hack!!

Anyone good at Web authoring/javascript and want to make some cool web layouts?

Helibot you are good at pushing the limits, but goes to show how RSM still can handle all the tricks you pull out of your sleeve. I am downloading it now. I'll try to refry your example with the page I made with your Screenshot program, once that's cooked I'll post it in the downloads wont be nothing fancy like some others here could do. I hope to see some advanced stuff come out like a web interface plugin for the RS Media manager by Vader. Good to know it will work for my wired usb no serial hack robots and wireless serial hacked robot. Telepresence for RSM seems round the corner. Looking forward to seeing what you do with your screencapture improvements you mentioned.

I think that telepresence RSM *might* be possible once RoboDance 5 comes out. At least I hope. I'll find out more about RD5's capabilities hopefully the end of June since that is when it's beta is due out (last I heard).

Hi Freddy,
It seems that windows thought it connectd the first time, but the robot failed to connect. I did see a similar thing when I was testing stuff with various combinations of settings but never traced the cause.
Rebooting the pc may help. You could also try removing the "xonxoff" from the pppd line in rsupdateapp script.
Does this happen all the time now? Or has it just happened once?

Hi Freddy,
Great to hear it is OK. Windows server is very fussy. I think it requires one second of no data , then the CLIENT then no data for a sec, then the second CLIENT, then the other PPP packet data. But unfortunately the RSMedia serial port is also used by the console so other messages can be sent to it as well. I have changed the startup commands to stop most of the messages but I cant get them all :-(.
When RSMedia plasy a sound it still output some characters to the console. So depending on the personality you have loaded, what he says and does could cary in time. So adjusting the sleep xx commands in the rsupdate command to be longer can help.
Cheers
Helibot

Hi Freddy,
To see if its related to the robot programs interferring , you can try not starting them!. Change the line in rsupdateapp
/mnt/sd/rsupdate/run_null.sh
to
#/mnt/sd/rsupdate/run_null.sh
This will mean all the robot progs wont start (so LCD wont start and most features on the remote wont work) but PPP connection should be better.

Hello all, after a couple day fussin I came up with a crude web page to control some of RSM basic features. It uses the rsmalarmclock and screenshot to get a picture of the LCD image and refreshes the page evey 5 seconds. Some things dont work well yet like track human starts but immidiately stops and a couple other things. Oh and everythime you push a button it goes to a diffrent page and you have to go back to get to the controls again. here is a pic.

Hey Freddy,
Looks very cool - I love it!!.
You can use a script to run the screen capture program every X seconds (instead of using rsmalarmclock app).
If you save the following to /Application/loop.sh file :-

then in the rsupdateapp file add a line
/mnt/sd/Application/loop.sh &
(this will start the captureing off every 5 seconds - it should keep running forever)
OR you could have a button on the webpage for 'show screen' and use the
do command exe to run /mnt/sd/Application/loop.sh
If you want to stop the loop.sh you could try the command 'killall loop.sh' (which you could also put on a button on the webpage.)

Hi all,
An update on what I have been playing with.....I have been trying to get Musicqueue Jukebox player to run on RSMedia. It sortof works , but it is crashing very often and I cant figure why :-(

On the upside I have compiled a MP3 player program called mpg321. (This is a free version of the popular mpg123 program for linux (which I found crashes on RSMedia!!))
Even if I cant get Musicqueue to run properly , MPG321 will at least allow a a list of files to be played (in order or randomly) so at least we can get some sort of music playlist to work on RSMedia.
Also to get MPG321 working I also tried gdb debugging over the serial PPP connection and it works great. I could single step the source code and inspect variables and set breakpoints!! (If you dont know about programming the previous sentance will sound like gobblegook to you!!) I will write some instructions about how todo it if anyone is interested.

Bad news is that I am not going to have much robot time over the next couple of weeks. But if I find some time I am going to look at the networking over USB again. (I am annoyed with the musicqueue jukebox now , so will take a break and come back to it!!)

Hi helibot, thanks a bunch for the screenshot tips. I'll try that out on my frankenstein page. Hope you figure out the jukebox,that sounds great. Also the gobblegook sounds intresting for debugging. Vader had mentioned to me that it might be possible to stream a low bit rate of video but coudnt give much details and I havent had much luck but I was able to recieve about 10 seconds of pre-recorded video on the page after about 1 minute of transfer. Better thatn nothing I guess. I only hope that someone with good web development gets inspired and make a real decent control page.

Hello, I've moved all my RSMedia stuff to Windows 7 and have tried to set my direct cable connection working on it. Here is where I've got so far.
created a modem using control panel, phone & modems in the modem tab.
The add hardware wizard appears, select do not detect my modem, select standard modem types, communication cable between two computers, next, select the port, wait while windows installs your modem, finish.
Next I create a dialup connection in network and sharing center, setup a new connection or network, set up a dial up connection. Enter a dummy number and name it, next it will try to dial, hit skip, close.
In network and sharing center, change adapter settings, select the new dial up, properties, general tab, delete the dummy number, configure, set baud, uncheck enable hardware flow control, ok it. In options tab, clear all checks, ok it. Done.
select the dial up, connect. CONNECTION FAILS
I check back in the settings and the speed is back to default and enable hardware flow control are back Arrgh.
Found this link, http://social.technet.microsoft.com/Forums/en/w7itpronetworking/thread/5...
Which describes changing a rasphone.pbk file to get things going. tried this but no go yet on win 7.

HELP!

Update: Using hyperterminal (took the dll & exe from xp)I can see that my Bluetooth com port works well and telnet ppp start ok.

Hi Freddy and Gerber, I have found out a bit more about PPP for Windows 7. Freddy your first step for creating a modem of type "Communication between computers" is correct. But the second step you used is for a dial up/dial out connection, but we want to setup an 'incoming connection'. Try these steps:- (Sorry the steps below will seem a bit weird, but using the search to find the "network connections" link is the only way I have found to open this dialog - there will be an easier way - but I aint found it yet!!)

Choose "help and Support" In search field enter "incoming connection".The first result should be "Setup Incoming VPN or dial-up connection".Click on it , and follow its instructions , it should say: Set up an incoming VPN or dial-up connection You can set up a virtual private network (VPN) or dial-up networking connection to your computer from another computer. For example, you might want to use this method to connect to your work computer from home. Follow these steps on the computer you want to connect to: 1. Click to open Network Connections. 2. Click File, and then click New Incoming Connection. 3. If you don’t see the File menu, press Alt. 4. Follow the steps in the wizard.

Note step 3 - you need to press ALT to see the file menu. During the wizard you should be able to choose the ''Connection b/n two computers" modem setup above. After creation open the properties for the "Incoming Connections" and find the ''users'' tab then tick ''Allow directly connected devices to connect withot password.''In the general tab select properties for the modem and set 115200 and no flow control.In the Networking tab choose TCP/IP properties and specify the same IP Address range settings we used for XP (I think it was 10.0.0.1 - 10.0.0.2 ??)

Hopefully that should do it.... I have set it up on my Win7 laptop (which doesnt have a serial port and its taken about 3 hours to get the right drivers for my old USB to serial dongle woriking in Windows 7). So I have set it up but havent yet tried a connection with RSMedia (or a linux PC) yet, so I dont know if there will be other problems. I give it about a 50% chance it will work OK!!!, but at least it should be another few steps forward!!.

Hi Helibot, a few steps forward it is. I tried it out, looks promising but didnt connect yet. looks like the settings are ok but no go. I'll keep at it I'm sure I'm just overlooking something minor as it does look all familiar now following your instructions. Checked in terminal and I can see the ppp start up and get clientclient. However when I set the incomming connection it doesnt show client connected.
Freddy

great news Helibot, it works after all!. i unchecked requre users to secure pw & data, and in networking i checked tcp/ipv6 and let rsm run. After a bit it connected! Now i can 10.0.0.2 to RSMM by vader, telnet via your instructions and view the webserver on rsm for webpage video again! yes, thanks a bunch helibot!

Hi Freddy,
Cool, Glad it worked for you :-).
I was also trying it tonight but it hasnt worked yet.....but I think that my USB-serial converter is not working correctly when lots of data is sent, so I will have to check that out first. (It would be so much easier if my laptop had a real serial port!)

BTW I did find that after you have opened the "Network Connections" dialog that you can drag the icon (on the left of the address bar in the dialog) to the desktop . It will make a shortcut that allows you to then open the dialog quickly.

Freddy thanks for helping me to setup the incoming connection in windows 7 last night on MSN. It would have taken me a lot long to the setup by myself. Even though I could not get network communication to the RSM I will persist and try and do the same setup on another computer with windows 7 and also one with windows XP.

Great work on finding the info on the windows 7 connection Helibot.

Will let you now how I get on and see if I can get the newtork onnection working on the RSM like you did Freddy.

Is there away of force the connection from the RSM?

Freddy what version of Windows 7 are you using (for example: Home, Ultimate,Etc.)?

As I haven't tried doing this on windows XP, did you have the same problem in respect to having to try reconnecting the RSM a number of times before a network connection was made to the RSM and a pc running Windows XP PC?

When I get My RSM connect I have so many software projects I want to do with the robot. So I am going to persist until I get it work.

Hi Gerber, I use Win 7 Ultimate. Yes it takes several tries to finally get the first connection even on xp. Since I've got it workig it connects better now and when I reboot the robot it will reconnect on its own after the bluetooth finds its connection to the pc.
Freddy

Yippee. RSM is now work on the network in windows 7. Big thanks for the help on MSN tonight freddy. And again big thanks helibot for find the way to connect to the rsm in windows 7.

I did find that it's a bit hit and miss and took quite a few attempts to connect to the RSM and then when I switched off the robot and back on it could take a couple of minutes to reconnect, but when it connected it was awesome. I set the sleep as freddy suggested from 120seconds to 30 seconds and I found the connection time was slightly quicker.

I have so many project to start working on now I am able to transfer file. The first one I think I will try out is live video streaming. I will let you know how I get on.

Big thanks again helibot, Freddy, Jamie and Vader for all the help you have given. Without you lot and the rest of the forum I wouldn't have got this far. I now am going to upgrade the firmware on the other 3 RSMs I have and start an RSM army.

I have one other question. When I connect the other 3 RSM's, do I need to setup idividual Incoming Connections as they are all an different com ports. If so what IP ranges can I use for example:
RSM1 =from 10.0.0.1 to 10.0.0.2
RSM2 =from 10.0.0.3 to 10.0.0.4
RSM3 =from 10.0.0.5 to 10.0.0.6
RSM4 =from 10.0.0.7 to 10.0.0.8

I’ve had the robot networked for about a week now. It is works great when the incoming connection is found on the PC. The only problem I find is that is very hit and miss getting the robot to connect on the incoming connection when I turn the robot off and then back on. Some times it can be a minute to find the connection and other times the connection is not found at all. I have a question, is there away to improve the reliability of the network connection or is this something I will need to live with?

On Friday I wrote a basic telenet console in VB.net which I have been able to test at work connecting to machines running unix over a network. Unfortunately I haven’t test it on the robot at home as I haven’t been able to get an incoming connection from the robot since Sunday. I am going to mod the software to allow connection via normal comport as well as the IP address.

I have only ever written software to do file transfer with FTP command such as PUT and GET and I have never done anything with Zmodem. The reason I am going to use Zmodem for the moment to transfer files is because I am having incoming connection network problem as stated above. I will eventually will look at work on the FTP but I am currently going to start with Zmodem in VB.net and I’ve found some useful stuff on the internet to help me develop my software to do with Zmodem.

Is Zmodem already installed on the RSM or will I need to put some software on the robot to enable Zmodem?.

Can anybody tell me the steps to transfer a file using zmodem on the RSM to hyerteminal or teraterm. With this I mean what commands in linx do I need to enter on the robot to transfer a file from the robot to the PC. For example: Would SZ TEST.TXT send the file TEST.TXT to the pc from the robot and RZ TEST.TXT to receive the file TEST.TXT from the PC to the robot. I am only guessing these commands as I have never used linx and don’t know many actual commands in linx. Also in Hyperterminal do I need to click on the Transfer menu -> Receive files before receiving or sending the file from the RSM.

Congrats on getting it going in Win7. Theoretically Win XP or Win7 should just be always waiting for the connection to be started from RSM. So it should work quite reliabily over the serial port. I think I get connection Ok at least 9/10 times in WinXP (when using a real serial cable b/n RSM and PC).If you are seeing it fail more often here are some possible causes:-
-If you are you using a bluetooth or wireless connection then if the com port comes and goes as RSM reboots then this could cause Windows incoming connection to get confused.
-If the Bluetooth/wireless connection takes some time to establish after RSM Boots then RSM ppp commands could be being sent before the link is up - try adding a delay to rsm ppp before it starts. (This will be different to the sleep freddy goit you to change0
-if the bluetooth/wireless connection is getting any corrupted charactes then it will cause the inital ppp negoiations to fail, causing it to retry multiple times. (Once the PPP link is up then error correction is used and any receive errors will just cause the packets to be retransmitted). You could try running 57600 instead of 115200. (I think Jamie and Freddy have a binary/script I wrote to force the RSM to use 57600.)

Regardig multiple connections:-
I think you should be able to use one 'incoming connection' setup on Win7 end. In this connection you should specify the range of IP addresses to be 10.0.0.1 to 10.0.0.10. As you connect the bots then windows should allocate the next IP address ie first one will get 10.0.0.1 next one 10.0.0.2 etc
But this means that each bot will have to be connected in order...so I think this wont work very well.
BUT in Win7 incoming connection setup , I think there is a tick box for 'Allow calling computer to specify IP address' (I think its in the same dialog where you specify the IP address range). I think you should try to tick this box. Then you should be able to configure each robot differently (in the ppp script to use a different IP address.)

So in Win 7 specify IP range 10.0.0.1 - 10.0.0.10
and tick "Allow calling computer to specify IP address'
Then in each bot use one of the IP addresses pairs from the following:-
pppd /dev/ttyMX0 115200 local nodetach noauth xonxoff 10.0.0.2:10.0.0.1
pppd /dev/ttyMX0 115200 local nodetach noauth xonxoff 10.0.0.4:10.0.0.3
pppd /dev/ttyMX0 115200 local nodetach noauth xonxoff 10.0.0.6:10.0.0.5
pppd /dev/ttyMX0 115200 local nodetach noauth xonxoff 10.0.0.8:10.0.0.7
pppd /dev/ttyMX0 115200 local nodetach noauth xonxoff 10.0.0.10:10.0.0.9
I think this should work....Good luck.
Let me know how it goes (but I will be away for most of the coming week....so I may not reply meassages for awhile!!)

Hi Gerber,
Just found your latest post......so my last poost was answering your previous post. Now this one will answer your last post .....confused .....yep so am I!!

>Is Zmodem already installed on the RSM or will I need to put some software on
>the robot to enable Zmodem?.

Its already there. See commands
zmrx (for Zmodem receive to receive a file on RSM)
zmtx (for Zmodem Transmit - to send a file from RSMedia)
A couple of notes
-when using zmrx make sure the current directory on RSMedia is not on a writable partition - it will fail the zmrx download and lock up the console. So I always use cd /tmp then zmrx.
After you receive the file the permissions will be limited, so for example you cant execute the file. I always use chmod 777 filename.
I suggest that you experiment with RSM serial console and a terminal program like Terraterm that support Zmodem already. Then you can get used to sending and receiving using the zmrx and zmtx commands.

>Can anybody tell me the steps to transfer a file using zmodem on the RSM
> to hyerteminal or teraterm.
So a whole sequence for using teraterm is :-
RSM:
cd /tmp
zmrx
(the console will appear to lock up at this stage- actually it is locked up - you cant hit crtl-C or break or anything- you have to start a transfer from the PC now)

On PC File:Transfer:Zmodem:Send
then choose the file and choose open (for example rsmfile.exe)
A dialog should appear and show the percentage of the file thats been sent.
When it reaches 100% the serial port console should return to the command prompt.
Then in RSM console use:
chmod 777 rsmfile.exe

Also I am pretty sure that you can actally choose multiple files in the choose file to send dialog - and zmodem will send multiple files to RSM.

For sending the rsmfile.txt file from RSM to the PC do the following:-
On RSM console
zmtx rsmfile.txt

On Teraterm choose File:Transfer:Receive
A dialog should appear showing you the receive percentage and should close when it gets to 100%.

Interestingly if you see the % meter jumping backwards it means that you are having corrupted characters and zmodem is retransmitting the data. With a real serial cable at 115200 I never see any retransmission.

BTW for network connection you can also use tftp and tftpd instead of ftp. Tftp stands for 'trivial ftp' and it is a simple command line program that can be used to send files to another computer running a tftpd server. There are tftp programs freely available for windows and I have a tftpd server program that works for RSMedia. With tftp you can get and put files between the computers. Let me know if you are interested and I can send you the RSM tftpd program.

Yeah I have 5 RSM. Well when I say I have 5 there are five in the house. 1 is my son's one is my daughter's which, I bought from ebay to replace her broken 1 and I have 2 which I also bought on ebay as a pair 1 was in perfect working order the other had a broken LCD which has now been repair. Finally I have the RSM named Fankenstien who is unfortunate injured and used as a donor for the other bots which make 5 in total RSM. Fankenstien, the poor bot, was my daughter original robot which had a broken main board and now has a cracked LCD as his good LCD was used as a replacement for one of the other bots.

I really appreciate the help helibot, and man you definitely know your stuff. Anyway I am connecting via the network to the RSM with usb cable to the serial hack at the moment only. I haven't yet setup the Bluetooth. I am still having hit and miss problems with the network connection. I did ready in one of the other posts about the speed you set for freddy and Jamie. I will try slowing down the baud speed to 57600 on the RSM and see if I get a more reliable connection.

You mentioned> "try adding a delay to rsm ppp before it starts. (This will be different to the sleep freddy goit you to change0"

Sorry how do I do this? Do I need to edit the rsupdateapp file on the SD card and add a line?

Change the buad speed on the RSM do I change the line in the the rsupdateapp file on the SD card from

Below is the rsupdateapp file on the SD card. what do I need to add to pause before the PPP start or do I only need to pause if I was using Bluetooth.

#rsupdateapp SCRIPT TO MAKE THE ROBOT BOOT AS NORMAL# It will then also install the USB console driver# AND it will start telnet daemon and Web server.# AND finially it starts ppp daemon (for connecting to windows ICS via PPP )

echo ***rsupdateapp - starting run_null.sh**/usr/bin/robot/init_sd.sh#/usr/bin/robot/run.sh#Helibot - use new run_null.sh to start programs but redirect all output to /dev/null#this avoids (most) output going to the console and disrupting the PPP link connection/mnt/sd/rsupdate/run_null.sh

#Note that when this script finishes there is NO shell running on the serial console#(because its expected that ppp connection will use the console)#Instead use telnet to 10.0.0.2 (when ppp is active) or use the USBconsole.

#Helibot - NOTE that its important that NO other characters are sent out the /dev/ttyMX0 after the CLIENT and before the ppp packets.#If any other characters are sent then Windows will not respond to ppp packets and ppp link wont connect.#If its not working then try increasing the 'sleep 10' cmd to 'sleep 15'

Hi Gerber,
>I really appreciate the help helibot
You are welcome.
>and man you definitely know your stuff.
It certainly helps that one of my old jobs was writing software for modems that could do PPP connections ;-)

>Sorry how do I do this? Do I need to edit the rsupdateapp file
>on the SD card and add a line?
Yes you need to edit the rsupdateapp file. But if you are using a serial cable for networking then adding an initial delay probably wont help - but hey its worth a try. Todo it change the line 'sleep 10' (which is just before the 'while [1]' line) to sleep 20.
Also you may be able to get windows to reinitialise the incoming connection - this may help enusre that windows is listening when the robot starts sending. Try this - before booting the robot goto windows incoming connection properties and untick the com port and click ok.Then reopen the properties and retick the com port. This will likely force windows to reinitialise the incoming connection program.

Also as an experiment you could try changing the line
/mnt/sd/rsupdate/run_null.sh
to
#/mnt/sd/rsupdate/run_null.sh
This will stop the robot from running the WoWee robot programs. (so he will boot to linux but not start any robot actions (so most remote keys wont work and only the loading screen will be shown - but ppp and webs and telnet should work fine.) If this gives you a more reliable connection then let me know and I can look into it further (we maybe able to change the order of how things are done in the rsupdate script).

>Change the baud speed on the RSM do I change the line in the the
>rsupdateapp file on the SD card to
>ash -c /usr/bin/robot/ppp/pppd /dev/ttyMX0 57600 local nodetach noauth xonxoff 10.0.0.2:10.0.0.1 > /dev/null 2
Yes you do need to make that change BUT you also need to change the console rate (or the 'echo CLIENT' lines wont work.) To change the console rate there is another program you need to call from the rsupdateapp script. I will see if I can email you a copy. (If you are using a plain serial cable to a plain serial port on your PC , then its unliekly that slowing to 57600 will help...but you never know anything is worth try sometimes!!

>Just a query what does "chmod 777" do?
chmod is the linux command to change permissions on a file.
Every file in linux has a set of permissions.
The permissions are shown as a set of flags 'rwxrwxrwx'
r=read,w=write,x=execute
The first rwx is for the file owner
The next rwx flags are for the group
The next rwx flags are for everyone
So you can also represent these as numbers
777 is the same as rwxrwxrwx
755 is the same as rwxr-xr-x
666 is the same as rw-rw-rw-
744 is the same as rwxr--r--

So 'chmod 777 filename' will allow absolutely anyone to read , write or execute the file!
If you do the command ls -al from RSMedia console it will show you the names and permissions for all files in the directory.
After you do a download a file via zmrx the file permission are set to something limiting (like maybe 660?). So to be able to execute the file you need to change them with chmod.
Normally in RSMedia you dont need to worry about file permissions (mainly because we operate as 'root' user on the serial console so can access almost anything!!). But on most other linux systems permissions are heavily used and can cause a lot of headaches (but they provide good security, so are a necessary evil!!)
Cheers
Helibot

Pages

Search

Search

Great Deals!

Product names, designations and logos are trademarks or registered trademarks of WowWee Group Limited and all copyright in the associated images is the property of WowWee Group Limited. RoboCommunity.com is not affiliated with WowWee Group Limited.