/boot/config.txt に以下追加。
max_usb_current=1
safe_mode_gpio=4
2019年5月4日土曜日
2019年4月30日火曜日
安全確実な dd
バックアップされたimgを dd でリストアする訳だが、bs= の数値を高く
指定しすぎると正常にリストアされない。
安全にリストアする方法、、、
**@**:/$ sudo dd if=/home/**/**/20190428-DLNA.img of=/dev/mmcblk0 bs=512 conv=noerror,sync status=progress
指定しすぎると正常にリストアされない。
安全にリストアする方法、、、
**@**:/$ sudo dd if=/home/**/**/20190428-DLNA.img of=/dev/mmcblk0 bs=512 conv=noerror,sync status=progress
2019年3月5日火曜日
DDNS の変更 DDNS Now へ
2019-03-05
ieServer の調子が悪い。
以前からip更新の伝播が数時間かかるなど、具合が悪かったのだが、
ここにきて、まったく伝播しなくなった。
それで、使いやすい無料のDDNSサービスを探したところ、DDNS Now がよさげ。
*******.f5.si
がURL。
しかし、DiCE で自動更新させようとしたが、x86用のバイナリらしくARMだと、実行できない。
raspberry pi でも可能な方法としては、cron で HTTP get 。
これだけで、ip が更新される。
10 * * * * wget -q -O /dev/null - 'https://f5.si/update.php?domain=********&password=**********&ip='
伝播も数十秒と、段違いの速さ。
DDNS Now の仕様説明として、
「IPアドレスの更新に対する頻度や回数の制限は一切ありません。
頻繁な変更やアドレス無変化での更新を行っても要求がブロックされることはありません。
サービスの利用料金は永久に無料で、クエリー数や利用期間に応じて課金されることは
ありません。」
とあるので、問題ないだろう。ありがたい。
ieServer の調子が悪い。
以前からip更新の伝播が数時間かかるなど、具合が悪かったのだが、
ここにきて、まったく伝播しなくなった。
それで、使いやすい無料のDDNSサービスを探したところ、DDNS Now がよさげ。
*******.f5.si
がURL。
しかし、DiCE で自動更新させようとしたが、x86用のバイナリらしくARMだと、実行できない。
raspberry pi でも可能な方法としては、cron で HTTP get 。
これだけで、ip が更新される。
10 * * * * wget -q -O /dev/null - 'https://f5.si/update.php?domain=********&password=**********&ip='
伝播も数十秒と、段違いの速さ。
DDNS Now の仕様説明として、
「IPアドレスの更新に対する頻度や回数の制限は一切ありません。
頻繁な変更やアドレス無変化での更新を行っても要求がブロックされることはありません。
サービスの利用料金は永久に無料で、クエリー数や利用期間に応じて課金されることは
ありません。」
とあるので、問題ないだろう。ありがたい。
2017年12月26日火曜日
raspberry pi Zreo に 3port HUB hight Speed Ethernet Adapter
raspberry pi Zreo に USB 3.0 3ポート ハブ USB3.0 高速ハブ LANアダプタ付き 軽量 コンパクト (改良版) を使った。
価格: ¥ 1,429 通常配送無料
lanは1000BASE-Tで チップは ReakTek r8152/r8153 だそうだ。
【usb】
pi@raspiDLNA:~ $ lsusb
Bus 001 Device 003: ID 0bda:8153 Realtek Semiconductor Corp.
【ドライバ】
pi@raspiDLNA:~ $ lsmod
Module Size Used by
r8152 41022 0
【速度】
pi@raspiDLNA:~ $ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.11.12 port 5001 connected with 192.168.11.13 port 57163
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.1 sec 114 MBytes 94.1 Mbits/sec
[ 5] local 192.168.11.12 port 5001 connected with 192.168.11.13 port 57188
[ 5] 0.0-10.1 sec 113 MBytes 94.2 Mbits/sec
[ 4] local 192.168.11.12 port 5001 connected with 192.168.11.13 port 57211
[ 4] 0.0-10.1 sec 113 MBytes 94.2 Mbits/sec
と、良好。
pi Zero に仕込んだDLNAサーバからのwav96kHzでも音飛び皆無。
気のせいか、全体的に音質も向上した。
価格: ¥ 1,429 通常配送無料
lanは1000BASE-Tで チップは ReakTek r8152/r8153 だそうだ。
【usb】
pi@raspiDLNA:~ $ lsusb
Bus 001 Device 003: ID 0bda:8153 Realtek Semiconductor Corp.
【ドライバ】
pi@raspiDLNA:~ $ lsmod
Module Size Used by
r8152 41022 0
pi@raspiDLNA:~ $ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.11.12 port 5001 connected with 192.168.11.13 port 57163
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.1 sec 114 MBytes 94.1 Mbits/sec
[ 5] local 192.168.11.12 port 5001 connected with 192.168.11.13 port 57188
[ 5] 0.0-10.1 sec 113 MBytes 94.2 Mbits/sec
[ 4] local 192.168.11.12 port 5001 connected with 192.168.11.13 port 57211
[ 4] 0.0-10.1 sec 113 MBytes 94.2 Mbits/sec
と、良好。
pi Zero に仕込んだDLNAサーバからのwav96kHzでも音飛び皆無。
気のせいか、全体的に音質も向上した。
2017年12月24日日曜日
raspberry pi Zreo に SODIAL(R)USB 2.0 3ポートハブ イーサネットネットワークLANカードアダプター10/100Mbp
raspberry pi Zreo に SODIAL(R)USB 2.0 3ポートハブ イーサネットネットワークLANカードアダプター10/100Mbp を使った。
¥ 511 + 配送料無料 と激安。だが、激遅。
チップは dm9601 と言うやつらしい。
【lan内速度】
pi@raspiDLNA:~ $ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.11.9 port 5001 connected with 192.168.11.10 port 48187
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.5 sec 6.88 MBytes 5.51 Mbits/sec
[ 5] local 192.168.11.9 port 5001 connected with 192.168.11.10 port 48218
[ 5] 0.0-10.4 sec 6.12 MBytes 4.94 Mbits/sec
[ 4] local 192.168.11.9 port 5001 connected with 192.168.11.10 port 48323
[ 4] 0.0-10.8 sec 5.25 MBytes 4.07 Mbits/sec
[ 5] local 192.168.11.9 port 5001 connected with 192.168.11.3 port 50233
[ 5] 0.0-10.6 sec 4.50 MBytes 3.56 Mbits/sec
激遅だ。なんとかしなくては。
ちなみに、同じlan内にある pi Zero W は、
pi@raspi-zero-W:~ $ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.11.14 port 5001 connected with 192.168.11.10 port 59246
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.6 sec 26.9 MBytes 21.3 Mbits/sec
と、まとも。
¥ 511 + 配送料無料 と激安。だが、激遅。
チップは dm9601 と言うやつらしい。
【lan内速度】
pi@raspiDLNA:~ $ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.11.9 port 5001 connected with 192.168.11.10 port 48187
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.5 sec 6.88 MBytes 5.51 Mbits/sec
[ 5] local 192.168.11.9 port 5001 connected with 192.168.11.10 port 48218
[ 5] 0.0-10.4 sec 6.12 MBytes 4.94 Mbits/sec
[ 4] local 192.168.11.9 port 5001 connected with 192.168.11.10 port 48323
[ 4] 0.0-10.8 sec 5.25 MBytes 4.07 Mbits/sec
[ 5] local 192.168.11.9 port 5001 connected with 192.168.11.3 port 50233
[ 5] 0.0-10.6 sec 4.50 MBytes 3.56 Mbits/sec
激遅だ。なんとかしなくては。
ちなみに、同じlan内にある pi Zero W は、
pi@raspi-zero-W:~ $ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.11.14 port 5001 connected with 192.168.11.10 port 59246
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.6 sec 26.9 MBytes 21.3 Mbits/sec
と、まとも。
2017年12月22日金曜日
raspberrypi DLNAサーバ 入替え
2017-12
B+で複数種サーバ運用していたが、raspberrypi Zero をまたひとつ入手したので、
こいつを DLNAサーバ専用とした。
気のせいか数年前のバージョンより音質がよくなったような。
96kHzWAV再生も可能になったし。
その設定。
【バージョン】
pi@raspiDLNA:~ $ uname -a
Linux raspiDLNA 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l GNU/Linux
pi@raspiDLNA:~ $ minidlnad -V
Version 1.1.6
【外付けvfatHDDのマウント】
pi@raspiDLNA:~ $ cat /etc/fstab
LABEL=HDL-C /home/pi/DLNA vfat user,rw,async,auto,noatime,uid=minidlna,gid=minidlna,iocharset=utf8,codepage=932,umask=000 0 0
B+で複数種サーバ運用していたが、raspberrypi Zero をまたひとつ入手したので、
こいつを DLNAサーバ専用とした。
気のせいか数年前のバージョンより音質がよくなったような。
96kHzWAV再生も可能になったし。
その設定。
【バージョン】
pi@raspiDLNA:~ $ uname -a
Linux raspiDLNA 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l GNU/Linux
pi@raspiDLNA:~ $ minidlnad -V
Version 1.1.6
pi@raspiDLNA:~ $ cat /etc/fstab
LABEL=HDL-C /home/pi/DLNA vfat user,rw,async,auto,noatime,uid=minidlna,gid=minidlna,iocharset=utf8,codepage=932,umask=000 0 0
pi@raspiDLNA:~ $ mount
/dev/sda1 on /home/pi/DLNA type vfat (rw,nosuid,nodev,noexec,noatime,uid=109,gid=113,fmask=0000,dmask=0000,allow_utime=0022,codepage=932,iocharset=utf8,shortname=mixed,errors=remount-ro,user)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=44452k,mode=700,uid=1000,gid=1000)
【自動起動】
pi@raspiDLNA:~ $ sudo crontab -l
#
########
@reboot sudo minidlnad -R
【miniDLNA設定】
pi@raspiDLNA:~ $ cat /etc/minidlna.conf
# This is the configuration file for the MiniDLNA daemon, a DLNA/UPnP-AV media
# server.
#
# Unless otherwise noted, the commented out options show their default value.
#
# On Debian, you can also refer to the minidlna.conf(5) man page for
# documentation about this file.
# Specify the user name or uid to run as.
#user=minidlna # ftp・samba サーバを入れると、保存フォルダsearchが拒否されるので、root起動とする
# Path to the directory you want scanned for media files.
#
# This option can be specified more than once if you want multiple directories
# scanned.
#
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
# * "A" for audio (eg. media_dir=A,/var/lib/minidlna/music)
# * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
# * "V" for video (eg. media_dir=V,/var/lib/minidlna/videos)
# * "PV" for pictures and video (eg. media_dir=PV,/var/lib/minidlna/digital_camera)
#media_dir=/var/lib/minidlna
media_dir=/home/pi/DLNA/disk/Music
# Set this to merge all media_dir base contents into the root container
# (The default is no.)
#merge_media_dirs=no
# Path to the directory that should hold the database and album art cache.
db_dir=/var/cache/minidlna
# Path to the directory that should hold the log file.
log_dir=/var/log
# Type and minimum level of importance of messages to be logged.
#
# The types are "artwork", "database", "general", "http", "inotify",
# "metadata", "scanner", "ssdp" and "tivo".
#
# The levels are "off", "fatal", "error", "warn", "info" or "debug".
# "off" turns of logging entirely, "fatal" is the highest level of importance
# and "debug" the lowest.
#
# The types are comma-separated, followed by an equal sign ("="), followed by a
# level that applies to the preceding types. This can be repeated, separating
# each of these constructs with a comma.
#
# The default is to log all types of messages at the "warn" level.
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
# Use a different container as the root of the directory tree presented to
# clients. The possible values are:
# * "." - standard container
# * "B" - "Browse Directory"
# * "M" - "Music"
# * "P" - "Pictures"
# * "V" - "Video"
# * Or, you can specify the ObjectID of your desired root container
# (eg. 1$F for Music/Playlists)
# If you specify "B" and the client device is audio-only then "Music/Folders"
# will be used as root.
#root_container=.
# Network interface(s) to bind to (e.g. eth0), comma delimited.
# This option can be specified more than once.
#network_interface=
# Port number for HTTP traffic (descriptions, SOAP, media transfer).
# This option is mandatory (or it must be specified on the command-line using
# "-p").
port=8200
# URL presented to clients (e.g. http://example.com:80).
#presentation_url=/
# Name that the DLNA server presents to clients.
# Defaults to "hostname: username".
friendly_name=raspiDLNA
# Serial number the server reports to clients.
# Defaults to the MAC address of nework interface.
#serial=
# Model name the server reports to clients.
#model_name=Windows Media Connect compatible (MiniDLNA)
# Model number the server reports to clients.
# Defaults to the version number of minidlna.
#model_number=
# Automatic discovery of new files in the media_dir directory.
inotify=yes
# List of file names to look for when searching for album art.
# Names should be delimited with a forward slash ("/").
# This option can be specified more than once.
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
# Strictly adhere to DLNA standards.
# This allows server-side downscaling of very large JPEG images, which may
# decrease JPEG serving performance on (at least) Sony DLNA products.
#strict_dlna=no
# Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
#enable_tivo=no
# SSDP notify interval, in seconds.
notify_interval=10 #これは、新規ファイル発見のためではなく、DLNAサーバのありかを知らせる。
# Path to the MiniSSDPd socket, for MiniSSDPd support.
#minissdpdsocket=/run/minissdpd.sock
# Always set SortCriteria to this value, regardless of the SortCriteria
# passed by the client
# e.g. force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title
#force_sort_criteria=
# maximum number of simultaneous connections
# note: many clients open several simultaneous connections while streaming
#max_connections=50
# set this to yes to allow symlinks that point outside user-defined media_dirs.
#wide_links=no
2017年11月2日木曜日
Raspberry Pi Zero v1.3 購入
スイッチサイエンスで当選したので購入
商 品 名:Raspberry Pi Zero v1.3
商品コード:RPI-ZERO(商品番号:3190)
数量 :1 個
単品価格 :¥ 648
-----------------------------------------------------------
小 計 ¥ 648
送 料 ¥ 150
値引き ¥ 0
手数料 ¥ 0
===============================================================
合 計 ¥ 798
商 品 名:Raspberry Pi Zero v1.3
商品コード:RPI-ZERO(商品番号:3190)
数量 :1 個
単品価格 :¥ 648
-----------------------------------------------------------
小 計 ¥ 648
送 料 ¥ 150
値引き ¥ 0
手数料 ¥ 0
===============================================================
合 計 ¥ 798
2017年8月2日水曜日
Raspberry Pi Zero W 購入
スイッチサイエンスで購入
商 品 名:Raspberry Pi Zero W
商品コード:RPI-ZERO-W(商品番号:3200)
数量 :1 個
単品価格 :¥ 1,296
-----------------------------------------------
小 計 ¥ 1,296
送 料 ¥ 150
値引き ¥ 0
手数料 ¥ 0
-----------------------------------------------
合 計 ¥ 1,446
以前、UK pimoroni から購入したWではない方の pi-zero の ddバックアップイメージをsdに焼いて、これで起動しようとしたが、だめだった。しかし、最新版のインストールイメージでは正常起動し、wifi も設定&使用できた。
2017年4月2日日曜日
とりあえずのaudio環境
Pioneer N-70A
STAX SR-007A,SRM-007tA
Raspberrypi+miniDLNA を通常はこれで聴く
BOSE 55WER,AM-033
これは、Lepy LP-2024A+改 からの出力用
network box
55WER行きコードはコネクタがなかったのでギボシで自作
ギボシは小が良い
ケーブルは AmazonBasics 16-Gauge
AM-033
short port にプチプチを詰めて調節
これがないと、低音が出すぎる
2017年1月1日日曜日
うるう秒挿入記念
2017/01/01(Sun)
22:08:22 up 36 days, 11:57, 0 users, load average: 0.29, 0.20, 0.16
[3106225.452699] Clock: inserting leap second 23:59:60 UTC
temp=29.9'C
2017/01/01(Sun)
22:08:48 up 140 days, 23:41, 0 users, load average: 0.45, 0.40, 0.40
[12134080.696376] Clock: inserting leap second 23:59:60 UTC
temp=28.2'C
22:08:22 up 36 days, 11:57, 0 users, load average: 0.29, 0.20, 0.16
[3106225.452699] Clock: inserting leap second 23:59:60 UTC
temp=29.9'C
2017/01/01(Sun)
22:08:48 up 140 days, 23:41, 0 users, load average: 0.45, 0.40, 0.40
[12134080.696376] Clock: inserting leap second 23:59:60 UTC
temp=28.2'C
2016年11月23日水曜日
microSDHC 8GB Class4 超高速UHS-1対応 バルク品 (8GB)
microSDHC 8GB Class4 超高速UHS-1対応 バルク品 (8GB)
注文内容
商品の小計: ¥ 488
配送料・手数料: ¥ 0
注文合計: ¥ 488
ご請求額: ¥ 488
2016-11-26に入替え。
容量不足により p2 は dd バックアップ不能
➔p2 を ext4 フォーマットし、cp -ar
注文内容
商品の小計: ¥ 488
配送料・手数料: ¥ 0
注文合計: ¥ 488
ご請求額: ¥ 488
2016-11-26に入替え。
容量不足により p2 は dd バックアップ不能
➔p2 を ext4 フォーマットし、cp -ar
2016年7月11日月曜日
Raspberry Pi Zero So-net 0SIM ngrok での使用状況
【Raspberry Pi Zero + L-02A + so-net 0SIM 気になるデータ使用量 】
・so-net 0SIMは、月500MBまで無料。
ngrokを使いso-netをトンネルさせている。500MBを超えると追加料金が発生するので、注意して記録してみた。
7月1日 0MB 未接続
7月2日 4MB 昼ごろから接続、外部からはアクセスせず
7月3日 12MB 少々アクセス
7月4日 9MB アクセスせず
7月5日 9MB アクセスせず
7月6日 9MB 再起動
7月7日 12MB
7月8日 0MB 再起動後wifiドングル経由通信になっていた事に気づかず
7月9日 24MB 設定確認のため、頻繁にアクセス
7月10日 9MB
7月11日16MB
・
・
7月トータル 約300MB
ngrokがトンネルを維持するため、最低1日9MB消費。外部からはあまりアクセスしないようにしなければ。
2016年7月10日日曜日
Raspberry Pi Zero mjpeg-streamer patch 改造
* mjpeg-streamer は -y オプションを付け、yuyv でしか画像取得できない状況。(2016-7現在)これを改善。
画質悪い。CPU負荷大。
以下サイトを参考にpatch。
http://u-tamax.jp/2016/05/raspbian-%E3%81%AB%E3%81%A6-mjpg-streamer-%E3%81%A7-mjpeg-%E3%82%92%E4%BD%BF%E3%81%86/
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97983
処理中、patch対象ファイルを絶対パスで数度指定する必要があったが、正常終了。debを作りインストール。-y 無しで正常起動できた(CPU負荷大幅減少)。
外部からL-02A経由でアクセスした場合でも、mjpg-streamerのクラッシュ頻度が減少。
電源考慮も不要な感じ。patch効果は大だ。
raspi-zero+L02A+C270+wifi の構成で当初は2A電源をつないでいたが、現在同構成で1A電源でもクラッシュ皆無。
*ピントずれ。改造して修正。
参考 http://tomokin-gadget.com/?p=1504
➔画質かなり改善。
画質悪い。CPU負荷大。
以下サイトを参考にpatch。
http://u-tamax.jp/2016/05/raspbian-%E3%81%AB%E3%81%A6-mjpg-streamer-%E3%81%A7-mjpeg-%E3%82%92%E4%BD%BF%E3%81%86/
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97983
処理中、patch対象ファイルを絶対パスで数度指定する必要があったが、正常終了。debを作りインストール。-y 無しで正常起動できた(CPU負荷大幅減少)。
外部からL-02A経由でアクセスした場合でも、mjpg-streamerのクラッシュ頻度が減少。
電源考慮も不要な感じ。patch効果は大だ。
raspi-zero+L02A+C270+wifi の構成で当初は2A電源をつないでいたが、現在同構成で1A電源でもクラッシュ皆無。
*ピントずれ。改造して修正。
参考 http://tomokin-gadget.com/?p=1504
➔画質かなり改善。
2016年7月9日土曜日
Raspberry Pi Zero monitでサービス自動再起動
ngrok でトンネルさせたURLへ L-02A 経由で外から接続すると mjpg-streamer が頻繁に落ちる。wifiドングル経由で内部から接続すると、落ちない。L-02Aが通信に使われると一時的に電力を大きく消費し、C270への供給電力が不足するから?
根本解決は後回し。とりあえずは、 monit で mjpg-streamer を自動で再起動させるようにした。
/etc/monit/conf.d/mjpg-streamer
check process mjpg_streamer matching "mjpg_streamer"
start program = "/home/pi/script/begin-mjpg-streamer"
stop program = "/usr/bin/killall mjpg_streamer"
if 5 restarts within 5 cycles then unmonitor
/home/pi/script/begin-mjpg-streamer
#!/bin/sh
#begin-mjpg-streamer
#
/home/pi/mjpg-streamer/mjpg_streamer -b -i "/home/pi/mjpg-streamer/input_uvc.so -f 1 -r 640x480 -d /dev/video0 -y" -o "/home/pi/mjpg-streamer/output_http.so -w /home/pi/mjpg-streamer/www -p 80"
-y オプションはpatch処理すると、無しにできる。電源状況も改善。
/etc/monit/monit/rc
set daemon 15
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
basedir /var/lib/monit/events
slots 100
set httpd port 2812 and
allow localhost
include /etc/monit/conf.d/*
根本解決は後回し。とりあえずは、 monit で mjpg-streamer を自動で再起動させるようにした。
/etc/monit/conf.d/mjpg-streamer
check process mjpg_streamer matching "mjpg_streamer"
start program = "/home/pi/script/begin-mjpg-streamer"
stop program = "/usr/bin/killall mjpg_streamer"
if 5 restarts within 5 cycles then unmonitor
/home/pi/script/begin-mjpg-streamer
#!/bin/sh
#begin-mjpg-streamer
#
/home/pi/mjpg-streamer/mjpg_streamer -b -i "/home/pi/mjpg-streamer/input_uvc.so -f 1 -r 640x480 -d /dev/video0 -y" -o "/home/pi/mjpg-streamer/output_http.so -w /home/pi/mjpg-streamer/www -p 80"
-y オプションはpatch処理すると、無しにできる。電源状況も改善。
/etc/monit/monit/rc
set daemon 15
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
basedir /var/lib/monit/events
slots 100
set httpd port 2812 and
allow localhost
include /etc/monit/conf.d/*
2016年7月6日水曜日
Raspberry Pi Zero usbシリアル接続
【材料】日本橋シリコンハウス共立で購入
USB-シリアル変換モジュール(PL-2303) 300円
GPIOヘッダーピン 1列40ピン 80円 (必要最低限のピン3本のみ使用)
ケーブル(4-4バラ) 80円
【制作状況】
【接続状況】
【接続】
linux機(thinkpad X200)にusb接続
$ dmesg
[358074.980075] usb 1-1: new full-speed USB device number 6 using uhci_hcd
[358075.142079] usb 1-1: New USB device found, idVendor=067b, idProduct=2303
[358075.142084] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[358075.142087] usb 1-1: Product: USB-Serial Controller
[358075.142090] usb 1-1: Manufacturer: Prolific Technology Inc.
[358076.272437] usbcore: registered new interface driver pl2303
[358076.272462] usbserial: USB Serial support registered for pl2303
[358076.272493] pl2303 1-1:1.0: pl2303 converter detected
[358076.285232] usb 1-1: pl2303 converter now attached to ttyUSB0
$ lsusb
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
$ screen /dev/ttyUSB0 115200
Raspbian GNU/Linux 8 raspi-zero ttyAMA0
raspi-zero login: pi
Password:
Last login: Wed Jul 6 19:56:06 JST 2016 from 192.168.2.102 on pts/0
Linux raspi-zero 4.4.11+ #888 Mon May 23 20:02:58 BST 2016 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
USB-シリアル変換モジュール(PL-2303) 300円
GPIOヘッダーピン 1列40ピン 80円 (必要最低限のピン3本のみ使用)
ケーブル(4-4バラ) 80円
【制作状況】
6,8,10に接続
【接続状況】
【接続】
linux機(thinkpad X200)にusb接続
$ dmesg
[358074.980075] usb 1-1: new full-speed USB device number 6 using uhci_hcd
[358075.142079] usb 1-1: New USB device found, idVendor=067b, idProduct=2303
[358075.142084] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[358075.142087] usb 1-1: Product: USB-Serial Controller
[358075.142090] usb 1-1: Manufacturer: Prolific Technology Inc.
[358076.272437] usbcore: registered new interface driver pl2303
[358076.272462] usbserial: USB Serial support registered for pl2303
[358076.272493] pl2303 1-1:1.0: pl2303 converter detected
[358076.285232] usb 1-1: pl2303 converter now attached to ttyUSB0
$ lsusb
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
$ screen /dev/ttyUSB0 115200
Raspbian GNU/Linux 8 raspi-zero ttyAMA0
raspi-zero login: pi
Password:
Last login: Wed Jul 6 19:56:06 JST 2016 from 192.168.2.102 on pts/0
Linux raspi-zero 4.4.11+ #888 Mon May 23 20:02:58 BST 2016 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
接続成功
2016年7月4日月曜日
Raspberry Pi Zero So-net 0SIM L-02A mjpeg-streamer
So-net 0SIMでwebcamseverを構築した記録
目的:我が家のインターネット環境では停電時等一時的な回線断時に外部からアクセスできない状態が発生するかもしれない。旅行等で不在にしているときにこれが起こったら、とっても不安。しかし、そんな時でもアクセスできるよう、通常回線とは独立した、携帯電話回線を使った環境も極力安価に構築してみる。
2016-7-2とりあえずの raspi_zero_L-02A_C270webcamサーバ 完成状態
【部品一覧】
raspi zero (pimoroniからpaypal支払 送料込み8.83GBP(1300円ほど))
L-02A USB接続型データ通信端末 (yahoo auctionで入手 送料込み600円ほど)
So-net 0SIM (3240円)
usb-hub 4in1 MicroUSB OTGハブアダプター (amazonで送料込み880円)
電源 5V 2A (短時間の停電にも耐えられるモバイル電源に変更予定)
microSDcard 4GB
usb wifiドングル
logitec C270 (yahoo auctionで入手 送料込み800円ほど)
HDMI-miniHDMI変換アダプタ (近くの100円ショップ)
usb-keyboard
【手順】
・2016-05-27-raspbian-jessie-lite.zipを展開し、4GB microSDカードにインストール
・HDMIケーブルでraspiとテレビを接続
・キーボード、有線lanアダプタ、HDMIテレビを外す
・wifi経由でssh接続
・L-02Aを接続
設定する
(参考 http://thr3a.hatenablog.com/entry/20150125/1422162859)
cdc_acmドライバを読み込まれないようにする
#echo blacklist cdc_acm >/etc/modprobe.d/cdc_acm-blacklist.conf
/etc/udev/rules.d/99-foma_l-02a.rules を設定
# for FOMA L-02A
# USB Storage (Zero Installation)
KERNEL=="sr[0-9]*", ENV{ID_VENDOR_ID}=="1004", ENV{ID_MODEL_ID}=="610c", RUN+="/usr/bin/eject /dev/$kernel"
# USB Modem (ttyUSB)
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", ATTR{idProduct}=="6109", RUN+="/sbin/modprobe usbserial vendor=0x$attr{idVendor} product=0x$attr{idProduct}"</del>
So-net 0SIMを挿入したL-02Aを接続し/dev/ttyUSB0確認
/etc/wvdial.confを設定
[Dialer Defaults]
Init1 = ATZ
Init2 = AT+CGDCONT=1,"IP","so-net.jp"
Dial Attempts = 3
Modem Type = Analog Modem
Dial Command = ATD
Stupid Mode = yes
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
APN = so-net.jp
Phone = *99***1#
Username = nuro
Password = nuro
Carrier Check = no
Auto DNS = 1
Check Def Route = 1
$sudo wvdial LED緑➔青で接続成功
グローバルIPみたいなaddressが振られる。だが、これは ISP Shared Address 100.64.0.0/10 で、ISP内のプライベートIP。これに外部からアクセスすることはできない。
・C270 接続(ピントずれを改造修正)
・mjpeg-streamer設定
(参考
http://www.hiramine.com/physicalcomputing/raspberrypi/webcamstreaming.html)
#apt-get install subversion libjpeg-dev imagemagick
#svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer mjpg-streamer
$cd mjpg-streamer
$make
・cron設定
@reboot /home/pi/mjpg-streamer/mjpg_streamer -b -i "/home/pi/mjpg-streamer/input_uvc.so -f 1 -r 640x480 -d /dev/video0 -y -n " -o "/home/pi/mjpg-streamer/output_http.so -w /home/pi/mjpg-streamer/www -p 80"
この設定でアクセスすると、mjpeg-streamerがクラッシュ。
-r 320x240 で安定。電源の問題?
-y オプションが何故か必要。しかも、画質が悪い。
piユーザでも起動時wvdialを実行するよう設定
・ngrok設定 ngrok.com
(参考 http://tech.misoca.jp/entry/2015/09/04/151451)
(参考 http://qiita.com/masato/items/26efb28c3133d83fbae7)
$wget https://dl.ngrok.com/ngrok_2.0.19_linux_arm.zip
これを/home/piに展開し、
$ ./ngrok http 80
(接続画面上でバージョンアップもできるが、ver2.1にすると接続不能となるので、このままが良い)
これも起動時実行するようcron設定
ngrok ページにサインアップしダッシュボードに表示されるtokenで
$ ngrok authtoken ******************************
すると、https://dashboard.ngrok.com/status にURL表示可となる。
なお、2016-7現在 無料ユーザーはsubdomain指定不可だが、ngrok statusページの自身のURLをクリックすると raspi_zero_L-02A_C270webcam サーバに飛ぶ。なので、有料ユーザー(年$60)になってdomainを取得する必要はあまりない。
・4GB-SDcardの使用状況
pi@raspi-zero:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 3856164 1151204 2518640 32% /
devtmpfs 218268 0 218268 0% /dev
tmpfs 222556 0 222556 0% /dev/shm
tmpfs 222556 4532 218024 3% /run
tmpfs 5120 8 5112 1% /run/lock
tmpfs 222556 0 222556 0% /sys/fs/cgroup
/dev/mmcblk0p1 64456 20968 43488 33% /boot
・USBシリアル接続
目的:我が家のインターネット環境では停電時等一時的な回線断時に外部からアクセスできない状態が発生するかもしれない。旅行等で不在にしているときにこれが起こったら、とっても不安。しかし、そんな時でもアクセスできるよう、通常回線とは独立した、携帯電話回線を使った環境も極力安価に構築してみる。
2016-7-2とりあえずの raspi_zero_L-02A_C270webcamサーバ 完成状態
raspi zero (pimoroniからpaypal支払 送料込み8.83GBP(1300円ほど))
L-02A USB接続型データ通信端末 (yahoo auctionで入手 送料込み600円ほど)
So-net 0SIM (3240円)
usb-hub 4in1 MicroUSB OTGハブアダプター (amazonで送料込み880円)
電源 5V 2A (短時間の停電にも耐えられるモバイル電源に変更予定)
microSDcard 4GB
usb wifiドングル
logitec C270 (yahoo auctionで入手 送料込み800円ほど)
HDMI-miniHDMI変換アダプタ (近くの100円ショップ)
usb-keyboard
【手順】
・2016-05-27-raspbian-jessie-lite.zipを展開し、4GB microSDカードにインストール
・HDMIケーブルでraspiとテレビを接続
・usbハブを接続し、以下を端子に接続
usb-有線lanアダプタ
usb-キーボード
usb-wifiドングル
usb-電源
・wifiを有効化・キーボード、有線lanアダプタ、HDMIテレビを外す
・wifi経由でssh接続
・L-02Aを接続
設定する
(参考 http://thr3a.hatenablog.com/entry/20150125/1422162859)
cdc_acmドライバを読み込まれないようにする
#echo blacklist cdc_acm >/etc/modprobe.d/cdc_acm-blacklist.conf
/etc/udev/rules.d/99-foma_l-02a.rules を設定
# for FOMA L-02A
# USB Storage (Zero Installation)
KERNEL=="sr[0-9]*", ENV{ID_VENDOR_ID}=="1004", ENV{ID_MODEL_ID}=="610c", RUN+="/usr/bin/eject /dev/$kernel"
# USB Modem (ttyUSB)
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", ATTR{idProduct}=="6109", RUN+="/sbin/modprobe usbserial vendor=0x$attr{idVendor} product=0x$attr{idProduct}"</del>
So-net 0SIMを挿入したL-02Aを接続し/dev/ttyUSB0確認
/etc/wvdial.confを設定
[Dialer Defaults]
Init1 = ATZ
Init2 = AT+CGDCONT=1,"IP","so-net.jp"
Dial Attempts = 3
Modem Type = Analog Modem
Dial Command = ATD
Stupid Mode = yes
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
APN = so-net.jp
Phone = *99***1#
Username = nuro
Password = nuro
Carrier Check = no
Auto DNS = 1
Check Def Route = 1
$sudo wvdial LED緑➔青で接続成功
グローバルIPみたいなaddressが振られる。だが、これは ISP Shared Address 100.64.0.0/10 で、ISP内のプライベートIP。これに外部からアクセスすることはできない。
・C270 接続(ピントずれを改造修正)
・mjpeg-streamer設定
(参考
http://www.hiramine.com/physicalcomputing/raspberrypi/webcamstreaming.html)
#apt-get install subversion libjpeg-dev imagemagick
#svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer mjpg-streamer
$cd mjpg-streamer
$make
・cron設定
@reboot /home/pi/mjpg-streamer/mjpg_streamer -b -i "/home/pi/mjpg-streamer/input_uvc.so -f 1 -r 640x480 -d /dev/video0 -y -n " -o "/home/pi/mjpg-streamer/output_http.so -w /home/pi/mjpg-streamer/www -p 80"
この設定でアクセスすると、mjpeg-streamerがクラッシュ。
-r 320x240 で安定。電源の問題?
-y オプションが何故か必要。しかも、画質が悪い。
piユーザでも起動時wvdialを実行するよう設定
・ngrok設定 ngrok.com
(参考 http://tech.misoca.jp/entry/2015/09/04/151451)
(参考 http://qiita.com/masato/items/26efb28c3133d83fbae7)
$wget https://dl.ngrok.com/ngrok_2.0.19_linux_arm.zip
これを/home/piに展開し、
$ ./ngrok http 80
(接続画面上でバージョンアップもできるが、ver2.1にすると接続不能となるので、このままが良い)
これも起動時実行するようcron設定
ngrok ページにサインアップしダッシュボードに表示されるtokenで
$ ngrok authtoken ******************************
すると、https://dashboard.ngrok.com/status にURL表示可となる。
なお、2016-7現在 無料ユーザーはsubdomain指定不可だが、ngrok statusページの自身のURLをクリックすると raspi_zero_L-02A_C270webcam サーバに飛ぶ。なので、有料ユーザー(年$60)になってdomainを取得する必要はあまりない。
・4GB-SDcardの使用状況
pi@raspi-zero:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 3856164 1151204 2518640 32% /
devtmpfs 218268 0 218268 0% /dev
tmpfs 222556 0 222556 0% /dev/shm
tmpfs 222556 4532 218024 3% /run
tmpfs 5120 8 5112 1% /run/lock
tmpfs 222556 0 222556 0% /sys/fs/cgroup
/dev/mmcblk0p1 64456 20968 43488 33% /boot
2016年6月15日水曜日
Raspberry Pi Zero 購入 PayPal
Raspberry Pi Zero 購入
1x Raspberry Pi Zero - Max 1 Pi Zero Per Customer! - Pi Zero only for £3.33 each
Subtotal : £3.33 GBP
Shipping : £5.50 GBP
Total : £8.83 GBP
支払いは PayPal
----------------------------------------------------------------------------------------------------------------------------------
| マーチャント Pimoroni Ltd sales@pimoroni.com | マーチャントへの指示 指示が入力されていません。 |
| 配送先住所 - 確認済み 日本 | 発送の詳細 売り手は、発送の詳細を提供していません。 |
| 説明 | 単価 | 数量 | 金額 |
| £8.83 GBP | 1 | £8.83 GBP |
| |||||||||||||||
請求書 ID: # | |||||||||||||||
2015年12月26日土曜日
Rspberry Pi B+ DLNAサーバ minidlna
ネットワークプレーヤを導入したので、LAN内にDLNAサーバを構築
【インストール】
# apt-get install minidlna
【設定】
# echo "fs.inotify.max_user_watches = 81920" > /etc/sysctl.d/minidlna.conf
# sysctl -p /etc/sysctl.d/minidlna.conf
【外付けHDDをマウント】
# mount -t vfat -o codepage=932,iocharset=utf8,uid=500,gid=500,umask=000 /dev/sdb1 /media/sdb1
【格納場所へのリンク】
# ln -s /media/sdb1/disk/Music /var/lib/minidlna
【アルバムアート用のファイル名】
/etc/minidlna.confによると、、、
# List of file names to look for when searching for album art. Names should be
# delimited with a forward slash ("/").
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
なので、表示させたい画像ファイルを一番簡単な cover.jpg としてコピー
root@raspberrypi:/var/lib/minidlna/Music# find ./*/ -name "*Folder.jpg" -print0 | while read -r -d '' file; do cp "$file" "${file%%Folder.jpg}cover.jpg"; done
ファイル名が”AlbumArt_{??-??-??}_Large.jpg”とかだったら、どうすればいいだろうか?
root@raspberrypi:/var/lib/minidlna/Music# find ./*/ -name "*Large.jpg" -print0 | while read -r -d '' file; do cp "$file" "${file%/*}/cover.jpg"; done
【データベースへの反映】
# minidlna -R
または
# service minidlna force-reload
削除できない古いファイルがある場合
# chmod -R 777 /var/lib/minidlna/
ついでに
/ が100%の場合、log関係 apt関係他を削除
# rm /var/log/minidlna.log
# apt-get clean
【MiniDLNA status】
http://192.168.??.?:8200
【障害】
/var/log/minidlnaに異常
[2015/12/26 14:21:32] tagutils/tagutils-wav.c:173: warn: Ignoring long tag [� ] in /var/lib/minidlna/Music/Shanti/SHANTI'S LULLABY(24bit/96kHz)/01_Fields Of Gold(24bit 96kHz).wav
、でデータベース構築がストップ。文字もおかしい。これ以降のファイルを読み込まなくなった。サーバとしては機能するが、これ以降のファイルが読み込み・再生されない。
wavハイレゾには対応していないのか?tagの扱いがおかしいのか?
【対策】
wav -> flac 変換する。
linuxmint の soundconverter で変換したが、16bitとなったのでダメ。
windows の xrecordII で変換すると、ちゃんと 96kHz,24bit となったので、これに入れ替えて、
# service minidlna force-reload
MiniDLNA statusも正常に表示され、再生もOKとなった。
今回、ハイレゾ楽曲は e-onkyo music から wav でダウンロードしたが、今後は flac がよさげ。
【インストール】
# apt-get install minidlna
【設定】
# echo "fs.inotify.max_user_watches = 81920" > /etc/sysctl.d/minidlna.conf
# sysctl -p /etc/sysctl.d/minidlna.conf
【外付けHDDをマウント】
# mount -t vfat -o codepage=932,iocharset=utf8,uid=500,gid=500,umask=000 /dev/sdb1 /media/sdb1
【格納場所へのリンク】
# ln -s /media/sdb1/disk/Music /var/lib/minidlna
【アルバムアート用のファイル名】
/etc/minidlna.confによると、、、
# List of file names to look for when searching for album art. Names should be
# delimited with a forward slash ("/").
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
なので、表示させたい画像ファイルを一番簡単な cover.jpg としてコピー
root@raspberrypi:/var/lib/minidlna/Music# find ./*/ -name "*Folder.jpg" -print0 | while read -r -d '' file; do cp "$file" "${file%%Folder.jpg}cover.jpg"; done
ファイル名が”AlbumArt_{??-??-??}_Large.jpg”とかだったら、どうすればいいだろうか?
root@raspberrypi:/var/lib/minidlna/Music# find ./*/ -name "*Large.jpg" -print0 | while read -r -d '' file; do cp "$file" "${file%/*}/cover.jpg"; done
かな?
【データベースへの反映】
# minidlna -R
または
# service minidlna force-reload
削除できない古いファイルがある場合
# chmod -R 777 /var/lib/minidlna/
ついでに
/ が100%の場合、log関係 apt関係他を削除
# rm /var/log/minidlna.log
# apt-get clean
【MiniDLNA status】
http://192.168.??.?:8200
【障害】
/var/log/minidlnaに異常
[2015/12/26 14:21:32] tagutils/tagutils-wav.c:173: warn: Ignoring long tag [� ] in /var/lib/minidlna/Music/Shanti/SHANTI'S LULLABY(24bit/96kHz)/01_Fields Of Gold(24bit 96kHz).wav
、でデータベース構築がストップ。文字もおかしい。これ以降のファイルを読み込まなくなった。サーバとしては機能するが、これ以降のファイルが読み込み・再生されない。
wavハイレゾには対応していないのか?tagの扱いがおかしいのか?
【対策】
wav -> flac 変換する。
linuxmint の soundconverter で変換したが、16bitとなったのでダメ。
windows の xrecordII で変換すると、ちゃんと 96kHz,24bit となったので、これに入れ替えて、
# service minidlna force-reload
MiniDLNA statusも正常に表示され、再生もOKとなった。
今回、ハイレゾ楽曲は e-onkyo music から wav でダウンロードしたが、今後は flac がよさげ。
2015年7月1日水曜日
inserting leap second うるう秒 23:59:60 が挿入された記念
2台あるraspiサーバ両方ともに、うるう秒 23:59:60が挿入されていたので、記念に。
サーバ1 [1448545.917280] Clock: inserting leap second 23:59:60 UTC
サーバ2 [564717.476130] Clock: inserting leap second 23:59:60 UTC
サーバ1 [1448545.917280] Clock: inserting leap second 23:59:60 UTC
サーバ2 [564717.476130] Clock: inserting leap second 23:59:60 UTC
特に異常は発生していない。
2015年6月14日日曜日
BSW13K08HSV → C270 入れ替え ddでバックアップ
オークションでC270を入手(¥1000くらい)したので、
ボロのBSW13K08HSVをC270に入れ替え
ボロのBSW13K08HSVをC270に入れ替え

BSW13K08HSV

C270
やはりC270の画質は、極めてクリアで上質。この価格帯では最高品質。
BSW13K08HSVとは比べ物にならない。
BSW13K08HSVとは比べ物にならない。
raspiの設定を少変更したので、microSDカードをまるごとバックアップ。
dd if=/dev/sdb of=/mnt/20150614.img bs=4M
登録:
投稿 (Atom)








