OR-WRT 0.60-Eng

Материал из roboforum.ru Wiki
Версия от 16:14, 15 декабря 2011; =DeaD= (обсуждение | вклад) (Нерешенные проблемы)
Перейти к: навигация, поиск


About

Project description

This is subproject of Open Robotics project, intended to production easy-to-use, low-cost platforms for hobby robotics (also not only hobby). This subproject target is to develop ready-to-flash firmware for SOHO wifi-routers, which allows to use the linux-based routers as a head devices for wifi-controlled hobby robots. Router will be able to control UART- and USB devices (for the moment, UVC-webcams, some MCU boards and some USB-UART adapters are supported). Firmware is based on the OpenWRT, author - elmot (elijah.mot [at] gmail.com).

URL to forum about this project

License

You can freely use and/or modify the project materials for any non-commercial purpose. For commercial license you have to contact author (elijah.mot[at]gmail.com).

WARNING

You are doing on your own risk. We warn that disassembling the router (to connect uart-interface), as far as flashing custom firmware, may lead to loss of warranties or even to device damage. Unexpected robot behavior could lead to damages or even injures. The author of the firmware, neither Open-robotics.ru, nor OpenWRT.org don't carry any responsibility for any direct or indirect consequences of projects materials usage.

Supported equipment

Routers

  • WiFi routers:
    • D-Link DIR-320 (but not DIR-320NRU, aka "H/W ver B1"!),
    • ASUS wl500gP (tested by ddcharacter)
    • May be any other routers, based on SoC Broadcom BCM47xx/53xx (not tested yet)
    • You can try to modify firmware by you own for other USB-equipped routers compatible with OpenWRT.org

USB-Webcams

All UVC-webcams (consider this list — [http://www.ideasonboard.org/uvc/]).

We recomment MJPEG-webcams, but YUV-webcams can be used too (but with increaced latency of video-streaming).

USB-UART adapters

  • Silicon Labs CP210x, including OR-USB-UART-v1
  • Pololu Orangutan SVP-1284 (with some patching, see below)
  • Others weren't checked, most likely will be supported..

Firmware installation

D-Link DIR-320

  1. Set up tftp client (included in win 7 distributive but is not installed to default).
  2. Connect computer with RJ-45 cable to any LAN-port on router
  3. Setup IP 192.168.0.2 for computer LAN adapted
  4. open DOS-prompt window and prepare (may be in .bat-file) command "tftp 192.168.0.1 PUT <trx-file-name>"
  5. Switch on router power
  6. Wait for exactly two seconds and run prepared command. LAN LED should start flashing frequently for few seconds, after that command must be completed successfully and write in console something like (digits may differ):
    • Start Flashing ****
    • Successfull transfer: 3592480 bytes in 11 сs, 281134 bytes/s
  7. Wait for about five minutes. When firmware is reloaded, and router failed to connect to WiFi (because unlikely your home WiFi is named "OpenWrt" and has password “1”), side blue led starts lighting and going out every ten seconds.

Robot firmware setting up

There are two ways to set-up OR-WRT wirmware

  • ssh 192.168.0.1, with LAN cable connected to any router LAN/WAN port. Also ssh <wifi ip>, if wifi is already configured and up. Login root, password 123
  • Type in in browser http://192.168.0.1 with LAN cable or http://<wifi IP> via wifi, if wifi is already configured and up. Login admin, password oradmin. There is a link to admin pages on the frontpage.

Home WiFi connection

It is supposed that the router is connected to a home network wifi as the static IP client.

  • Select approaching IP. It should be in IP range of the network, not to be occuped, and to be out of DHCP address range.
  • Open web interface, then admin pages, and there is a "WiFi" page. There you can set up:
    • protection: WPA-PSK/WPA2-PSK, NONE
    • network SSID
    • password
    • static IP
    • netmask
    • default GW
    • dns

As a network configuration check, firmware pings default gateway address every ten seconds. If the ping is unsuccessful, the blue LED is lit for next ten seconds. So it can light time to time even if wifi is working IP in case of packet drop (it happens time to time).

Webcam Settings

On camera settings page you can choose:

  • resolution
  • frame rate
  • camera number (connection of several cameras through USB-hub is possible)
  • YUV or MJPEG modes

Firmware usage

Videostream and singler frames

  • Videostream in mjpg format: http://wifi-ip:8080/?action=stream
  • Single frame in jpg http://wifi-ip:8080/?action=snapshot

UART

Internal UART

There are two ways to access it

  • ser2net daemon redirects UART traffic through TCP port 2000
  • you can write to UART with http protocola at URL /cgi-bin/serial.cgi , POST method, Http parameter SERIAL_DATA value will be sent to UART

Silicon Labs CP210x (OR-USB-UART)

Add the following line to /etc/config/ser2net.conf file:

3001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS

After router reboot serial traffic will be redirected to TCP port 3001

Pololu Orangutan SVP-1284

На оборудовании tenik удалось связать роутер с систмой Pololu Orangutan:

в файл /etc/rc.local для перезапуска драйвера были добавлены строки:

rmmod usbserial
insmod usbserial vendor=0x1ffb product=0x0087

в файл /etc/config/ser2net.conf добавлены строки:

3001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
3002:raw:600:/dev/ttyUSB1:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
3003:raw:600:/dev/ttyUSB2:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS

После перезагрузки 3 UART порта Pololu доступны на TCP портах 3001, 3002, 3003

How to modify firmware

For serious firmware modification see documentation on OpenWRT

Uploading custom web-pages for robot control

Actual webpages is available for download through robot admin "site". For new pages uploading by WiFi I use command:

pscp.exe -r -pw 123 -scp www/* root@192.168.1.120:/www

pscp is utility for SSH upload from Putty distributive.

Don't upload files to /cgi-bin/* such way, because access restriction attributes.

Unsolved problems

  • Video latency. Even in 160*120,30 fps, but small.
  • No easy-to-use password change method, only through SSH console (passwd command).
  • Security. Robot with such firmware must be controlled through secure protocol. Now video is streamed unencrypted on 8080 port. Web-face and controls - through http or https, with password or not. Most correct method - https+password. But https is very slow in current config.
  • Webface scripts written on awk & ash, support is difficult, need to migrate to Lua
  • Webface contents obvious bug - settings pages always shows default settings instead of current settings

Other warnings

  • Don't disable both HTTP and HTTPS at the same time. In this case router configuring will be available only through SSH.
  • Don't forget about security risks. Remember, that somebody may spy on you through webcam, and mobile robot can damage something or even cause injuries.

Downloads

Файл:Or-wifi-dir320-0.54.tar.gz

What inside?

  • Ready-to-use firmware in .trx-format.
  • Kernel and addons for standard ImageBuilder from OpenWRT backfire 10.03.01-RC6, used to build firmware.
  • make.sh file, used to build and pack firmware.

Links