Материал из roboforum.ru Wiki
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
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).
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.
What is new compared to 0.70
- Changed the installation procedure and created initial setup script
- Support USB flash cards (extroot)
- Sound support
- New diagnostics of wifi connectivity:
- Support for WR-703n
- LED is blinking when the wifi connection is unavailable
- Support for new WR-703N bootloader (TP-Link TL-WR703N (v1.7) uboot v1.1.4.)
- Own package repository
- Admin pages show real current settings but not the default ones as before
- WiFi Access Point mode(can be switched off)
- dhcp over LAN
- bunch of small fixes
Look at the documentation: http://roboforum.ru/wiki/OR-WRT_0.76
- WiFi routers:
- TP-LINK MR3020
- TP-LINK WR703N
- May be any other routers, based on SoC Atheros AR9331(not tested yet)
- You can try to modify firmware by you own for other USB-equipped routers compatible with OpenWRT.org
All UVC-webcams (consider this list — [http://www.ideasonboard.org/uvc/]).
We recommend MJPEG-webcams, but YUV-webcams can be used too (but with increased latency of video-streaming).
- Silicon Labs CP210x, including OR-USB-UART-v1
- Prolific PL2302
- Pololu Orangutan SVP-1284 (with some patching, see below)
- Others weren't checked, most likely will be supported..
TODO. Now the only Russian page is available OR-WRT_0.76_install
Robot firmware setting up
There are two ways to set-up OR-WRT wirmware
ssh 192.168.217.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 as was set initially
- Type in in browser http://192.168.217.1 with LAN cable or http://<wifi IP> via wifi, if wifi is already configured and up. Login root, password as was set initially. 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
- static IP
- default GW
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).
Router as an WiFi Access Point
Jut enable access point mode in the settings, using your web-browser. When the router is rebooted, it will act as wifi access point.
- SSID by default - OR_WRT,
- Network password by default - 12345678
- IP addess (can't be changed through web-interface) - 192.168.218.1
- Client IP address is automatically leased by dhcp service.
On camera settings page you can choose:
- frame rate
- camera number (connection of several cameras through USB-hub is possible)
- YUV or MJPEG modes
Videostream and singler frames
- Videostream in mjpg format: http://wifi-ip:8080/?action=stream
- Single frame in jpg http://wifi-ip:8080/?action=snapshot
NB! Internet Explorer does not support MJPEG video. Use FireFox or Chrome
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), FTDI, Prolific PL2302
- ser2net daemon redirects UART traffic from up to five ports through TCP ports 3000..3005.
- 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. The serial.cgi script shall be slight modified.
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
After router reboot, Pololu's 3 UART ports are accessible on TCP ports 3001, 3002, 3003, respectively.
- Open the console using ssh(putty)
- Connect EMPTY usb flash card at least 500Mb
WARNING!!! All the data there will be destroyed! Be careful!
- Run script
- Wait until the router is rebooted
After reboot, there will be no partition table but there will be a ext4 filesystem with 480Mb of space.
- Ensure if there are USB hub, flash card and USB sound adapter(Webcam with microphone is OK) connected to the router.
- Make extroot working(see above).
- Make sure there is an internet connection awailable for the router.
- Run script
- Check the soung capure. The easiest way is to run VLC player with command(Win+R):
C:\Program Files (x86)\VideoLAN\VLC>vlc.exe http://root:[password]@[router IP]/cgi-bin/sound-spy.cgi
- Easiest sound streaming command:
C:\Program Files (x86)\VideoLAN\VLC>vlc.exe http://root:[password]@[router IP]/cgi-bin/sound-spy.cgi --repeat
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/* email@example.com:/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.
- 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.
- 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.
- Ready-to-use firmware in .trx-format.
- Kernel and addons for standard OpenWRT's ImageBuilder(12.09), used to build the firmware.
- make.sh file, which builds and packs the firmware.