2
2

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.

SparkFun Pi Servo Hatを使うためのセットアップ

Last updated at Posted at 2018-10-08

用意するもの

セットアップをする環境はMacを想定します。参考

ピンソケットを半田付け

https://learn.sparkfun.com/tutorials/pi-servo-hat-hookup-guide を参考に半田付け。特に難しいところは無いです。

Raspbian のセットアップ

  1. Raspbian のダウンロード。今回は、DESKTOPをダウンロードする
    https://www.raspberrypi.org/downloads/raspbian/

  2. 20YY-MM-DD-raspbian-stretch.zip の解凍。20YY-MM-DD-raspbian-stretch.img が解凍される。

  3. sdカードをマイクロSDライターに挿入し、Macに挿入

  4. diskutil list でsdカードの場所を調べる。/dev/disk2になっていることが多いと思います。 参考

  5. sudo diskutil unmountDisk /dev/disk2 で unmount

  6. sudo dd bs=1m if=path_of_your_image.img of=/dev/rdisk2 conv=sync(かなり時間がかかります)

  7. 次に、WiFIを設定するため、/Volumes/boot/wpa_supplicant.conf のファイルを新規作成(参考

country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
  ssid="test"
  psk="abcd1234"
}
  1. SSHを有効にするため、/Volumes/boot/ssh という空ファイルを作成
  2. 電源を投入
  3. dns-sd -G v4 raspberrypi でIPアドレスを調べる
  4. ssh pi@(調べたIP)

I2C を有効化

SSHにログインした状態で、以下の通り設定します。([参考](raspbian gnu screen))

  1. sudo apt-get update
  2. sudo apt-get install i2c-tools
  3. sudo raspi-config
  4. "5 Interfacing Options"->"A7 I2C" を選択してEnter
  5. "Finish"を選択してEnter
  6. Raspbian を再起動

サンプルの実行

  1. 以下のように接続。
    • sg90の茶色のケーブルが、外側になるように接続
    • micro usb ケーブルは、SparkFun Pi Servo Hat の方に接続
      Image from Gyazo
  2. git clone https://github.com/sparkfun/Pi_Servo_Hat.git
  3. cd Pi_Servo_Hat/Examples
  4. python example.py
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?