Search

Resume and bio of the author, about this website Couple of articles related to my hobby - robotics
My impressions about immigration to Australia. In Russian only. Recipes for everyday problems solving
Linux-related posts Windows-related posts
Software-related posts A lot of info about hardware
Different tools you might find useful Posts about various web technologies
Everything that doesn't fit the rest of the menu RSS feed for this blog

Tag Cloud

Archives

Links

Andrey Mikhalchuk’s Blog

Technoblog about life

Feb 24, 2008 How to build an inexpensive powerful robot. Configure your routerbot.

Unfortunately most servos you can get for a reasonable price are not the same. Each servo has its own parameters and the cheapest ones for not allow adjustments. Fortunately in the “routerbot OS” your can easily fix that problem. Here is how you can do that in the “routerbot” project.


In order to tune the routerbot find an appropriate box to put the routerbot on top of it so its moving parts do not touch anything. Then telnet or ssh to your routerbot and cd to /routerbot directory in two shells (or in two cmd windows in Microsoft Windows). Open config.sh file in one shell/window (let’s call it “config” window and the other windows will be “command” window) and adjust the parameters using the following procedure:

  • Change the numbers in *_SERVO parameters if you want to connect the servos not as it was described before, but in some other order
  • In the command window run the following command in the command prompt: stop. Both wheels should stop. If they don’t keep modifying parameters ENGINE_LEFT_STOP and ENGINE_RIGHT_STOP until stop command works correctly.
  • In the command window issue this command: look forward. The camera should turn so it looks straight. If it doesn’t then adjust CAMERA_PAN_FWD parameter.
  • In the command window exec the following: look left and then look right. These commands should make the camera look left and then right. In those positions the servos should not rattle, otherwise decrease CAMERA_PAN_DELTA parameter
  • In the command window try these three commands: look ahead, look up, look down, look back. Issue those commands one by one and after each command listen if the servos are silent or not. If they rattle then adjust the following parameters correspondently: CAMERA_ELEVATION_FWD, CAMERA_ELEVATION_UP, CAMERA_ELEVATION_MAX, CAMERA_ELEVATION_MIN. You might also want to adjust those parameters to increase angles if your servos support more then 180 degree rotation
  • Put the routerbot to the floor and issue the following command: turn right90. The routerbot should turn exactly 90 degrees to the right. If it doesn’t then adjust RIGHT_ANGLE_TURN_SPEED parameter a little.

That’s basically it. When you’re done with this step you’ll have something like you can see in the original routerbot video. I also recommend you to backup your config file. If you reflash the router later yourconfig file will be lost without the backup.

If you want to extend the set of commands the routerbot understands take a look at the /routerbot/util.sh file. I’d be happy to incorporate your mods into the next version of the routerbot OS if you send me the mods and how you would like to be referenced in the source code.

The full list of the routerbot commands available in the current version is available in the project outline. You also might want to take a look at the /reouterbot/test.sh file to see how you can organize simple commands into programs.

This post is published in Hardware, How To, Linux, Robotics.

