5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google AIY Voice Kitと赤外線リモコンを組み合わせる

Last updated at Posted at 2018-02-24

Alexa(まだやってない)

既存のOSにドライバーをインストールすればOKそう
https://dev.classmethod.jp/cloud/alexa-avs-using-google-aiy-voice-kit/

Google Persistent API

Demo(英語)

僕はその前にOSを初期化してしまい、VoiceKit用のImageを焼いてしまったので下記をまんまやった
https://qiita.com/tsato12345/items/07805faf74f5b01233bf

日本語受付

下記を参考に(GoogleAssistantSDKはImageの中にインストール済み)
https://yuki-no-yabo.com/google-aiy-voice-kit-in-japanease/

Oauth2.0の鍵情報が入ったclient~.jsonは/home/piに配置(ここではファイル名をmvしない)

認証

google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless --client-secrets /home/pi/client~.json

登録

googlesamples-assistant-devicetool register-model --manufacturer [自由入力] --product-name [自由入力] --type SWITCH --model sai-no-raspberrypi-smart-speaker-01

起動

googlesamples-assistant-pushtotalk --project-id [client~.jsonの中に記載] --device-model-id sai-no-raspberrypi-smart-speaker-01 --lang ja_jp

赤外線リモコン(検証中)

テレビのリモコンの赤外線を分析

回線のつなぎ方は下記を参考
https://qiita.com/KAKY/items/55e6c54fa2073cdc0bbe

$ sudo apt-get install lirc
$ sudo modprobe lirc-rpi gpio_in_pin=24 gpio_out_pin=25
modprobe: ERROR: could not insert 'lirc_rpi': No such device
$ vi /boot/config.txt:コメントアウトを外すor追記する
dtoverlay = lirc-rpi
$ sudo shutdown -r now
$ sudo modprobe lirc-rpi gpio_in_pin=24 gpio_out_pin=25
$ ls  -l /dev/lirc*
crw-rw---- 1 root video 244, 0 Feb 24 13:32 /dev/lirc0
$ sudo mount -t debugfs debugfs /sys/kernel/debug
mount: debugfs is already mounted or /sys/kernel/debug busy
       debugfs is already mounted on /sys/kernel/debug
$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-53, parent: platform/3f200000.gpio, pinctrl-bcm2835:

gpiochip2: GPIOs 100-101, brcmvirt-gpio, can sleep:
 gpio-100 (                    |?                   ) out lo

gpiochip1: GPIOs 128-135, brcmexp-gpio, can sleep:
 gpio-135 (                    |?                   ) in  hi
$ mode2 -d /dev/lirc0
Using driver devinput on device /dev/lirc0
Trying device: /dev/lirc0
Using device: /dev/lirc0

っとここでテレビのリモコンのボタンを押しても何も反応がない。gpioが上手く認識できてないので調べる
配線の番号も念のためチェックしてみたが問題なし
https://tool-lab.com/make/raspberrypi-startup-22/
この人のブログで解決
http://make.bcde.jp/blog/2017/11/19/lircで-etc-lirc-hardware-confファイルが存在しない/

$ sudo vi /etc/lirc/lirc_options.conf
driver = default
device = /dev/lirc0
$ sudo vi /boot/config.txt
dtoverlay=lirc-rpi
dtparam=gpio_in_pin=24
dtparam=gpio_out_pin=25
$ sudo reboot -h now
$ sudo /etc/init.d/lircd stop
$ sudo mode2 -d /dev/lirc0

この状態でリモコンボタンを押すと反応があった

$ sudo mode2 -d /dev/lirc0 | tee TVON
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?