1
0

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.

IoTっぽいシステムを作ってみる〜デバイス編〜

Last updated at Posted at 2019-12-04

Raspberry Piのセットアップ

まずはセットアップする。

OSのインストール

今回はMacでやる。(SDカードとカードリーダーを準備)

ディスクフォーマット

 SDカードをぶっ刺して以下コマンド

console(Mac)
$ diskutil list
/dev/disk0 (internal):
 ...
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk2
   1:             Windows_FAT_32 NO NAME                 31.9 GB    disk2s1
console(Mac)
$ diskutil unMountDisk /dev/disk2 ←SDカードのドライブ(間違うとMacオシャカになります。)
Unmount of all volumes on disk2 was successful
console(Mac)
$ diskutil eraseDisk MS-DOS RASP←(デバイス名なんでも良い) /dev/disk2
Started erase on disk2
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk2s2 as MS-DOS (FAT) with name RASP
512 bytes per physical sector
/dev/rdisk2s2: 61891008 sectors in 1934094 FAT32 clusters (16384 bytes/cluster)
bps=512 spc=32 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=411648 drv=0x80 bsec=61921280 bspf=15111 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished erase on disk2

OSダウンロード

 https://www.raspberrypi.org/downloads/raspbian/
スクリーンショット 2019-10-23 20.07.58.png
とりあえず”Raspbian Buster with desktop and recommended software”これ。

OSコピー

console(Mac)
$ diskutil unMountDisk /dev/disk2
$ sudo dd if=2019-09-26-raspbian-buster-full.img of=/dev/rdisk2 bs=1m

起動!!諸々設定!!

IMG_3435.JPG

IMG_3436.JPG

IMG_3437.JPG

IMG_3438.JPG

簡単。。。
ネットワーク設定は飛ばして。自分で設定。
ステルスONのSIDに繋ぎたいので手動で。

console(raspbian)
$ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

以下追加。

wpa_supplicant.conf
network={
        ssid="XXXXX"
        scan_ssid=1 ← これを設定するとステルスONのSIDに繋がる。
        psk=YYYYY
}

再起動。

console(raspbian)
$ sudo reboot

SSH

モニター繋いでなくても繋げるように。。SSHをON

console(raspbian)
$ sudo raspi-config

aaa.jpeg

5 Interfacing Options > P2 SSH > 選択 SSH Enable? Yes!!!
これでOK

console(raspbian)
$ sudo ifconfig

でIPアドレス調べて

console(Mac)
$ ssh pi@XXXXXXXXX
-略-
pi@raspberrypi:~ $ 

無事完了!

とりあえずGPIOでエルチカしようにも・・・全くエルチカしません。

console(raspbian)
$ sudo gpio readall
Oops - unable to determine board type... model: 17

なんかだめっぽい(調べるとアップグレードしないといけないっぽい。

とりあえずアップグレード

console(raspbian)
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
console(raspbian)
$ sudo apt-get update
$ sudo apt-get install -y python-dev
$ sudo apt-get install -y python-pip
console(raspbian)
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?