13 Responses to “How to build an inexpensive powerful robot. Configure your routerbot.”

  1. How to build an inexpensive yet powerful robot (How to turn your router into a routerbot) | Andrey Mikhalchuk's Blog Says:

    [...] Comments How to build an inexpensive powerful robot. Configure your routerbot. | Andrey Mikhalchuk’s Blog on How to build an inexpensive yet powerful robot (How to turn your router into a routerbot)How to [...]

  2. Jo Werner Says:

    Very cool!

    Do you think you could publish some details how you control the servo controller with your scripts?

    Also, did you use a standard OpenWrt image and what modifications did you apply?

    Best regards,

    Joachim

  3. Andrey Mikhalchuk Says:

    Hi Jo!

    The servos are controller using SSC-32 servo controller that works as a “mediator”. The SSC-32 can be controlled via serial interface. It has both regular RS-232 connector and TTL-level serial accessible via 3 pins on the controller board. If you want to control servos from a regular PC or laptop computer you can use the RS-232 (optionally via a USB-to-RS232 adapter that costs around $10-25). WRT54GL unfortunately doesn’t have built-in RS232, only TTL output on the board. So you can save some cash and connect those two TTLs directly if you have a soldering iron and 30 minutes of free time.

    In order to control servos via SSC-32 you need to connect to the serial interface and issue special commands. The full list of SSC-32 commands is available at http://www.lynxmotion.com/images/data/ssc-32.pdf. So you basically open serial device in your favorite programming language and write the commands to the controller as a plain text.

    In the “Routerbot OS” I wrote couple of shell scripts that facilitate the procedure of controlling the robot. The scripts set mainly consists of configuration file and set of shell functions like “turn” or “look”. The script is automatically sourced in in /etc/profile, so you have all those commands available from regular shell. For instance you can ssh or telnet to the routerbot, issue something like “ls -la; go forward;usleep 1000;stop;look up;cd /www;ps” and all this will make sense. Additionally I preconfigured the router to connect to the internet wirelessly so you don’t have to mess up with network configuration and other linux issues - the OS is just ready to go.

    A few days ago I also completed web interface for the router, so now you can control the routerbot from your browser by clicking various colorful arrows. Additionally the web interface facilitates the robot programming. I’ll publish the updated OS image soon as my kids are still testing it :)

    Good luck!
    Andrey

  4. Eduardo Says:

    First, thanks a lot for your project, seems great!

    I have a question. Does the router, after the flashing, keep on working as an AP? Or do I need another AP in my home to links all the devices? Because I suppose the connection between my computer and the roterbot is using Wireless link, right?

    Thanks in advance!
    Eduardo

  5. Andrey Mikhalchuk Says:

    Eduardo,

    In this particular version the router turns into a client (i.e. it connects to another AP itself). I kept it bridging, though.

    Since I already got couple requests about keeping it in AP mode I’m going to add AP mode functionality in the next gen routerbot.

    Andrey

  6. Robot barato construido en base a un router Linksys WRT54GL | CyberHades Says:

    [...] Configure your routerbot (configurar el routerbot) [...]

  7. Joseph Says:

    Andrey, I have one final problem. I have everything working, I can ssh to the routerbot wirelessly and command it to do things. My problem though is that when i do any commands that have to do with the engine servos (continuous motion servos) the servo in the second slot always continues to move (even when i issue the stop command) the only way i can get it to stop is to do the ./stop.sh i cant just call stop. also when i do the command like go forward the servos move at different speeds I do not know why this is happening but if you could help it would be greatly appreciated. thanks
    Joseph

  8. John Says:

    how to I modify those parameters? What is the syntax cause for me it just says that the variables cannot be found
    ~John~

  9. Andrey Mikhalchuk Says:

    John,

    Just “vi /routerbot/config.sh” and adjust the parameters to fit your servos.
    When are you getting messages that the variables cannot be found? Could you please send the copy of the messages?

    Andrey

  10. Josepg Says:

    ok I have tried everything and The two engine servos turn at different speeds and i do not know why. i change the engine left and right stop to 5300 so that the stop command works but they spin at different speeds so it always turns. please help thanks. Also i was going to try and add some of my own command in but i am not very familiar with linux what is a good website to check out also what does ‘$’ mean cause i see it all over you code in the util.sh

  11. Andrey Mikhalchuk Says:

    Joseph,

    Here is a good place to start learning shell scripting: http://unixhelp.ed.ac.uk/CGI/man-cgi?sh.

    As about the servos try changing the “*_DELTA_*” parameters. The slower servo should get larger delta. Delta parameter defines the range the servo PWM can vary within. Play with it and see how the speed will get adjusted.

    If you’re using completely different continuous servos try either to get the same ones of implement your own formula for calculating the servo speed in the util.sh code.

    Andrey

  12. RouterbotJunior Says:

    When I try the command echo “0P1 #”>> / dev/tts/1 the servo that is set to 0 turns to the left and when I try the command echo “1P1 #”>> / dev/tts/1 the servomotor which is set to 1 turns to the left too, I would like to know how to move both the servomotor 1 and 0 in opposite directions to current or if you could send me a list of possible movement to handle each servo. Also I let you a picture to see the positions in which they find our drive, from already thank you very much.

    here a picture of our routerbot …http://img360.imageshack.us/my.php?image=dscf6379kh7.jpg

  13. Andrey Mikhalchuk Says:

    RJ,

    The “zero” position of the continuous rotation servo (the PWM value at which it doesn’t more) is around 1500. Everything higher then this makes servo rotate one direction, less then that value makes it rotate the opposite direction.

    The exact value of the “zero” position is individual for each servo. You need to try different values and when you find the “median” put it in the config file.

    Let me know if problems.

    Your routerbot rocks! Thank you for the picture.

    Andrey

    PS. I’m only talking about servos I used (HSR-1422CR). There are servos you can set the “zero” point for, there are also digital servos and other even more expensive stuff.

Leave a Reply

Site Map (c) Andrey Mikhalchuk, 2005-2008