motion安装和启动
树莓派3B型(motion安装和启动):
安装依赖的库
sudo apt-get install libc6 libc6-dev
sudo apt-get install libjpeg9-dev
sudo apt-get install libav-tools
sudo apt-get install libavcodec-extra-(52|53|5x) (for avconv mp3 support)
sudo apt-get install zlib1g and zlib1g-dev
摄像头安装和驱动
- 淘宝或者京东上购买一下,CSI摄像头(500w/800w)接入就可以。
- sudo raspi-config 开启camera
- install v4l2驱动
https://www.linuxtv.org/downloads/v4l-utils/
https://www.zybuluo.com/SiberiaBear/note/53130
https://www.linuxtv.org/downloads/v4l-utils/v4l-utils-1.10.1.tar.bz2
sudo apt-get install autoconf gettext libtool libjpeg62-dev
./configure
make
And, to install on your system:
sudo make install
sudo vim /etc/modules-load.d/modules.conf
增加一行 bcm2835-v4l2
然后重启,即可自动加载驱动
或者
# Load the module
sudo modprobe bcm2835-v4l2 //加载驱动
# Control the viewfinder
v4l2-ctl --overlay=1 # enable viewfinder
v4l2-ctl --overlay=0 # disable viewfinder
# Record a video
v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4
v4l2-ctl --stream-mmap=3 --stream-count=100 --stream-to=somefile.264
# Capture a JPEG image
v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3
v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=somefile.jpg
# Set the video bitrate
v4l2-ctl --set-ctrl video_bitrate=10000000
# List the supported formats
v4l2-ctl --list-formats
安装完成后 看下/dev/video0 是否有了
raspistill -o keychain.jpg -t 2000 测试一下
安装deb包
打开 https://github.com/Motion-Project/motion/releases/tag/release-3.4.1 下载对应的deb包
sudo apt-get install libpq5
wget http://books.michaelapp.com/pi/motion_3.4.1raspbianjessierc01-1_armhf.deb
dpkg -i motion_3.4.1raspbianjessierc01-1_armhf.deb
运行
motion -n -c motion-dist.conf -d 5
系统升级
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo rpi-update
GPIO
pi@raspberrypi:~/gopro/src/github.com/panyingyun/webtest $ gpio readall
+-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5V | | |
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 0 | IN | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 0 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 0 | 35 || 36 | 0 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | IN | 0 | 37 || 38 | 0 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 0 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+