Photos 相簿

Inventory 清单

Web Space

Tools

TL-WR703N Webcam Streaming

Get a router, load it with the standard image.

Set-up wireless or any other networking changes. See an example here.

Plug in the camera

Now there are two ways to get mjpg-streamer to auto-start, there is an easy way and an elegant way.
Easy way : Just add the command to the auto start script using LuCi…
Elegant way : Edit the configuration files /etc/init.d/mjpg-streamer and /etc/config/mjpg-streamer

This command forces mjpg-streamer to convert into raw into JPEG at (-q) quality 60, at resolution (-r) QVGA, this can be “160×120″ for example. The frame rate is specified by the -f (6). This method is MUUUUUUUUCH more CPU intensive and you might have to tweak the resolution and frame rate down.

Using a device connected to the router, use a web browser (e.g. Chrome) to connect to the following to get a live view:

http://192.168.1.1:8080/?action=stream

You can also get a single snapshot at:

http://192.168.1.1:8080/?action=snapshot

If you need to play around with the commands, use CTRL-C to kill mjpg-streamer and try again. Avoid high resolutions (e.g. 1920×1080) as that will just crash the router. I used 640×480 at 25 frames per second relatively happily on a JPEG enabled camera (e.g. Logitech/Microsoft ones, not the cheap no brand ones).

Once you have a workable set-up, copy the command you have and put it into the local start-up. Append the command line with an ampersand “&” so it runs in the background. e.g.

In Luci, select the Systems tab, then select Startup, scroll down to the Local Startup section and add your command to the box and press save and apply.

Control Arduino to Openwrt

The Arduino is plug into the USB port of TP-LINK TL-WR1043ND allow the router to control the Arduino.

Install FTDI USB Serial

opkg update
opkg install kmod-usb-serial-ftdi

Install USB Device drivers

If you are using Teensy or Arduino Uno
opkg install kmod-usb-acm
If you are using PL2303 based USB/serial adapters
opkg install kmod-usb-serial-pl2303
If you are using CP201x based USB/serial adapters
opkg install kmod-usb-serial-cp210x

Verify USB Serial driver

Plug in Arduino to the USB port of router and execute the following command.

Install Serial to Net ( ser2net or socat )

To install ser2net :

opkg install ser2net
vi /etc/ser2net.conf
To make ser2net listen on TCP port 1234, append 1 line to the end of /etc/ser2net.conf
1234:raw:0:/dev/ttyUSB0:9600
Start ser2net manually
ser2net
ser2net will start based on ser2net configuration file

To install socat :

opkg install socat

Start socat manually (Arduino Duemilanove)
socat tcp-l:1234,reuseaddr,fork file:/dev/ttyUSB0,nonblock,raw,echo=0,waitlock=/var/run/tty,b9600
This will open a tcp 1234 port & set to baud rate 9600. The usb serial port will be /dev/ttyUSB0

Communicate with Arduino

1. Run realTerm
2. Click on Port tab
3. Enter 9600 for Baud since the default baud rate for the Arduino is set to 9600
4. Enter 192.168.1.1:1234, where 192.168.1.1 is the router IP & 1234 is the port. Make sure it match with the ser2net or socat settings.
5. Click on Open button
6. Click on Send tab
7. Enable +CR from EOL since the Arduino require Carriage Return as the termination.