Monday, 25 May 2015

Autostart Motion when OpenWRT boots


Make sure the config file is set to daemon mode - this lets openwrt run in the background
Open /etc/motion.conf using WinSCP and make sure daemon is set to on...

daemon on

save and close

Then load on boot.....

Open /etc/rc.local using WinSCP and replace with the following....

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
motion -c /etc/motion.conf
exit 0


Save and reboot, then it will then load automatically on startup.

Edit.......
I had an intermittent problem on reboot
In the kernel log on reboot I was getting:-
UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
It worked if I unplugged the camera and plugged it back in, or I power cycled the router just not on reboot (using reset button or from reboot in luci).
To get it working reliably on reboot, I had to edit /etc/modules.d/video-uvc to read

uvcvideo quirks=0x100


save and reboot

Thursday, 21 May 2015

Webcam Streaming

So I decided to add a webcam -  its a Microsoft LifeCam NX-3000

Notes - I used OpenWrt Barrier Breaker 14.07
see my  Flashing firmware post


1: install uvc drivers: kmod-video-uvc (I did this from luci software menu)
2: install motion (I did this from luci software menu)
3: reboot
4: check camera is recognised - should appear in /dev/video0:
ls -al /dev/video0 (I did this in putty)

If all is good then.......

5: edit the config file stored in  /etc/motion.conf (I used WinSCP)

change the entries below......

daemon off
this will turn off daemon mode (so that in putty you will get an output to tell you what is going on for testing)

v4l2_palette 8

output_pictures off
to stop you running out of memory after 5 pictures!
note you could add a usb hub and mount a memory stick for extra memory then change
target_dir to your memory stick.
stream_localhost off
this will let you view the stream remotely ie not just from the localhost!

6: Save the config file

7: start motion from putty: motion -c /etc/motion.conf

open firefox on a pc (internet explorer didn't work) and goto http://192.168.1.1:8081/
or whatever the ip address of your router is.

And Voila......



On

Saturday, 16 May 2015

Flashing with openwrt

I used OpenWrt Barrier Breaker 14.07
Download the firmware to your pc:
http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

Then login to the router and upload it to replace the chinese firmware.....

The router I had came with chinese firmware - log into it with the username and password printed on the back of the box and then follow below





You will loose connection while it flashes the firmware, and i can take 5 mins or so.
Once its rebooted you can login via ethernet cable on 192.168.1.1