Differenze tra le versioni di "Tutorials/arduino-yun-videorecorder-101"

Da WeMake Wiki.
Jump to navigation Jump to search
Riga 2: Riga 2:
  
 
== Arduino Yun Basics ==
 
== Arduino Yun Basics ==
 +
 +
This tutorial covers a little introduction to video recording with Arduino Yun and a USB webcam. No Arduino code in this first part, only some linux embedded configuration on the awesome Arduino Yun board!
 +
 +
I assume that the reader has a pc or a mac (named Bob) and an Arduino Yun, named Arduino. Moreover, I suppose the reader is quite familiar with the computer in general and know a little bit of shell/linux commands. In particular I in my case Bob is amac os/x and, and everything is starting with an iTerm2 session where everything begin with a dollar sign ($)..
  
 
=== Before starting ===  
 
=== Before starting ===  
Riga 9: Riga 13:
  
 
===Let's become confident with the board===
 
===Let's become confident with the board===
arduino.local does not always revole, safely to use  the ip number (192.168.240.1, for initial configuration).
+
arduino.local does not always resole, so safely to use  the ip number (192.168.240.1, for initial configuration) then the host name.
  
To log into the yun via ssh (from mac-osx shell):
+
To log into the yun via ssh (from Bob shell):
ssh root@192.168.1.13
+
$ ssh root@192.168.1.13
  
See what is already mounted:
+
Now you're logged in the Arduino Yun linux board. We are inside an embedded linux machine, in particular a child of [http://en.wikipedia.org/wiki/OpenWrt OpenWrt].
    mount
+
For briefness I will differentiate what is happening inside the iTerm session in Bob with $ and what is happening inside the yun shell accessed via ssh with ~.
  
 
See which distribution, kernel version, etc:
 
See which distribution, kernel version, etc:
     root@Arduino:~# cat /proc/version
+
     ~ cat /proc/version
 
     Linux version 3.8.3 (federico@smilzo) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #8 Mon Aug 19 16:22:39 CEST 2013
 
     Linux version 3.8.3 (federico@smilzo) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #8 Mon Aug 19 16:22:39 CEST 2013
 +
 +
See if the micro sd card is already mounted:
 +
    mount
 +
I won't specify every time the path but I'm going to use the micro sd card for storing videos or pic rues from the welcome.
  
 
Install some useful packages for video and webcam:
 
Install some useful packages for video and webcam:
    #---------------------------------------------------------------------
+
     ~ opkg update
    # install the video stuff on the yun
+
     ~ opkg install kmod-video-uvc kmod-video-pwc kmod-input-core
     opkg update
+
     ~ opkg install libjpeg fswebcam
     opkg install kmod-video-uvc
+
     ~ wget http://www.custommobileapps.com.au/downloads/mjpg-streamer.ipk
    opkg install kmod-video-pwc
+
     ~ opkg install mjpg-streamer.ipk
    opkg install kmod-input-core
+
     ~ opkg install ffmpeg ffserver
     opkg install libjpeg
+
     ~ opkg install python-openssl
    opkg install fswebcam
 
     wget http://www.custommobileapps.com.au/downloads/mjpg-streamer.ipk
 
     opkg install mjpg-streamer.ipk
 
     opkg install ffmpeg
 
    opkg install ffserver
 
     opkg install python-openssl
 
    #---------------------------------------------------------------------
 
  
 
After each installed package, to see free space on the hard disk:
 
After each installed package, to see free space on the hard disk:
     root@Arduino:~# df -h
+
     ~ df -h
 
     Filesystem                Size      Used Available Use% Mounted on
 
     Filesystem                Size      Used Available Use% Mounted on
 
     rootfs                    7.5M      4.9M      2.6M  66% /
 
     rootfs                    7.5M      4.9M      2.6M  66% /
Riga 49: Riga 50:
  
 
To run a python server
 
To run a python server
     root@Arduino:~# python -m SimpleHTTPServer
+
     ~ python -m SimpleHTTPServer
  
see if python server is running (from the os/x),
+
See if python server (or the streaming server, vide infra) is running (from Bob),
 
     $ nmap 192.168.1.13
 
     $ nmap 192.168.1.13
 
      
 
      
Riga 69: Riga 70:
 
== With standard usb uvc cam ==
 
== With standard usb uvc cam ==
  
To see the stream (from the os/x):
+
To see the stream (from Arduino to Bob):
open "http://arduino.local:8080/?action=stream" in a browser
+
     ~ mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 640x480" -o "output_http.so -p 8080 -w /mnt/sda1"
after running (on the yun via ssh):
+
Then open "http://arduino.local:8080/?action=stream" in a brower (inside Bob)
     mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 640x480" -o "output_http.so -p 8080 -w /mnt/sda1"
+
   
 
+
To shoot a photo (on Arduino):
to shoot a photo (on the yun via ssh):
+
     ~ fswebcam test.png
     fswebcam test.png
+
and to see the photo via http request from Bob, just start a
 
+
    ~ python -m SimpleHTTPServer
 
+
in the directory where the photo is saved and access it by browsing (from Bob) to "192.168.1.13/test.png"
== references ==
 
 
 
 
 
http://forum.arduino.cc/index.php?topic=188690.0
 
 
 
