OR-WRT 0.60-Eng — различия между версиями

Материал из roboforum.ru Wiki
Перейти к: навигация, поиск
(Routers)
 
(не показаны 24 промежуточные версии 2 участников)
Строка 1: Строка 1:
[[Category:Open Robotics Eng]]
+
[[Category:ORWRT]]
 +
[[Category:Open Robotics]]
  
 
=About=
 
=About=
 +
[[Изображение:OR-WRT-webface.jpg|thumb|200px|OR-WRT control panel.|right]]
 +
 
==Project description==
 
==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 is subproject of Open Robotics project, intended to production easy-to-use, low-cost platforms for hobby robotics (also not only hobby).
Строка 14: Строка 17:
  
 
==WARNING==
 
==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.
+
You are doing all modifications 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 =
 
= Supported equipment =
  
 
== Routers ==
 
== Routers ==
 +
<gallery>
 +
file:TL-MR3020-02.jpg|TP-Link MR3020
 +
file:WR703n-photo.jpg|TP-Link WR703N
 +
file:Dir-320-photo.jpg|D-Link DIR-320
 +
file:DIR-320_NRU.jpg|D-Link DIR-320 NRU
 +
</gallery>
 
* WiFi routers:
 
* WiFi routers:
 +
** TP-LINK MR3020
 +
** TP-LINK WR703N
 
** D-Link DIR-320 (but not DIR-320NRU, aka "H/W ver B1"!),
 
** D-Link DIR-320 (but not DIR-320NRU, aka "H/W ver B1"!),
 
** ASUS wl500gP (tested by ddcharacter)
 
** ASUS wl500gP (tested by ddcharacter)
** May be any other routers, based on SoC Broadcom BCM47xx/53xx (not tested yet)
+
** May be any other routers, based on SoC Broadcom BCM47xx/53xx or Atheros AR9331(not tested yet)
 
