プロフィール

 twitter:taisei117
 scrapbox:大成道

2019/04/10

190410:シャカイゼン

自分の本当にやりたいことは、社会の改善であるということに最近になって気づいた

社会:シャカイ
 +
改善:カイゼン

シャカイゼン

という言葉を思いついた

シャカイゼンというワード、Google検索で0件のヒットだった。


SYAKAIZENでは175,500件ヒットあり



新しい言葉ができたように感じた。
新しいものを作って、自分でポジションを取りに行く感覚がある。

思いついたものは早めに抑えておくと良いかも。

登録商標、特許なども早いもの勝ち。

今の時代はウェブでタイムスタンプが残るので、起源の主張がしやすい。






200315_追記
しばらくたつと、Googleのインデックスが更新されて、

シャカイゼンで検索したら出てくるようになった。

ブログのタイトルもシャカイゼンに変更しました。























2019/04/02

190310:オムロン環境センサ2JCIE-BUサンプルプログラム動作まで



https://gyazo.com/f1ccde2c938b8624269b38fc8a09b843

オムロン環境センサ2JCIE-BU01
2JCIE-BU 環境センサ(USB型)/種類/価格 | オムロン制御機器:https://www.fa.omron.co.jp/products/family/3724/lineup.html

こちらのセンサのサンプルプログラムをRaspi3B+で実行するまでの段取りメモ

サンプルプログラム:https://github.com/omron-devhub/2jciebu-usb-raspberrypi/blob/master/README_ja.md


準備
 インストール方法
  事前に依存関係のあるソフトウェアをインストールして下さい。
  依存関係
  python3
  raspi3B+ には標準でインストールされている、はず
  pythonバージョン3.5.3であることを確認
  pyserial
  ターミナルからpip install pyserialを入力するとエラーが出てインストールされない

こちらを参考にpyserialの設定を行う

Raspberry PiとArduino間でUSB経由のシリアル通信 - karaage. [からあげ]:https://karaage.hatenadiary.jp/entry/2015/06/10/080000

pyserialインストール
   pythonでシリアル通信するために、pyserialというライブラリをインストールします。
   pyserialをインストールするには、pipというやつが必要なので、まずはそれをインストール。ややこしいですね。Raspberry Piにログインして、以下のコマンドうつだけです。

      $ sudo apt-get install python-pip
       成功。すでにインストールされているっぽい。
       pip使ってpyserialインストール。以下のコマンドうつだけ
      $ pip install pyserial
      失敗、エラーが出る
        pi@raspberrypi:~ $ pip install pyserial
        Collecting pyserial
        Exception:
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
            status = self.run(options, args)
          File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
            wb.build(autobuilding=True)
          File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
            self.requirement_set.prepare_files(self.finder)
          File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
            ignore_dependencies=self.ignore_dependencies))
          File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
            require_hashes
          File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 278, in populate_link
            self.link = finder.find_requirement(self, upgrade)
          File "/usr/lib/python2.7/dist-packages/pip/index.py", line 465, in find_requirement
            all_candidates = self.find_all_candidates(req.name)
          File "/usr/lib/python2.7/dist-packages/pip/index.py", line 423, in find_all_candidates
            for page in self._get_pages(url_locations, project_name):
          File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_pages
            page = self._get_page(location)
          File "/usr/lib/python2.7/dist-packages/pip/index.py", line 683, in _get_page
            return HTMLPage.get_page(link, session=self.session)
          File "/usr/lib/python2.7/dist-packages/pip/index.py", line 792, in get_page
            "Cache-Control": "max-age=600",
          File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
            return self.request('GET', url, **kwargs)
          File "/usr/lib/python2.7/dist-packages/pip/download.py", line 386, in request
            return super(PipSession, self).request(method, url, *args, **kwargs)
          File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
            resp = self.send(prep, **send_kwargs)
          File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
            r = adapter.send(request, **kwargs)
          File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
            resp = super(CacheControlAdapter, self).send(request, **kw)
          File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
            timeout=timeout
          File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
            _stacktrace=sys.exc_info()[2])
          File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
            total -= 1
        TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
