Robotics news, projects and stuff
  • 3. Reflash your router with “Routerbot OS”

    Routerbot v1 web interfaceLinksys WRT54GL original operating system was not designed to control robots, so we need to rewrite it with something more suitable. This post explains how to do this and provides the new firmware. Before you proceed please make sure you have read the Routerbot v1 project outline.

    I proudly called it “RouterBot OS” in the title, but it is actually OpenWRT Linux with a few mods that make it more suitable for our purposes.

    Before you proceed with this reflash procedure please note that there is Routerbot OS v2 released in the other project. It is still compatible with v1, you just need to edit /routerbot/version.sh file and change the version to “1”. The newer OS provides web interface for your robot. If you want to proceed with v2 please download the newer OS image and proceed according to the instruction hereinbelow. The links below are for v1.

    First of all download this file (the image of the new OS we’re going to flash). If you’re having problems downloading .bin file (some people reported they are getting .sit file instead of .bin) try one of the following solutions:

    • Download zipped version of the image. Of course you have to unzip it before writing the image.
    • Rename .sit file to .bin and use it as is
    • It looks like this problem occurs only in Vista, so you can try downloading this file from a different computer running a different operating system

    Next, obtain a tftp client for one of your PCs that you will be using for flashing. Windows and Linux both have tftp clients, so you can use them. Linux one works a bit better then Windows, but overall both are good for our purpose.

    Configure the computer FROM which you will be sending this image (i.e. the one you will be running the tftp command from) to use static IP in 192.168.1.0 network. For instance 192.168.1.10 should work fine.

    Connect the computer FROM which you will be flashing to the router’s socket marked as “LAN 1” this is the first socket in the group of 4, closest to the socket that stands alone (the “Internet” port). I highly recommend connecting two computers using a switch. Problem you’re solving with the switch is that your flashing computer will turn the interface down while the router is not powered on. It might take too long for the flashing computer to bring it up and you will miss this important moment when the router is ready for reflashing.

    Now is the time for the reflashing. The procedure is the following (learn it by heart as you might have to retry it many times):

    1. Unplug your router from power
    2. Plug the router to the power
    3. Let the router run for 1 minute
    4. Unplug your router from power
    5. Press and hold the reset button (the one next to the Internet port)
    6. Plug your router into power
    7. Wait for 2 seconds exactly
    8. Release the reset button (Now the router is should be waiting for the tftp session)
    9. Run the tftp command on the computer FROM which you’re flashing
      • If you’re using Linux atftp atftp --trace --option "timeout 1" --option "mode octet" --put --local-file openwrt-wrt54g-2.4-squashfs.bin 192.168.1.1
      • If you’re using Windows tftp tftp -i 192.168.1.1 PUT openwrt-wrt54g-2.4-squashfs.bin
      • For other tftp clients please rt(f)m.
      • After about 10 seconds you should see on the PC screen message that the file had been successfully transferred. If you don’t see that message retry this procedure from step 1. It is very important that you repeat it from step 1, not 4!! It is really difficult to predict how many attempts are required for reflashing. Sometimes it is just 1, sometimes 20. Adding the serial console will help you alot in this process.

    Now it is time to configure the new OS. From the same machine you flashed your router from telnet to 192.168.1.234. If everything went right you should get the command line prompt (if not – see the troubleshooting later). Immediately run the following commands:

    • uci set wireless.wl0.disabled=0
    • uci commit wireless
    • vi /etc/config/wireless – replace “YourSsidHere” with your wifi network SSID and “YourWepKeyHere” with your WEP key (I’ll add WPA support later after further testing). This step is not necessary for v2.
    • nvram set boot_wait=on
    • nvram commit
    • passwd – set the root password. After you set new password telnet will be disabled and you will have to use SSH to access the routerbot command line.
    • reboot

    The router should reboot now and in a minute or two you should check your router for the new IP leased to your Routerbot (see your DHCP server statistics to find that IP. DHCP server is typically your router). Alternativery you can modify /etc/config/wireless file and provide static IP to the routebot.

    Now let’s talk about troubles and how to shoot them. The most frequent trouble is if your flashing process didn’t went at all. You ran the tftp command and it just timeouted. In this case you can do nothing else but try again. Try to change the time interval between powering on the router and releasing the reset button. Sometimes it worked for me only when I pressed reset button AFTER I plug the power cord.

    Another thing that might happen is that your router may stop responding to any attempts to connect to it using network. In this case take a deep breath and try to reflash it again. If that doesn’t help – use the other 4 wire you exposed from the router’s internals and connect to it using serial port. I’ll provide more details about this process later. Under any circumstances do not panic. Even if your router is not responding and blinking some strange Morse code with its LEDs it is still alive and you can recover it just by reflashing in 99.9% of the cases. In 0.1% you will need to use a more advanced technique of JTAG reflashing, but this is a completely different topic.

    12 Responses to “3. Reflash your router with “Routerbot OS””

    1. Joseph says:

      Is it possible to change the the ROUTERBOT thing that comes up as you log in that is made with symbols like this –/\ I think it would be cool to give my routerbot a name

    2. Quang says:

      Hi
      Please the link broken, upload thank.

      v2 please “download ”
      First of all “download” this file (the image of the new OS we’re going to flash).

      • Hello Quang,

        Could you please let me know where exactly you found the broken link?
        I tried it a few minutes ago and it worked fine for me. Please let me know the page and the paragraph number with the broken link and I’ll fix it promptly.

        Thanks!
        Andrey

    3. Cedrick says:

      Hi Andrey, all of the links are broken. i cant download anything. Thanks

    4. B Duff says:

      Hello,
      First off I already asked this question but it was deleted for unknown reasons.
      The question: I was able to successfully flash my router with v2 but cannot telnet into it. I have tried the native windows telnet and putty (using both ssh and telnet protocols) to no success. I know the OS took because I can see the control interface when I point my browser via LAN to 192.168.1.234. Any suggestions? I am very eager to get this resolved.
      Thanks!
      B Duff

      • Hello B Duff,

        Your message was not deleted. It was pending approval for a few days. Most messages/comments on this website go through moderation cycle (spam contrmeasures, you know), so it could take a few days before your message will be published. Since you send another message let me answer it and skip the first one.

        The telnet issue is simple – openwrt blocks it after first login. For security reasons I left it so in “Routerbot OS”. Please do not use telnet under any circumstances – it is highly insecure and it is banned on all secure sites (including “Routerbot OS”).

        Seeing the web interface is a very good news – that means the reflashing procedure (the most critical step from my prospective) was successful. The only explanation for SSH problems I have is some kind of wrong settings in putty. Could you please send me the error messages you’re getting from putty? Typically it works well, all you need to specify is IP, login and password, the other setting should be left set to default. Just for debugging can you run this command: “telnet 192.168.1.234 22” and let me know what you see in the command window? If you’re using windows please run is as “Start->Run, type cmd, then enter”. The new (black) window will appear where you can type in the telnet command. That command will “probe” ssh port on the routerbot and let us know if ssh is working on the routerbot at all.

        Regards,
        Andrey

        • B Duff says:

          Thanks for your reply, and sorry for my assumption. I guess I let my enthusiasm get the best of me.

          I am a computer science major and I work in IT so I know very well about how bad telnet is, I misread your instructions. I did the debugging telnet command and then tried to log in with putty again (using the same settings as before, I saved the session) and it works. I was able to get in using root and guessing the password.

          However, even being in as root I cannot edit the /etc/config/wireless file. I tried sudo and su to no avail. Is that a difference between v1 and v2?

          Thanks very much!

    5. Hi Andrey… First, may I fluff your ego a bit? Incredible! I love the routerbot concept and can’t wait to add my mods to it! I’m trying to build a unit that will control my irrigation pump for my organic farm here in Red Hook, New York, US. Basically it will read engine rpm, temperature, gpm (gallons per minute), water temperature, injection state / flow (for injecting organic nutrients and / or pesticides [i.e= neem oil] )and also be able to set throttle and engage/ disengage pump clutch (electrically clutched for independent engine /pump operation. Ok enough about what I’m building – I am currently trying to install routerbot os on a WRT54G ver 3.1 router. I am able to flash the openwrt-wrt54g-24-squashfs1.bin file to the router and recive a successful transfer response but after that I am unable to telnet to issue the commands you say to use. (uci setwireless …. etc. etc.) I tried pinging 192.168.1.234 as well as 192.168.1.1 and recv no response. Frustrated, I reflashed several times and even tried using Angry IP scanner to see if I could find the router (scanned for 192.168.1.1 – 192.168.1.255). No response. Tried connecting to my existing router (also a hacked wrt54g-tm loaded with dd-wrt v 24 megapack)Couldn’t connect via web gui either through 192.168.1.234 or 192.168.1.1 and it doesn’t show up in the dhcp list on my main router either. I tried erasing the nvram to reset it using jtag connection (had a bricked router a couple weeks ago)and that didn’t work…. so i erased nvram and kernel and re-flashed again via tftp and still unsuccessful. Is it possible this ver 3.1 firmware doesn’t like the flash image? Am I missing a detail?

      Please help…
      Carlton

      ps – if you ever come to the us I’d love have a beer and chat (or vodka?)

      • Hi Carlton,

        The image should be fine – several people used it and it worked fine for them. I also tested it myself. The problem should be somewhere else. Did you make the serial interface? Can you see the console output? Could you please send it to me? If not I’d highly recommend making one. Serial interface is the best tool for debugging linux computers. Also telnet eventually will get disabled in the Routerbot v2, so I recommend using ssh only (that’s not your case because you can’t even ping the router). Please make sure that you’re connected via LAN1. I have a few more guesses, but I need to see the console output first.

        Thanks for the praise 🙂

        Regards,
        Andrey

        • Andrey,

          Thanks for the fast response! I did not make the serial interface yet, I figured I was ok with the JTAG… but I suppose they serve two entirely different functions. I will make the serial interface today. Yes thats correct, no ping at all after flashing… I even waited the typical five mintues for the new code to load, but to no avail. I always connect via LAN port 1, so thats definetly not it. Will shoot another response upon serial interface completion and data aquisition. Thanks again! What a great concept!

          C

    6. Hi Andrey,

      Well I came to an interesting discovery last night. I mistakeenly, while running ping -t 192.168.1.234 (win xp) discovered that when I plugged into the INTERNET port, not lan 1 started getting ping responses! So, I figured, what the heck… tried logging in via GUI. and to my dismay: There was the Routerbot control page. Any ideas?

      C

    Leave a Reply

    You must be logged in to post a comment.