ドアスコープモニターを作る (2) 不安定編

2018年6月10日 / 未分類

これまでのあらすじ

カメラ壊した。

本題

新しいカメラ買ってきて電源線引き回してドアに設置したのがこちら。

Raspberry Pi Zero WHは裏にスペーサー挟んでアルミプレートを付け、プレートにマグネット貼り付けてドアに設置。
カメラはひっつき虫でドアスコープのところに固定。

右にあるのは秋月のDCDCコンバータ。こちらもマグネットで付けている。
必要な電源線の長さを計ったら6m超えていて、USBケーブルでは5m超のものはないのと、電圧降下が怖かったので12VのACアダプターから引っ張ってきて直前で5Vにすることにした。

通信はRaspberry Pi Zero WHについている無線LANインタフェースを使用。
この状態で撮影して転送したり、mjpg-streamer使ってストリーミングさせたりとやっていると、通信が不安定であることに気づいた。
そこで、iperfで計ってみた。

tkito@raspi-camera:~ $ iperf -c 192.168.100.101 -t 100 -i 2
------------------------------------------------------------
Client connecting to 192.168.100.101, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.100.102 port 39072 connected with 192.168.100.101 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 512 KBytes 2.10 Mbits/sec
[ 3] 2.0- 4.0 sec 1.12 MBytes 4.72 Mbits/sec
[ 3] 4.0- 6.0 sec 512 KBytes 2.10 Mbits/sec
[ 3] 6.0- 8.0 sec 1.62 MBytes 6.82 Mbits/sec
[ 3] 8.0-10.0 sec 430 KBytes 1.76 Mbits/sec
[ 3] 10.0-12.0 sec 5.66 KBytes 23.2 Kbits/sec
[ 3] 12.0-14.0 sec 4.24 KBytes 17.4 Kbits/sec
[ 3] 14.0-16.0 sec 1.41 KBytes 5.79 Kbits/sec
[ 3] 16.0-18.0 sec 1.41 KBytes 5.79 Kbits/sec
[ 3] 18.0-20.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 20.0-22.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 22.0-24.0 sec 1.41 KBytes 5.79 Kbits/sec
[ 3] 24.0-26.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 26.0-28.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 28.0-30.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 30.0-32.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 32.0-34.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 34.0-36.0 sec 2.83 KBytes 11.6 Kbits/sec
[ 3] 36.0-38.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 38.0-40.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 40.0-42.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 42.0-44.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 44.0-46.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 46.0-48.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 48.0-50.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 50.0-52.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 52.0-54.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 54.0-56.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 56.0-58.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 58.0-60.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 60.0-62.0 sec 1.41 KBytes 5.79 Kbits/sec
[ 3] 62.0-64.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 64.0-66.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 66.0-68.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 68.0-70.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 70.0-72.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 72.0-74.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 74.0-76.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 76.0-78.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 78.0-80.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 80.0-82.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 82.0-84.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 84.0-86.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 86.0-88.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 88.0-90.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 90.0-92.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 92.0-94.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 94.0-96.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 96.0-98.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 98.0-100.0 sec 0.00 Bytes 0.00 bits/sec
[ 3] 0.0-100.6 sec 4.19 MBytes 349 Kbits/sec

(敢えて酷いのを選んではいるけれど)これはひどい。
ちなみにサーバ側は別のRaspberry Pi。

いろいろと試行錯誤してみたところ、ドアから15cmほど離したところでやると25Mbpsくらいの安定した測定結果を得られた。
ドアのごく近くに置いてある、というのが悪いのだろう。
適当な箱でも買ってきてドアから離した形で据え付けることにしよう。

続きはいつになることやら…

余談

ドアに密着している状態でもiperfのサーバ側になった場合は十分な速度が出ることを確認した。