エラー対応
何度か同じ操作を繰り返したら正常にインストールできた
ネットワーク関連のトラブルらしい。


Raspberry Pi3のPythonでGPSを扱う - Qiita: https://qiita.com/AmbientData/items/fff54c8ac8ec95aeeee6
  raspi-configでシリアルの有効化
      次のようにraspi-configを起動し、シリアルを有効にします。
     pi$ sudo raspi-config
      「5 Interfacing Options」を選択し、さらに「 P6 Serial 」を選択します。「Would you like a login shell to be accessible over serial?」に対してYesを選択、Finishし、リブートします。
      pi$ sudo reboot
     /dev/serial0というデバイスが作られます。
     pi$ ls /dev/se*
     /dev/serial0  /dev/serial1
  ターミナルを開き、次のコマンドを実行します。
  $ mkdir omron_sensor
  $ git clone https://github.com/omron-devhub/2jciebu-usb-raspberrypi.git
   pi@raspberrypi:~ $ sudo chmod 777 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
   chmod: '/sys/bus/usb-serial/drivers/ftdi_sio/new_id' にアクセスできません: そのようなファイルやディレクトリはありません


参考
弊社USBアダプタをLinuxで使うには(2019版) | 近藤科学:https://kondo-robot.com/faq/usb_adapter_for_linux_2019

  認識方法
    ①USBアダプタを挿す

    ②dmesgでデバイスの情報を取得する
    下記はDUAL USB Adapter HSを挿入したときに表示されるメッセージ例になります。
    usb 1-1.2: new full-speed USB device number 5 using dwc_otg
    usb 1-1.2: New USB device found, idVendor=165c, idProduct=0008
    usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    usb 1-1.2: Product: DUAL USB ADAPTER HS
    usb 1-1.2: Manufacturer: Kondo Kagaku
    usb 1-1.2: SerialNumber: KOUSBCNV
    USBアダプタが認識されると、
    /dev/ttyUSB*
    で認識されますが今回はメッセージが表示されていないので、認識はされていません。

    ③FTDIのカーネルと弊社USBアダプタを関連付ける
    まずは、modprobeを使用してFTDIのカーネルftdi-sioをロード(取り込み)します。
    $ modprobe ftdi-sio
    /sys/bus/usb-serial/drivers/ftdi_sio/new_idにベンダIDとプロダクトIDを書き込むことでFTDIのカーネルと関連付けるようになります。
    コマンドとしては、
    $ echo vvvv pppp > /sys/bus/usb-serial/drivers/ftdi_sio/new_id
     vvvv:ベンダID 今回は0590
   pppp:プロダクトID   今回は00d4
    書き込むにはroot権限(スーパーユーザー権限)で変更する必要があります。
    $ sudo su
    # modprobe ftdi-sio
    # echo 165C 0008 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
    # exit
    これを以下のように実行するとUSBの設定?ができた
     $ sudo su
     # modprobe ftdi-sio
     # echo 0590 00d4 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
     # exit


$ sudo chmod 777 /sys/bus/usb-serial/drivers/ftdi_sio/new_id
$ sudo modprobe ftdi_sio
$ sudo echo 0590 00d4 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id
$ sudo python3 sample_2jciebu.py
 →sudo python3 /home/pi/2jciebu-usb-raspberrypi/sample_2jciebu.py
 に変更したら動作した


参考リンク
 2jciebu-usb-raspberrypi/README_ja.md at master · omron-devhub/2jciebu-usb-raspberrypi · GitHub:https://github.com/omron-devhub/2jciebu-usb-raspberrypi/blob/master/README_ja.md
 Omron環境センサとRaspberry Pi 3を車載して車室環境を見たりする(2/2) - シュウジマブログ:https://www.shujima.work/entry/2018/10/10/022838
 オムロン環境センサーからBLE経由でデーターをクラウドに送る – Ambient:https://ambidata.io/samples/temphumid/ble-gw-omron/
 オムロン環境センサ と ラズパイ で ラジコンカー − GOBERNABLES de Pi − - HomeMadeGarbage:https://homemadegarbage.com/gobernables