Robotics news, projects and stuff
  • Routerbot v1 FAQ

    SSC-32 wiringThis FAQ is based on the question I got in my personal blog. To simplify your development process all comments are parsed, turned into questions and answered here.

    Hey if i had a wireless router XXXXX could i use that to send the video and if so how?
    Check this list of compatible hardware. If your router is in the list and is completely supported by OpenWRT Linux Kamikaze 7.06 it can be turned into a routerbot using the approach described on this website. Let me know if this is the case and I will compile the image for your router. Unfortunately for most routers I won’t be able to provide support as I don’t have necessary equipment and time. You will have to figure out many things yourself. In fact even if your router is not in the lsit there is still chance Linux can be ported to it, but this is completely up to you.
    What about installing a webcam (directly connected to router) instead of the wireless pinhole cam?
    Webcam support is provided in Routerbot v2
    How long does the battery last?
    v1 runs at least 30 minutes, v2 4WD only lasts 5-10 minutes on the battery shown. v2 2WD lasts 20 minutes or so. If you need it to work longer consider switching to LiPo batteries of higher capacity.
    I’m curious about the teleportation function seen at 1:13 in the clip, I do not see any documentation in the command:s list.
    Teleportation is made with command “teleport xoffset yoffset”. Unfortunately this function is very unstable so I excluded it from the final release. And I’m still looking for those 15 routerbot prototypes I’ve lost while debugging this function until I found an error in my code – the distance by default was assumed in miles, not inches.
    If I used DD-WRT Firmware, It will be able to get your scripfile?
    Yes you will. v2 is provided both as the complete OS image and a patch file. Apply the patch to your DD-WRT installation and you’re good to go.
    I was wondering if I was able to set my routerbot up so that it does not have to work on the wireless network.
    v2 can work in both STA and AP modes. If you want it to connect to your local wireless network use STA mode. If you want to run it outdoors (or wherever wireless network is not available) configure it to run as an Access Point (AP) and connect to it from any wireless enabled device. Wireless mode in v2 can be changed using the web interface.
    Can you help me with my routerbot-like project
    Absolutely! With a few conditions: a) I cannot guarantee quick responses, sometimes I’m really busy b) you need to have at least basic linux and robotics skills, so I don’t have to explain meaning of such scary words as “servo”, “ttl” and “vi” and c) I cannot spend much time helping you, so most part of your project you still need to do yourself.
    Is there a way to donate a few dollars?
    Sorry, no. I currently do not accept donations.
    I tested the ssc-32 with linxterm, sometime it worked,sometimes not…
    SSC-32 debugging process is described here.
    When I turn the routerbot on the LED on SSC-32 is lit and when I issue a command it goes out …
    This is how it should be. Please refer to SSC-32 documentation.
    I figured out that I have to do a powerrecycle after I edited config.sh, is this correct ?
    you can do that, or, faster, run this command “. ./util.sh” in the routerbot binary folder. This will reload new settings and new functions so you don’t have to reload the router.
    Finished ! It’s Alive…
    May I have a link to the product description and a few photos of your robot? If you need a web space to publish details about your project I can provide it.
    Can you send me the electric plan of the servo’s control board please?
    Sorry, I cannot. I’m using SSC-32 designed and manufactured by LynxMotion, please refer to them.

    I do not understand the data flow in your V2 from web page click to exact data transmit to port…
    When you click on a webpage (for instance click a button) this click is handled using JavaScript (onclick event). The onclick handler reloads do.cgi page targeted to the frame on the Debug “page”. do.cgi is executed on the server side. It parses the arguments and calls corresponding set of functions defined in util.sh. util.sh on startup loads the config.sh script that defines many operational parameters. Most functions in util.sh end up calling function cmd() also defined in util.sh. In v1 this function sends commands directly to the serial port /dev/tts/1. In v2 it calls executable command that does basically the same.
    Is there any procedure to reflash the “routebot” with the original linksys soft and then reflash with “routebot” software again ?
    Yes, you can absolutely reflash the router back to the Linksys firmware. Here are the details about how to do this (somewhere in the middle of the page). However you do not need to reflash back to original OS in order to reflash the routerbot with the Routerbot OS again, you can do it anytime. For hardware the original OS and the Routerbot OS and any other operating systems like DD-WRT are all the same. The original Linksys operating system is available from the Linksys website, just go to “Downloads” accessible from the topmost menu on Linksys website -> Wireless Routers -> Select your router model WRT54GL -> Select version 1.0 and get zipped .bin
    The serial cord wiring in the photo does not match the text on this page. I found out the hard way by going with the text desription. The text labels for Rx and Tx are reversed.
    The router’s Tx is supposed to go to the SSC-32 Rx and vise verse. One device sends, the other one receives. Don’t forget to put resistors in the line as described in the instructions! Also in v1 you can just skip SSC-32 Tx – it is used in v2 only.
    If I used the GUI to upgrade Firmware from DD-WRT to Your “RouterBot OS” instead of TFTP, Is that work?
    Yes, you can use GUI. But you better get trained to use atftp because after you reflash the router once that fancy GUI will disappear – Routerbot has completely different web interface.
    Should my router be wired to my computer or should this sbe done wirelessly
    You can do either way. If you want to use the robot wired way just connect it to you network using LAN 1 port on the routerbot. This is the only port statically configured to 192.168.1.234
    How do i check my router to find my routerbots IP i know how to get to my router but i am not able to see which ips it leases and to what it leases it to
    Still the best way is to check your DHCP server (which is typically your router) leases. If you somehow managed to get to the routerbot “ip addr” will show you all the network interfaces and their configuration.
    The operating system is compressed in a .sit file and i do not have stuffit expander and would not like to pay for it are you able to email it unzipped?
    The operating system is actually coming as a .bin file, but for some strange reason many Vista users reported that they are getting .sit file instead. If this is your case just rename the .sit file to .bin. Alternatively I’m providing compressed versions of the image, so you can use them. Again, you do not need StuffIt to decompress the file! This is a .bin file, not .sit.
    I’m getting “code pattern is incorrect”, “timeout”, and “invalid password” errors while reflashing the router …
    Code pattern is incorrect appeares when you’re using wrong version of the image. Since I’m providing image for WRT54GL router it won’t work for any other router. Please verify your router model name. Let me know if you’re having a different model and I’ll try to provide you with the right image. “Timeout” occurs when your router isn’t getting the reflash mode. Please follow the instructions carefully and you won’t get this error. “Invalid password” sometimes happens on brand new routers when you’re using particular tftp clients (I saw this message once with Windows tftp reflashing newer routers, but never saw it with Linux atftp while reflashing older routers). In order to get rid of this error please login to the web interface of the router (still running the original Linksys OS) and make admin’s password empty.
    I changed the password on the routerbot and now cannot telnet to it anymore …
    This is how it is supposed to work. Please use way more secure ssh protocol. As an ssh client I can recommend putty available for all major operating systems for free.
    I did something wrong and now want to reflash the router again. But all attempts to reflash router using its new IP 192.168.1.234 fail. I cannot ping 192.168.1.1 either.
    192.168.1.234 is the IP address router will respond on if you connect to LAN 1 port AND then router is runnting routerbot OS in its original/initial configuration. Use only 192.168.1.1 to reflash the router. And also it is not supposed to answer pings on that IP.
    When I try to edit any file on the routerbot I can’t save the changes and get “readonly filesystem” error.
    The most probable scenario when you get this error is when the router is running in “safe mode”. give it full power cycle (reboot it and let it boot completely, then reboot again) – this could help. If it didn’t then check your router model and version. I had similar problem with a router that had less memory then the flash image was, so after reflash not entire image fitted the memory and the router wasn’t about to boot properly.
    I am using a windows computer and it does not have a built in ssh
    Use putty – it’s free. Also forget about telnet – it is highly insecure. Using telnet is like publishing your passwords in Sunday Washington Post.
    What is the login and password for the routerbot command line?
    Login:root, password:routerbot. You can change it anytime using Linux command “password”
    How do I modify my /etc/config/wireless file so it does what I want?
    Here is a nice piece of documentation for this file and other network configuration related files. Let me also suggest using v2 that has the web interface that generates all those files automagically.
    I don’t know Linux. Can I do this project using Windows?
    Unfortunately the router used for the robot “brains” is not capable of running Windows XP, so you will have to learn a little bit of Linux. The rest (reflashing, programming, controlling) can be done using Windows or MacOS or FreeBSD or any other modern popular operating system.
    I think I have bricked my router …
    Try adding serial interface to the router. This is a great debugging tool that will save you tons of time while developing your routerbot. Most probably you will see some positive output from it and realize that the router is not as bricked as you thought. Even if you bricked it by damaging the bootloader there is a good chance you can recover your router using JTAG adapter.
    How do you power the router with the battery because the transformer on the plug says it outputs 12 vdc and if it can take 9 volts how do you connect it to the router?
    Teh router accepts almost everything between 5V and 12V. In fact they were shipping WRT54GL with 12V adapter some time ago and now it is shipped with 5V 2A adapter.

    Can u tell me how you made the webinterface?
    I used haserl package. The overall control flow (the way commands are getting from the web interface to the servos) is somewhat weird, but I tried to keep the OS image small. The faster approach would be running lighthttpd and php on the router. If you have time and a router with lot’s of RAM – you can try that way. The beauty of the routerbot is that you can program it using almost any programming language you like. C/C++, Java, Shell, Perl and PHP – use whatever you prefer.
    How can I change the web interface design?
    Take a look at /routerbot/v2/www/index.html. You can change it any way you want.
    v1 is using RF wireless camera. How can I use a web camera?
    Use v2 – it has support for IP web cameras.
    “ok I have tried everything and The two engine servos turn at different speeds” or “the robot is not going straight”
    Try adjusting *_STOP parameters for the servos in /routerbot/v2/bin/config.sh file. The value should be around 1500, but it is individual for each servo (even if they have the same model number). If you’re using digital servos try programming them directly.
    What kind of web camera is used in this (v2) version of routerbot?
    The web camera I used is iCamView camera+server. Got one from ebay for $70. I actually do not recommend the camera I used because of it’s really bad performance. iCamView presented new line of cameras on CES 2009. I especially liked the one with two lens – for day and night use. I’d better recommend that one. The refresh rate is also better in the new products from iCamView, but they require 5V @1A, while the old one required only 500mA. So you might need a better battery for v2.
    How the three networking modes are working in v2?
    In Access Point mode the routerbot works as a wireless access point. You can connect to it from any computer that has a wireless interface using the SSID and WEP key specified in the parameters (Routerbot/01234567890123456789012345 by default). You computer should be configured to obtain network configuration via DHCP. The router runs a DHCP server in this mode and will assign an IP address in 192.168.1.0 network to your computer. Since your computer is exclusively connected to the routerbot (unless you use two interfaces on the computer) and the routerbot is not connected to your home network you won’t be able to use the internet and the routerbot simultaneously. The advantage of this mode is that you can run routerbot virtually anywhere you want regardless if there is a wifi network available there or not.

    In the standalone mode the routerbot connects to your home network. Currently it supports only WEP security, not WPA so far, sorry. You need to specify your home network SSID and wep key. Once you hit reconfigure button the routerbot will reboot and try to connect to your home network. It will also try to obtain an IP address from this network (192.168.2.0 network in your case). Your control computer shoould remain configured as you use it in everyday practice, i.e. it should also obtain network configuration via DHCP from your home router. In this mode both routerbot and your control PC are connected to your home network and you can both access the routerbot and access the internet. The only issue here is what is the routerbot IP in this case. You need to find it out in your home router logs. This is router-specific.

    I think I need to modify those tags for the camera IP. Correction to what I said above, my camera’s IP is 192.168.2.115. How do I connect the camera window of the web interface to that IP ?
    Here is a quick overview of how you can use your camera with the routerbot.

    In v2 instead of using Java or ActiveX objects to display the data I decided to capture the entire web camera page. The reason for that is security restrictions in many browsers. So in order to capture image from your web camera you need to
    1. Find the URL of the page that is displaying the output from camera. Open your web camera web interface and navigate to the page that displays the actual output from the camera. Then in Firefox right-click on an empty space of that page and select “View Page Info”. In the new dialog window copy the value of “Address:” field.
    2. Open /routerbot/v2/www/index.html and find the following piece of code: <div style=”border: 1px solid black; width: 320px; height: 252px; overflow:hidden”><iframe src=”http://routerbotcam/cam1.htm” width=”326″ height=”263″ scrolling=”no” style=”position: relative; border:0px none; top: -11px; left: -5px” id=”view_iframe”></iframe></div>
    3. In that piece of code replace “http://routerbotcam/cam1.htm” with the URL of your web camera page you got in step #1.
    4. Now when open the routerbot web interface you will see a part of the web page that contains the video you want to embed. Now you need to modify “style” attribute of the “div” tag and “width/height” attributes of the “iframe” tag to make the display area fit your actual video area. Also you need to modify “top/left” parts of “style” attribute of the “iframe” to position iframe exactly on top of the video of your source page. It’s difficult to explain, easier to start playing with the figures. I recommend starting with “left/top” attributes.

    That’s it. After you get the correct figures after many experiments you will see the web camera video embedded into the routerbot web interface.

    How the routerbot v2 programs look like?
    You can run the programs using the web interface. You also can save up to 5 different programs to flash. Here is an example of a program that makes the routerbot roam around avoiding obstacles.:

    # This program turns the routerbot into an explorer robot.
    # It roams with speed SPEED until it "sees" an obstacle in
    # front of him in the distance closer the DISTANCE. Then it
    # looks for better direction to go (the one w/o obstacles)
    # and proceeds that direction.
    # If you plan to increase SPEED please increase DISTANCE too
    # as distance calculation typically takes 1-2 seconds
    
    DISTANCE=6
    SPEED=70
    
    look ahead
    look forward
    while [ true ]; do
    	sleep 1
    	stop
    	if [ `get_distance` -gt $DISTANCE ]; then
    		go forward $SPEED
    	else
    		stop
    		look right
    		if [ `get_distance` -gt $DISTANCE ]; then
    			turn right90
    			look forward
    			go forward $SPEED
    		else
    			look left
    			if [ `get_distance` -gt $DISTANCE ]; then
    				turn left90
    				look forward
    				go forward $SPEED
    			else
    				turn left180
    				look forward
    				go forward $SPEED
    			fi
    		fi
    	fi
    done
    


    As you can see this code is readable by anyone, no advanced programming knowledge is required. You don’t care about PWM, dealing with sensors and stuff like that. If you want robot to flash lights on each turn, just add
    camera_lights_on;sleep 1;camera_lights_off anywhere you want. If you want to turn not at right angles, just replace “turn left90″ to “turn lefter” and “look left90″ to “lookat 4 4″ etc. The programming language is powerful enough to program really complex actions (see the help menu for the list of commands supported). Moreover, you can easily extend it using the same Shell script language in util.sh file. You can add support for new hardware and new commands with no need in PIC programming. This is one of the most powerful features of routerbot. This is something that makes it truly unique.

    18 Responses to “Routerbot v1 FAQ”

    1. Alessandro says:

      Hello again Andrey, thanks for your help with the voltage divider, i understand now, but i have a question about the controller, i would like to know if is possible to use another board to control the servos. I’m having problems to shop a ssc-32 controller by the lynxmotion, so i find out a board here in brazil that seens similar. The board name is MEC1000, here is the manual:
      http://www.maxwellbohr.com.br/downloads/Manual%20do%20MEC1000.pdf
      It’s compatible? What i have to change to make this board works in your project?
      Thanks so much.

      • admin says:

        Alessandro,

        In fact you can use any servo controller (like pic-based or arduino-based), but you will have to edit util.sh file to use the set of commands native to your controller. Unfortunately I don’t speak Portuguese, so can’t understand exactly what command set MEC1000 supports, but it looks like some Delphi-like API. If this is correct then you will have to create some program in Delphi that will read some ASCII input on serial interface and convert it into this API calls. Then you will have to cross-compile it for mipsel and edit util.sh to generate the ASCII input based on user requests from either web interface or command line. This is fair amount of work, so I would suggest this approach only if you have absolutely no chance to get SSC-32.

        BTW, have you seen Arduino board specs? I have never used it for this particular project, but overall I’m a big fan of it. With Arduino you will still need to write the program to accept Serial ASCII input and parse it into Arduino API to control the servos, but the good part is that you won’t have to cross-compile as entire code will reside in Arduino. Another good thing is that you won’t have to use the voltage divider as there are 3.3V versions of Arduino: . It is also less expensive then SSC-32. Arduino was originally designed in Italy, it is open project and I believe it is available worldwide. In fact I’m thinking about switching the routerbot project to Arduino sometime in the future to reduce the cost and complexity of the project.

        Andrey

    2. Alessandro says:

      Thanks again Andrey, i’ve finally understand how the voltage divider works, it’s not a problem anymore, everything is working, the router and the openwrt, but the lynxmotion distributor here in brazil don’t tell me anything about my SSC-32 order =(. It’s a strange and happy coincidence you tell me about Arduino because today i have read a lot of articles about Arduino before i read your answer here. I’ve find out a brazilian Arduino project called Arduino Severino, it’s a very cheap project and it can be built in my home spending about of U$10,00 with the components, looks like a good option, here is your website if interest to you, it’s in english language, http://www.arduino.cc/en/Main/ArduinoBoardSerialSingleSided3, i don’t know anything about ASCII programming, i just have experiences with high level programming like Delphi,Java,C# and C++ so i think that will be a lot of work if i try build all of ASCII code, but if necessarry i will do it, will be my “B plan” to do this project works. If i find out more tutorials about arduino thats help me to do this communication between the router and the arduino maybe i can do your project works with arduino, if i do this i’ll be happy in share my project with you to post in your webpage…
      Thanx
      Alessandro

      • admin says:

        Alessandro,

        By ASCCII I meant just input to your program. For instance the commands you send to SSC-32 use ASCII symbols. You can write a program for Arduino in C and it will accept similar input.

        arduino.cc is probably the best source of information about programming this platform. For instance here is the language reference and is a nice collection of examples.

        I would very appreciate if you become an author on this site and share your experience with Arduino.

        Andrey

    3. Alessandro says:

      Andrey, thanks for all help, let me know if i understood well how all of this works, the web interface sends a command to the router, the router get this command in high level code and your openwrt OS converts this high level code to low level code to transfer by your serial output to the board serial input, the board receive this commands, read it and activate the servos through your EEPROM program. is this right? So my job is get the high level code of the web interface and convert to low level code by a C language file? And the EEPROM programmation is my job too, right? Your command.c was wrote by you? Can i use the same code to interpret the data and send to the board? What should i know to write this C file? If i build my own arduino ATMEGA based, flash it with my own programation, and if i write the C code of the router to understand this code and control the servos, can i write whatever i wants, it’s all right? I’m feeling in a unknow island asking for help to get out…lol, sorry for so many questions…by the way, i’m learning so much…i’m happy for this…thanx

      • admin says:

        Alessandro,

        In general that’s correct. A few corrections:
        - OS itself isn’t converting itself, a shell code in util.sh does
        - The SSC-32 is manufactured by LynxMotion, so its code is not mine.

        If you want to use Arduino or similar your work will be writing some code for Arduino that will do almost the same thing SSC-32′s code does. Doing so isn’t diffucult because you can program Arduino using a high-level language.

        command.c is mine, but I suggest modifying not command.c but Arduino’s code so you don’t have to do any cross-compilation. arguino.cc provides excellent reference and couple good examples on Arduino programming. I found information provided there good enough for starting your ownArduino projects like this one: http://www.youtube.com/watch?v=1pcAsEUOW9Q.

        Andrey

    4. Alessandro says:

      Thanks Andrey, i made it! I’ve finish the comunication between the arduino and the router, i just have some problems with wireless signal interference, and the micro servos don’t work at clockwise direction, i’ve tried some many pulse codes in Arduino but it just make a little movement and stop, i don’t have any specification of the servos =( so the work it’s going to be very hard here…can you give me your mail address please?
      Thanks!
      Alessandro.

    5. ej says:

      Andrey,

      if i may ask.. wat web server is used in the linksys wrt54g??

    6. Luke t says:

      i want to make a router with the outputs set to a toy rc truck an have it with features to go any where theres a signal by sending a packet saying its going to disconnect when it gets a stronger wifi signal then it connects the the other signal and sends a packet to reconect it to the computer. Just an idea of mine

      • Hi Like

        I think your project is absolutely doable and in certain places like highly populated areas such robot would have a great chance to find open WAP at almost any point. Please let me know if you plan to go ahead with your project – it would be interesting to know about your progress.

        Andrey

    7. Honza says:

      Hi, I think it is a perfect robot I certainly try to build it. But I have one question. Is there any possibility to control the robot by any windows program?

    8. carl says:

      Hi there. Let me ask you a question. Can I use any router which support openwrt system? Thank you

    9. john says:

      Hi Andrey,
      In routerbot V2, I have a question about parameter passing from js to cgi to util.sh to cmd() (inside util.sh).

      For everytime a button is pressed cmd()(inside main.js) document.getElementById( “cmd_output” ).src = “/cgi-bin/do.cgi?action=” + urlencode( cmd ); is executed, parameter are sent to do.cgi but im confused about the +urlencode(cmd), making the value to ascii code?

      Once the parameters are passed to do.cgi, util.sh is executed and these variables $FORM_post_form_action, $FORM_action and $FORM_post_form_content were did this come from?
      From the

      Is this correct $FORM_post_form_action = post_form_action (from hidden)?

      And the last parameter passing to cmd()(inside util.sh),
      cmd() {
      echo “CMD> $1″
      echo “$1″ >> /dev/tts/1
      }

      Where did $1 get a value from the do.cgi?
      I’m new to this, help me understand this parts.

    Leave a Reply

    You must be logged in to post a comment.