qshinoの日記

Powershell関係と徒然なこと

松山

松山市駅

道後温泉 南予鯛めし

倉敷 ナビの通り来るじゃろ ワイモバイル入るきゃ良かった 私のは不能じゃの あるけん これって、広島弁? 来るが〜 あれの通りしときゃ良いってこと? 大正亭、祭り寿司は暖簾が出てなかった 自分のローマ字ぐらいわかるジャケ、

ママカリ浜吉 クオーレ倉敷 倉敷川、川舟乗り 人力車

名古屋

山本屋本店、名古屋駅前店、空いてた。 なめこ入り1380

Makefile

変数の優先順位

  1. Male引数
  2. Makefileの定義
  3. 環境変数

= と:= の違い

= 遅延評価 := 即時評価

-e オプション

環境変数の優先順位が上がる。

引数>環境変数>Makefile内定義?

特殊変数

$@ ターゲット $< ソースの最初 $^ 全てのソース $? ターゲットより新しいソース

その他の代入

::= += 追加 ?= != 右辺をshellで実行した結果を代入

ソレノイド制御 by arduino

ソレノイド

ソレノイドは、コイルと稼働鉄芯/プランジャー等から構成され、コイルに電流を流すとプランジャーが動く。

制御には、誘導負荷に対する考慮が必要。

特にオンオフする際の逆起電力対策として、ダイオード等を忘れると、故障や事故に繋がる。

回路

refの回路

f:id:qshino:20190720230504j:plain

ref

https://www.google.com/amp/s/gamp.ameblo.jp/solcon/entry-12278991497.html

レベル変換

I2Cの場合

変換チップ等

http://akizukidenshi.com/catalog/g/gM-05452/

GPIO等のレベルが異なる時

それぞれが5vと3.3vの場合。

  1. 5v to 3.3v
  2. 3.3v to 5v

電圧を下げる時

5v out to 3.3v in

5v out - 10kΩ -+--- 3.3v in
               |
              20kΩ --- GND

Vh@in = 5v * 20kΩ/(10k+20k) = 3.33...v

Out Current = 5v/(10kΩ+20kΩ) = 0.16mA

電圧を上げる時

3.3v out to 5v in

電圧を上げる側は考える事がいくつかある。

出力側に5v耐性があれば、Open drain 出力に5vプルアップで簡単に出来る。

しかし、5v耐性がない場合、5v耐性のあるトランジスタ、ゲート等の外部回路が必要。

            5v
             |
           30kΩ
             +--------  5v in
             |(c)
3.3v out -- TR
             |(e)
           GND

論理が反転するのはご愛嬌。

トランジスタを使うぐらいなら、レベルシフタの方が良いかもしれない。

或いは、5v耐性のあるゲートを使って5vにプルアップとか。

Rhaspberry Pi Zero W

安いね

Pi zero W 送料150円込みで約1,500円。Headerなし版。

何に使う?

WifiBluetoothが付いている一方、有線LANなし。まずは、どちらかでネットワークに接続したい。

取り敢えず、Bluetooth経由でネットワーク接続してみる。

Bluetooth network

基本的にはBlueZのPAN。

client の設定。

sudo hciconfig hci0 up
sudo bluetoothctl
 
pairing on
scan on (you should see the name of the system you named previously here)
scan off
devices (you should see the name of the system you named previously here)
agent on
pair xx:xx:xx:xx:xx:xx (enter the pin for pairing here, and a window should pop up on the computer asking for the same one)
trust xx:xx:xx:xx:xx:xx
connect xx:xx:xx:xx:xx:xx (will fail, but you will get a list of available services here)

# ここで、APにペアリングポップアップ。

# ペアリングの後で

sudo hciconfig hci0 up
sudo /usr/share/doc/bluez-test-scripts/examples/test-network 00:16:93:01:00:2C nap
sudo dhclient bnep0


ref

http://redtreerobotics.com/ip-over-bluetooth-with-linux/

Raspbian Buster

Raspbian Buster Release

  • 2019/07/10 リリース

フレーバー

3種類のパッケージ

  1. Desktop with recommended software 1,945MB
  2. Desktop 1,149MB
  3. Lite : Minimal 426MB

Version

Version July 2019 Linux Kernel 4.19 Name : Buster

Desktop w/recommended

Raspbian Buster with desktop and recommended software

Image with desktop and recommended software based on Debian Buster

Version:July 2019

Release date:2019-07-10

Kernel version:4.19

Size:1945 MB

ref

https://www.raspberrypi.org/downloads/raspbian/

setup serial

https://www.google.com/amp/www.usagi1975.com/201907061400/amp/