** You can try to modify firmware by you own for other USB-equipped routers compatible with [http://openwrt.org/ OpenWRT.org]
 
** You can try to modify firmware by you own for other USB-equipped routers compatible with [http://openwrt.org/ OpenWRT.org]
  
Строка 28: Строка 39:
 
All UVC-webcams (consider this list — [[http://www.ideasonboard.org/uvc/ http://www.ideasonboard.org/uvc/]]).
 
All UVC-webcams (consider this list — [[http://www.ideasonboard.org/uvc/ http://www.ideasonboard.org/uvc/]]).
  
We recomment MJPEG-webcams, but YUV-webcams can be used too (but with increaced latency of video-streaming).
+
<b>Video noise is reported with webcams Logitech С-270 </b>
  
== USB-UART interfaces ==
+
We recomment MJPEG-webcams, but YUV-webcams can be used too (but with increased latency of video-streaming).
 +
 
 +
== USB-UART adapters ==
 
* Silicon Labs CP210x, including [http://shop.roboforum.ru/product/or-usb-uart-v1-usb-uart-adapter/ OR-USB-UART-v1]
 
* Silicon Labs CP210x, including [http://shop.roboforum.ru/product/or-usb-uart-v1-usb-uart-adapter/ OR-USB-UART-v1]
 
* Pololu Orangutan SVP-1284 (with some patching, see below)
 
* Pololu Orangutan SVP-1284 (with some patching, see below)
Строка 45: Строка 58:
 
#* Start Flashing ****
 
#* Start Flashing ****
 
#* Successfull transfer: 3592480 bytes in 11 сs, 281134 bytes/s
 
#* Successfull transfer: 3592480 bytes in 11 сs, 281134 bytes/s
# Wait for about 5 minutes. When firmware is reloaded, and router fail to connect to WiFi (because unlikely your home WiFi is named "OpenWrt" and has password “1”), blue led will start flashing on the side of router every 10 seconds.
+
# 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=
* ssh 192.168.0.1 по кабелю в любой порт роутера или ssh <wifi ip>, если wifi поднялся. Login root, password 123
+
There are two ways to set-up OR-WRT wirmware
* [http://192.168.0.1 http://192.168.0.1] по кабелю либо http://<wifi IP> по wifi, если wifi поднялся. Login admin, password oradmin. На первой странице внизу ссылка на админку.
+
* <code>ssh 192.168.0.1</code>, with LAN cable connected to any router LAN/WAN port. Also <code>ssh <wifi ip></code>, if wifi is already configured and up. Login root, password 123
==Подключение к домашней WiFi-сети==
+
* Type in in browser <nowiki>http://192.168.0.1</nowiki> with LAN cable or <nowiki>http://<wifi IP></nowiki> via wifi, if wifi is already configured and up. Login admin, password oradmin. There is a link to admin pages on the frontpage.
Предполагается, что роутер подлючается к домашней сети wifi как клиент со статическим IP.  
+
== Home WiFi connection ==
* Выберите подходящий IP. Он должен быть в диапазоне IP сети, не быть занять, и быть вне диапазона адресов, раздаваемых DHCP сервером.
+
Robot head device(customized router) is supposed to be connected to a home network wifi as the static IP client.
* Зайдите на web интерфейс прошивки, в админке есть соответсвующая страница. Там вы можете поставить:
+
* Select approaching IP. It should be in IP range of the network, not to be occuped, and to be out of DHCP address range.
** защита WPA-PSK/WPA2-PSK,NONE
+
* Open web interface, then admin pages, and there is a "WiFi" page. There you can set up:
** имя сети SSID
+
** protection: WPA-PSK/WPA2-PSK, NONE
** пароль
+
** network SSID
 +
** password
 
** static IP
 
** static IP
 
** netmask
 
** netmask
 
** default GW
 
** default GW
 
** dns
 
** dns
В качестве проверки работоспособности сети прошивка раз в 10 секунд однократно пингует адрес default gateway. В случае неудачного ping зажигается голубой светодиод на следующие 10 секунд. Так что он может иногда загораться при работающем IP в случае выпадения пакета (такое бывает).
+
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).
==Настройка веб-камеры==
 
На странице настройки камеры вы можете выбрать:
 
* разрешение
 
* fps
 
* номер камеры(возможно подключение нескольких камер через USB-hub)
 
* YUV или MJPEG режимы
 
  
=Использование прошивки на ПК=
+
== Webcam Settings ==
==Получение видеопотока или отдельных кадров==
+
On camera settings page you can choose:
* видеопоток в формате mjpg "http://wifi-ip:8080/?action=stream"
+
* resolution
* кадр в формате jpg "http://wifi-ip:8080/?action=snapshot"
+
* frame rate
 +
* camera number (connection of several cameras through USB-hub is possible)
 +
* YUV or MJPEG modes
  
==Проброска UART-а==
+
=Firmware usage=
 +
==Videostream and singler frames==
 +
* Videostream in mjpg format: <nowiki>http://wifi-ip:8080/?action=stream</nowiki>
 +
* Single frame in jpg <nowiki>http://wifi-ip:8080/?action=snapshot</nowiki>
  
=== Встроенный UART===
+
== UART ==
Доступен двумя способами
+
[[Изображение:Dir-320-UART-pinout.jpg|thumb|200px|UART pinout in DIR-320.|right]]
* сервис ser2net транслирует обмен на TCP порт 2000
+
 
* запись в порт доступна по протоколу http URL ''/cgi-bin/serial.cgi'' , метод POST, значение параметра SERIAL_DATA будет записано в порт
+
=== Internal UART===
===CP210x (OR-USB-UART)===
+
There are two ways to access it
в файл /etc/config/ser2net.conf надо добавить строку:
+
* 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 <code>/etc/config/ser2net.conf</code> file:
 
<pre>
 
<pre>
 
3001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
 
3001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
 
</pre>
 
</pre>
  
После перезагрузки UART порт доступен на TCP порту 3001
+
After router reboot serial traffic will be redirected to TCP port 3001
  
 
===Pololu Orangutan SVP-1284===
 
===Pololu Orangutan SVP-1284===
На оборудовании tenik удалось связать роутер с систмой Pololu Orangutan:
+
Thanks to <b>tenik</b>, I was able to connect the router to Pololu Orangutan:
  
в файл /etc/rc.local для перезапуска драйвера были добавлены строки:
+
Append following lines to /etc/rc.local to restart UART kernel module:
 
<pre>rmmod usbserial
 
<pre>rmmod usbserial
 
insmod usbserial vendor=0x1ffb product=0x0087
 
insmod usbserial vendor=0x1ffb product=0x0087
 
</pre>
 
</pre>
  
в файл /etc/config/ser2net.conf добавлены строки:
+
Append following lines to /etc/config/ser2net.conf:
 
<pre>
 
<pre>
 
3001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
 
3001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS -XONXOFF -LOCAL -RTSCTS
Строка 103: Строка 120:
 
</pre>
 
</pre>
  
После перезагрузки 3 UART порта Pololu доступны на TCP портах 3001, 3002, 3003
+
After router reboot, Pololu's 3 UART ports are accessible on TCP ports 3001, 3002, 3003, respectively.
  
=Внесение изменений в прошивку=
+
=How to modify firmware=
Для внесения серьезных изменений в прошивку штудируем документацию [http://wiki.openwrt.org/doc/start OpenWRT]
+
For serious firmware modification see documentation on [http://wiki.openwrt.org/doc/start 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:
 
<pre>
 
<pre>
pscp.exe -r -pw 123 -scp www/* root@192.168.0.1:/www
+
pscp.exe -r -pw 123 -scp www/* root@192.168.1.120:/www
 
</pre>
 
</pre>
pscp входит в комплект программ Putty.
+
pscp is utility for SSH upload from Putty distributive.
 +
 
 +
<b>Don't upload files to /cgi-bin/* this way, uploaded files will have wrong linux attributes and they won't work.</b>
  
<b>Не заливайте файлы из каталогов /cgi-bin/* На них скорее всего слетят unix-права и прошивка перестанет работать.</b>
+
=Unsolved problems=
 +
* Video latency. In 160*120,30 fps MJPG mode it's minimal, but still exists.
 +
* No easy-to-use password change method, only through SSH console (passwd command).
 +
* Security. Robot with such firmware should be controlled through secure protocol. Now video is streamed unencrypted on 8080 port . Web-face and controls - through http or https, with or wtihout password. Most correct method - https+password but https connection is very slow.
 +
* Webface scripts written on awk & ash, support is difficult, need to be migrated to Lua.
 +
* Webface is undeimplemented - settings pages always shows default values instead of current settings.
  
=Нерешенные проблемы=
 
* Задержка видео. При использовании 160*120 30 fps она минимальная, но есть.
 
* Нет удобного способа менять пароль, только через SSH консоль (команда passwd).
 
* Защита. Робота с такой прошивкой надо держать на защищенном протоколе. Сейчас видео идет по http порт 8080 вообще открыто, web-face и управление - либо http либо https, либо с паролем, либо без. Самый правильный способ - https+пароль. Но https в данной конфигурации жутко тормозит.
 
* Скрипты Webface написаны на awk и ash, их неудобно поддерживать, Следует мигрировать на Lua
 
* Webface содержит явную недоделку - когда заходишь на страничку настройки, то она показывает не текущие значения из конфигов роутера, а ее собственные дефолты
 
 
=Other warnings=
 
=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 disable both HTTP and HTTPS at the same time. In this case router reconfiguration 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.
 
* 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 =
 
= Downloads =
[[File:Or-wifi-dir320-0.54.tar.gz]]
+
*[https://sourceforge.net/projects/orwrt/files/ Download from SourceForge]
  
 
What inside?
 
What inside?
 
* Ready-to-use firmware in .trx-format.
 
* Ready-to-use firmware in .trx-format.
* Kernel and addons for standard ImageBuilder from OpenWRT backfire 10.03.01-RC6, used to build firmware.
+
* Kernel and addons for standard OpenWRT's ImageBuilder(10.03.01-RC6), used to build the firmware.
* make.sh file, used to build and pack firmware.
+
* make.sh file, which builds and packs the firmware.
  
 
= Links =
 
= Links =
 
*[http://openwrt.org OpenWRT]
 
*[http://openwrt.org OpenWRT]
 
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Putty] - SSH-client for Windows
 
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Putty] - SSH-client for Windows

Текущая версия на 00:14, 15 сентября 2012


About

OR-WRT control panel.

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 all modifications 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:
    • TP-LINK MR3020
    • TP-LINK WR703N
    • 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 or Atheros AR9331(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/]).

Video noise is reported with webcams Logitech С-270

We recomment MJPEG-webcams, but YUV-webcams can be used too (but with increased 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

Robot head device(customized router) is supposed to be 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

UART pinout in DIR-320.

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

Thanks to tenik, I was able to connect the router to Pololu Orangutan:

Append following lines to /etc/rc.local to restart UART kernel module:

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

Append following lines to /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

After router reboot, Pololu's 3 UART ports are accessible on TCP ports 3001, 3002, 3003, respectively.

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/* this way, uploaded files will have wrong linux attributes and they won't work.

Unsolved problems

  • Video latency. In 160*120,30 fps MJPG mode it's minimal, but still exists.
  • No easy-to-use password change method, only through SSH console (passwd command).
  • Security. Robot with such firmware should be controlled through secure protocol. Now video is streamed unencrypted on 8080 port . Web-face and controls - through http or https, with or wtihout password. Most correct method - https+password but https connection is very slow.
  • Webface scripts written on awk & ash, support is difficult, need to be migrated to Lua.
  • Webface is undeimplemented - settings pages always shows default values instead of current settings.

Other warnings

  • Don't disable both HTTP and HTTPS at the same time. In this case router reconfiguration 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

What inside?

  • Ready-to-use firmware in .trx-format.
  • Kernel and addons for standard OpenWRT's ImageBuilder(10.03.01-RC6), used to build the firmware.
  • make.sh file, which builds and packs the firmware.

Links