tkito@raspi-fancon:~ $ iperf -c 192.168.100.102 -t 100 -i 2
------------------------------------------------------------
Client connecting to 192.168.100.102, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.100.101 port 57936 connected with 192.168.100.102 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 2.88 MBytes 12.1 Mbits/sec
[ 3] 2.0- 4.0 sec 6.12 MBytes 25.7 Mbits/sec
[ 3] 4.0- 6.0 sec 3.62 MBytes 15.2 Mbits/sec
[ 3] 6.0- 8.0 sec 4.38 MBytes 18.4 Mbits/sec
[ 3] 8.0-10.0 sec 3.12 MBytes 13.1 Mbits/sec
[ 3] 10.0-12.0 sec 3.88 MBytes 16.3 Mbits/sec
[ 3] 12.0-14.0 sec 3.38 MBytes 14.2 Mbits/sec
[ 3] 14.0-16.0 sec 5.38 MBytes 22.5 Mbits/sec
[ 3] 16.0-18.0 sec 6.00 MBytes 25.2 Mbits/sec
[ 3] 18.0-20.0 sec 6.00 MBytes 25.2 Mbits/sec
[ 3] 20.0-22.0 sec 4.88 MBytes 20.4 Mbits/sec
[ 3] 22.0-24.0 sec 6.12 MBytes 25.7 Mbits/sec
[ 3] 24.0-26.0 sec 5.62 MBytes 23.6 Mbits/sec
[ 3] 26.0-28.0 sec 7.88 MBytes 33.0 Mbits/sec
[ 3] 28.0-30.0 sec 6.50 MBytes 27.3 Mbits/sec
[ 3] 30.0-32.0 sec 8.12 MBytes 34.1 Mbits/sec
[ 3] 32.0-34.0 sec 8.12 MBytes 34.1 Mbits/sec
[ 3] 34.0-36.0 sec 7.50 MBytes 31.5 Mbits/sec
[ 3] 36.0-38.0 sec 6.25 MBytes 26.2 Mbits/sec
[ 3] 38.0-40.0 sec 6.12 MBytes 25.7 Mbits/sec
[ 3] 40.0-42.0 sec 3.38 MBytes 14.2 Mbits/sec
[ 3] 42.0-44.0 sec 6.88 MBytes 28.8 Mbits/sec
[ 3] 44.0-46.0 sec 7.00 MBytes 29.4 Mbits/sec
[ 3] 46.0-48.0 sec 7.00 MBytes 29.4 Mbits/sec
[ 3] 48.0-50.0 sec 7.62 MBytes 32.0 Mbits/sec
[ 3] 50.0-52.0 sec 7.50 MBytes 31.5 Mbits/sec
[ 3] 52.0-54.0 sec 7.75 MBytes 32.5 Mbits/sec
[ 3] 54.0-56.0 sec 7.50 MBytes 31.5 Mbits/sec
[ 3] 56.0-58.0 sec 9.88 MBytes 41.4 Mbits/sec
[ 3] 58.0-60.0 sec 9.50 MBytes 39.8 Mbits/sec
[ 3] 60.0-62.0 sec 8.88 MBytes 37.2 Mbits/sec
[ 3] 62.0-64.0 sec 9.88 MBytes 41.4 Mbits/sec
[ 3] 64.0-66.0 sec 10.2 MBytes 43.0 Mbits/sec
[ 3] 66.0-68.0 sec 10.4 MBytes 43.5 Mbits/sec
[ 3] 68.0-70.0 sec 10.2 MBytes 43.0 Mbits/sec
[ 3] 70.0-72.0 sec 10.4 MBytes 43.5 Mbits/sec
[ 3] 72.0-74.0 sec 10.2 MBytes 43.0 Mbits/sec
[ 3] 74.0-76.0 sec 10.5 MBytes 44.0 Mbits/sec
[ 3] 76.0-78.0 sec 6.62 MBytes 27.8 Mbits/sec
[ 3] 78.0-80.0 sec 4.00 MBytes 16.8 Mbits/sec
[ 3] 80.0-82.0 sec 6.88 MBytes 28.8 Mbits/sec
[ 3] 82.0-84.0 sec 4.88 MBytes 20.4 Mbits/sec
[ 3] 84.0-86.0 sec 5.25 MBytes 22.0 Mbits/sec
[ 3] 86.0-88.0 sec 6.75 MBytes 28.3 Mbits/sec
[ 3] 88.0-90.0 sec 7.38 MBytes 30.9 Mbits/sec
[ 3] 90.0-92.0 sec 7.50 MBytes 31.5 Mbits/sec
[ 3] 92.0-94.0 sec 7.00 MBytes 29.4 Mbits/sec
[ 3] 94.0-96.0 sec 7.00 MBytes 29.4 Mbits/sec
[ 3] 96.0-98.0 sec 7.00 MBytes 29.4 Mbits/sec
[ 3] 98.0-100.0 sec 7.38 MBytes 30.9 Mbits/sec
[ 3] 0.0-100.0 sec 344 MBytes 28.9 Mbits/sec

送受信するパケットを考えると、受信はできるがパケット長の長いパケットの送信に難がありそうなことが推測できる。
実際、クライアント側として動かしたときも、「0.00 bits/sec」の情報自体はちゃんと定期的に送信されてきていた。こちらも無線LAN経由であることに変わりはないのに。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.

TOPへ戻る