Tuesday, February 21, 2012

Motion Tracking on a wireless router (OpenWRT)


Setup: TP LINK WR703N (installed OpenWRT), a USB camera (UVC compatible)

The WR703N comes with a USB host, so let's connect a USB camera to it. Usually a modern usb camera should work without problem, let's telnet to the router (e.g. telnet 192.168.1.1):

opkg update
opkg install kmode-video-core kmod-video-uvc 

Once the kmod-video-uvc is installed, you can now attach the USB camera to the router, and then you will find a device file appears: /dev/video0

That's mean the camera should ready to go.

so let's install the motion package:
opkg install motion




The WR703N doesn't have enough flash memory, so I copy the motion configuration file to /tmp (RAM), and then you have to edit the motion.conf:

change stream_localhost on to off
change locate_motion_mode off  to on

run it:
motion -c /tmp/motion.conf


View it:

Open a browser with the URL:
http://192.168.1.1:8081/
 


Demo Video:



Monday, February 20, 2012

My experience with OpenWRT on TP-LINK WR703N


Just got a TP-LINK WR703N, which is a low cost 3G-wifi router. It comes with a USB host, one LAN port, one WIFI interface, and a mini usb connector for power supply.

It would be a nice choice for hobbyist to hack and do somethings cool with it. For example, may be a WIFI enabled sensor is awesome!


Let's get started!


*** Do at your own risk! May damage your router ****

[Flash OpenWRT]

As it is a new device, I use the firmware upgrade web interface inside (http://192.168.1.1, admin/admin) to flash openwrt firmware:

Download the latest firmware from the openwrt website: http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

Once it is flashed successfully, it will reboot and then you can try to telnet to it.
 
telnet 192.168.1.1
 
root@OpenWrt:/# cat /proc/cpuinfo

system type : Atheros AR9330 rev 1
machine : TP-LINK TL-WR703N v1 processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 265.42
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes,
count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented : mips16
shadow register sets : 1
kscratch registers :
0 core : 0 VCED exceptions : not available VCEI exceptions : not available

[Web Administrative Interface]

Once enabled telnet, you can try connect the LAN port to a router with internet access and it would be able to access the internet.

At this point, assuming you can access the internet in the openwrt telnet console. We are going to install the web GUI for easy configuration:


To retrieve the current list of available packages in the repository do
opkg update
then for a full LuCI installation without HTTPS support enter
opkg install luci
Enable (so that it will be started at every boot) and start uHTTPd:
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start
You should now be able to connect with a web browser to you router : http://192.168.1.1/

(More info on http://wiki.openwrt.org/doc/howto/luci.essentials)

[USB mass storage]
Assuming you still have the internet access, let's fetch in the usb mass storage essentials:

opkg update
opkg install kmod-usb-storage block-mount

Also, you have to install the file system and codepage related modules.
for fat32 (Windows compatible), I installed the following:

opkg install kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 

For other file systems, please check the following document:
http://wiki.openwrt.org/doc/howto/usb.storage

Now, you can mount the usb disk!
mkdir /mnt/usb
mount /dev/sda1 /mnt/usb

[USB to Serial : Silicon Labs CP210x]


The usb driver for cp210x is not available in the pre-complied packages, I have compiled using openwrt build system (based on Kernel 3.2.5), you can download here:
http://androidhk.com/usb2serial.tar.gz

put the *.ko in /tmp
and then
insmod /tmp/usbserial.ko
insmod /tmp/cp210x.ko


Once you attached the usb2serial adapter, the /dev/ttyUSB0 will be ready to use. Now, you can communicate with the MCU.


[References]
Official TLWR703N openwrt page: http://wiki.openwrt.org/toh/tp-link/tl-wr703n

Sunday, February 5, 2012

iModela 3D Milling Machine targets for hobbyist.


iModela is a 3D Milling Machine made by Roland. It is small in size, using CNC milling mechanism to provide 3 axis milling facilities. You can make 2D and 3D objects in your home with this small machine. It costs US$899.

Let'see how it prints 3D object: via http://icreate.rolanddg.com/iModela/Global/English/index.html/

LifeLike android mannequin in Tokyo Store.

This female mannequin is the production of Dr Hiroshi Ishiguro of Osaka University. It looks very real to me, hopefully you will see more of these robots in Tokyo store. May be sometimes they will give you a smile when you passing by.