http://dev.mikamai.com/post/73613525813/arduino-yun-social-photo-camera
 
 
 
http://dev.mikamai.com/post/76945627390/you-cant-touch-this-an-evil-arduino-based-alarm
 
 
 
https://github.com/amicojeko/YouCantTouchThis
 
  
http://neuroballs.com/2014/01/how-to-build-a-arduino-yun-powered-cat-camera/
+
== With PS3 Eye webcam ==
  
https://learn.adafruit.com/wireless-security-camera-arduino-yun?view=all
+
== References ==
  
http://latanadelgurzo.blogspot.it/2012/11/webcam-in-streaming-con-openwrt.html
+
* [http://forum.arduino.cc/index.php?topic=188690.0 Arduino Forum - Guide to Setup Streaming Web Cam on the Yun]
 +
* [http://neuroballs.com/2014/01/how-to-build-a-arduino-yun-powered-cat-camera/ How-to build an Arduino Yun powered Camera]
 +
* [https://learn.adafruit.com/wireless-security-camera-arduino-yun?view=all Adafruit - Wireless Security Camera with Arduino Yun]
 +
* [http://latanadelgurzo.blogspot.it/2012/11/webcam-in-streaming-con-openwrt.html La tana del gurzo - Webcam streaming con OpenWRT ]
 +
* [http://dev.mikamai.com/post/73613525813/arduino-yun-social-photo-camera Mikamai dev-blog - Arduino Yun Social photo camera ]
 +
* [http://dev.mikamai.com/post/76945627390/you-cant-touch-this-an-evil-arduino-based-alarm Mikamai dev-blog - You can't touch this, Arduino based alarm ]

Versione delle 19:18, 2 mag 2014


Arduino Yun Basics

This tutorial covers a little introduction to video recording with Arduino Yun and a USB webcam. No Arduino code in this first part, only some linux embedded configuration on the awesome Arduino Yun board!

I assume that the reader has a pc or a mac (named Bob) and an Arduino Yun, named Arduino. Moreover, I suppose the reader is quite familiar with the computer in general and know a little bit of shell/linux commands. In particular I in my case Bob is amac os/x and, and everything is starting with an iTerm2 session where everything begin with a dollar sign ($)..

Before starting

Assure we have:

Let's become confident with the board

arduino.local does not always resole, so safely to use the ip number (192.168.240.1, for initial configuration) then the host name.

To log into the yun via ssh (from Bob shell): $ ssh root@192.168.1.13

Now you're logged in the Arduino Yun linux board. We are inside an embedded linux machine, in particular a child of OpenWrt. For briefness I will differentiate what is happening inside the iTerm session in Bob with $ and what is happening inside the yun shell accessed via ssh with ~.

See which distribution, kernel version, etc:

   ~ cat /proc/version
   Linux version 3.8.3 (federico@smilzo) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #8 Mon Aug 19 16:22:39 CEST 2013

See if the micro sd card is already mounted:

   mount

I won't specify every time the path but I'm going to use the micro sd card for storing videos or pic rues from the welcome.

Install some useful packages for video and webcam:

   ~ opkg update
   ~ opkg install kmod-video-uvc kmod-video-pwc kmod-input-core
   ~ opkg install libjpeg fswebcam
   ~ wget http://www.custommobileapps.com.au/downloads/mjpg-streamer.ipk
   ~ opkg install mjpg-streamer.ipk
   ~ opkg install ffmpeg ffserver
   ~ opkg install python-openssl

After each installed package, to see free space on the hard disk:

   ~ df -h
   Filesystem                Size      Used Available Use% Mounted on
   rootfs                    7.5M      4.9M      2.6M  66% /
   /dev/root                 7.0M      7.0M         0 100% /rom
   tmpfs                    29.9M    372.0K     29.5M   1% /tmp
   tmpfs                   512.0K         0    512.0K   0% /dev
   /dev/mtdblock3            7.5M      4.9M      2.6M  66% /overlay
   overlayfs:/overlay        7.5M      4.9M      2.6M  66% /
   /dev/sda1                 7.4G    848.0K      7.4G   0% /mnt/sda1

To run a python server

   ~ python -m SimpleHTTPServer

See if python server (or the streaming server, vide infra) is running (from Bob),

   $ nmap 192.168.1.13
   
   Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-30 13:03 CEST
   Nmap scan report for 192.168.1.13
   Host is up (0.19s latency).
   Not shown: 995 closed ports
   PORT     STATE SERVICE
   22/tcp   open  ssh
   53/tcp   open  domain
   80/tcp   open  http
   443/tcp  open  https
   8000/tcp open  http-alt
   
   Nmap done: 1 IP address (1 host up) scanned in 39.77 seconds

With standard usb uvc cam

To see the stream (from Arduino to Bob):

   ~ mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 640x480" -o "output_http.so -p 8080 -w /mnt/sda1"

Then open "http://arduino.local:8080/?action=stream" in a brower (inside Bob)

To shoot a photo (on Arduino):

   ~ fswebcam test.png

and to see the photo via http request from Bob, just start a

   ~ python -m SimpleHTTPServer

in the directory where the photo is saved and access it by browsing (from Bob) to "192.168.1.13/test.png"

With PS3 Eye webcam

References