ESP32 で Lチカ - ESP32 DevKit C-32D を試す その1
※LEDと抵抗以外は、なんとなく刺してあるだけです。
Line things の対応機器の一つとして挙げられていたので、とりあえず使ってみたくなった。
Bluetooth での接続になるが、そのへんは Line アプリから行うらしい。
そして、このマイコン?は、USBでPCにつなぎ、Arduino IDE を使うのが流行っているかな?
Arduino は一つも持っていないし、せっかくなので、Arduino IDE で試します。
こちらで勉強させていただきました。
Arduino IDE
なんとなく Windows Store から入れてみました。
IDEの設定
ボードの追加
arduino-esp32/boards_manager.md at master · espressif/arduino-esp32 · GitHub
ボードの選択
シリアルポートの選択
WIndowsのHUBに指したら、認識がおかしかったので、USBにダイレクトに指したところ、COM3
でした。
コーディング
int portno=5; void setup() { // put your setup code here, to run once: pinMode(portno,OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(portno, HIGH); delay(500); digitalWrite(portno, LOW); delay(500); }
いともかんたんに Lチカ できた。
Mbed を思い出す・・・。
電子ペーパー と E-Ink display HAT for Raspberry Pi を試す
購入したのはこれです
e-paper hat
Raspberry pi 用の e-paper hat
2.13inch e-Paper HAT (D) - Waveshare Wiki
(D)が何なのかイマイチわかりませんが、たぶんこれです。
接続
Zero に 40pin をはんだ付けして、HAT を差し込む。
SPI
raspi-config
から、SPI を有効化する。
SPIDEV, pil も入れる。
$ sudo apt install python-spidev python-pil
動作テスト
テスコードの取得と展開
7zipで圧縮されているようなので、
$ sudo apt-get install p7zip-full
しておく。
$ wget https://www.waveshare.com/w/upload/c/c7/2.13inch_e-paper_d_code.7z $ mkdir 2.13inch_e-paper_d_code $ cd 2.13inch_e-paper_d_code $ 7za x ../2.13inch_e-paper_d_code.7z
実行する。
$ python main.py e-Paper busy e-Paper busy release e-Paper busy e-Paper busy release traceback.format_exc(): Traceback (most recent call last): File "main.py", line 28, in <module> font15 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 15) File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 280, in truetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 145, in __init__ layout_engine=layout_engine) IOError: cannot open resource
フォントが無いだと・・・?!
フォントの設定
font15 = ImageFont.truetype('/opt/vc/src/hello_pi/hello_font/Vera.ttf', 15)
などとする。
んで、実行
$ python main.py e-Paper busy e-Paper busy release e-Paper busy e-Paper busy release Horizontal 1 #!/usr/bin/python Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal e-Paper busy e-Paper busy release Horizontal ・・・ループ
画像だけを表示する
#!/usr/bin/python # -*- coding:utf-8 -*- import epd2in13d import time from PIL import Image,ImageDraw,ImageFont import traceback try: epd = epd2in13d.EPD() epd.init() epd.Clear(0xFF) # read bmp file # epd.Clear(0xFF) image = Image.open('2in13d.bmp') epd.display(epd.getbuffer(image)) time.sleep(2) except Exception, e: print 'traceback.format_exc():\n%s' % traceback.format_exc() exit()
日本語を表示する
font は /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc にしました。
#!/usr/bin/python # -*- coding:utf-8 -*- import epd2in13d import time from PIL import Image,ImageDraw,ImageFont import traceback try: epd = epd2in13d.EPD() epd.init() epd.Clear(0xFF) # Drawing on the image image = Image.new('1', (epd2in13d.EPD_HEIGHT, epd2in13d.EPD_WIDTH), 255) # 255: clear the frame draw = ImageDraw.Draw(image) font15 = ImageFont.truetype('/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc', 15) draw.text((40, 20), u'ようこそ!', font = font15, fill = 0) draw.text((40, 60), 'e-Paper demo', font = font15, fill = 0) draw.text((40, 80), 'Hello world', font = font15, fill = 0) epd.display(epd.getbuffer(image)) time.sleep(2) except Exception, e: print 'traceback.format_exc():\n%s' % traceback.format_exc() exit()
クリアするだけ
#!/usr/bin/python # -*- coding:utf-8 -*- import epd2in13d import time from PIL import Image,ImageDraw,ImageFont import traceback try: epd = epd2in13d.EPD() epd.init() epd.Clear(0xFF) except Exception, e: print 'traceback.format_exc():\n%s' % traceback.format_exc() exit()
犯したミス
電子ペーパーの向きを逆に刺した
サンプルプログラムを取得する際に、 7.5inch e-Paper HAT (B)
を、なぜか使用していた。
所感
ノイズっぽい線
左の方に、縦線が何本か出たりする。
いわゆるドット抜けに近い状態に見えるが、これは正常なのだろうか。
Youtube などで見る限り、そんな線は出てない。
初期不良の一種だろうか。
Zero W じゃなくてもよかった?
Zeroにピッタリのサイズだし、、、ということで、なんとなくZeroで実験したのだけども、べつに、Zeroでやる必要はなかった。
RPI ごと持ち運ぶのであれば、Zero が良いが、用途が決まっていないのであれば、zero は全てが遅いので無駄に時間がかかる(待つだけですが)。
機能を最大限に活かすのであれば、WifiかBluetoothで接続して、動的に内容を書き換える・・・のだろうけど、使いみちが思いつかないから、今は手が動かない。
ステッピングモータードライバA4988 を試す
ステッピングモータードライバA4988を試します。
A4988
ステップと回転方向のシンプルな制御方式 5段階のステップ解像度:full-step, half-step, quarter-step, eighth-step, and sixteenth-step 電流調整機能によりボリューム操作で最大出力電流を設定可能。 インテリジェントチョッピング制御が自動的に正しい電流減衰モードを選択(高速減衰/低速減衰) 過熱シャットダウン、低電圧ロックアウト、クロス電流保護機能 接地短絡および負荷短絡保護機能
スイッチサイエンスから購入
ステッピングモータードライバA4988 - スイッチサイエンス
モーター
仕様 ・2相バイポーラ ステッピングモータ ・推奨動作電圧:DC12V ・ステップ数:200ステップ(1.8度) ・電流:0.33A/相 ・シャフト径:5mm ・シャフト長さ:24mm(方軸) ・コイル抵抗:34Ω ・重量:200g ・保持トルク:0.23N・m ・絶縁抵抗:100MΩ以上(500VDC) ・サイズ:42(W)x42(H)x34(D)mm
配線
モーターを 100μF のコンデンサでつなぐ。
出力電流の調整
可変抵抗を調整することで、モーターに流れる最大の電流を設定できるようです。
Pololu - MP6500 Stepper Motor Driver Carrier, Digital Current Control
Current limiting
を読む
基板に乗っている抵抗?によって、式は変わる。
[0.05Ω] Current Limit = VREF × 2.5 [0.10Ω] Current Limit = VREF × 1.25 [0.20Ω] Current Limit = VREF × 0.625
測定電圧=可変抵抗とGNDの電圧差
どうやら、モータにながれる最大電流=測定電圧 x 2.5
0.33A にする場合には、0.132 と調整すればいい?
プルプルする
何もしていないの状態で、勝手に動いたりします。
ノイズが原因ではないかと思います。
STEPとDIRをそれぞれ 1kΩ でプルアップするとう方法を見つけやってみたところ、たしかに安定する。
プログラミング
制御方法がよくわかってない。
こちらを使用しました。
ステッピングモーター + Raspberry Pi ② モーター使いの第一歩「動いた・・・」 | ☆世界が変わる☆
#!/usr/bin/python # coding: utf-8 import RPi.GPIO as GPIO import time import sys stepPin = 22 dircPin = 17 enabPin = 23 GPIO.setmode(GPIO.BCM) # GPIOで指定 GPIO.setup(enabPin, GPIO.OUT) # 2:Enableに定義 GPIO.setup(dircPin, GPIO.OUT) # 3:Dir GPIO.setup(stepPin, GPIO.OUT) # 4:Step #GPIO.setup(17, GPIO.OUT)#17:MS1 #GPIO.setup(27, GPIO.OUT)#27:MS2 #GPIO.setup(22, GPIO.OUT)#22:MS3 def main(): GPIO.output(enabPin, 0) time.sleep(0.5) #GPIO.output(17, 0) #GPIO.output(27, 0) #GPIO.output(22, 0) GPIO.output(dircPin, 0) for num in range(0,200): GPIO.output(stepPin, 1) time.sleep(0.001) GPIO.output(stepPin, 0) time.sleep(0.001) time.sleep(1) GPIO.output(dircPin, 1)# 逆回転 for num in range(0,200): GPIO.output(stepPin, 1) time.sleep(0.001) GPIO.output(stepPin, 0) time.sleep(0.001) time.sleep(1) GPIO.output(dircPin, 0) for num in range(0,100): GPIO.output(stepPin, 1) time.sleep(0.0005) GPIO.output(stepPin, 0) time.sleep(0.0005) GPIO.output(dircPin, 1)# 逆回転 for num in range(0,100): GPIO.output(stepPin, 1) time.sleep(0.0005) GPIO.output(stepPin, 0) time.sleep(0.0005) GPIO.cleanup() try: main() except KeyboardInterrupt: print('interrupted!') GPIO.cleanup()
RPI4 と Jetson nano ベンチマーク
RPI4 は 4G RAM
Unix bench
インストール
$ wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/byte-unixbench/UnixBench5.1.3.tgz $ tar xvzf UnixBench5.1.3.tgz $ cd UnixBench/ $ make -j 4
実行
$ ./Run
RPI 4
Raspberry pi 4 のベンチマーク結果
# # # # # # # ##### ###### # # #### # # # # ## # # # # # # # ## # # # # # # # # # # # ## ##### ##### # # # # ###### # # # # # # ## # # # # # # # # # # # # ## # # # # # # # ## # # # # #### # # # # # ##### ###### # # #### # # Version 5.1.3 Based on the Byte Magazine Unix Benchmark Multi-CPU version Version 5 revisions by Ian Smith, Sunnyvale, CA, USA January 13, 2011 johantheghost at yahoo period com Wide character in print at ./Run line 1511. Wide character in printf at ./Run line 1542. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. 1 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10 1 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10 1 x Execl Throughput 1 2 3 1 x File Copy 1024 bufsize 2000 maxblocks 1 2 3 1 x File Copy 256 bufsize 500 maxblocks 1 2 3 1 x File Copy 4096 bufsize 8000 maxblocks 1 2 3 1 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10 1 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10 1 x Process Creation 1 2 3 1 x System Call Overhead 1 2 3 4 5 6 7 8 9 10 1 x Shell Scripts (1 concurrent) 1 2 3 1 x Shell Scripts (8 concurrent) 1 2 3 Wide character in printf at ./Run line 1484. 4 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10 4 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10 4 x Execl Throughput 1 2 3 4 x File Copy 1024 bufsize 2000 maxblocks 1 2 3 4 x File Copy 256 bufsize 500 maxblocks 1 2 3 4 x File Copy 4096 bufsize 8000 maxblocks 1 2 3 4 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10 4 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10 4 x Process Creation 1 2 3 4 x System Call Overhead 1 2 3 4 5 6 7 8 9 10 4 x Shell Scripts (1 concurrent) 1 2 3 4 x Shell Scripts (8 concurrent) 1 2 3 Wide character in printf at ./Run line 1484. ======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: raspberrypi: GNU/Linux OS: GNU/Linux -- 4.19.50-v7l+ -- #895 SMP Thu Jun 20 16:03:42 BST 2019 Machine: armv7l (unknown) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: ARMv7 Processor rev 3 (v7l) (0.0 bogomips) CPU 1: ARMv7 Processor rev 3 (v7l) (0.0 bogomips) CPU 2: ARMv7 Processor rev 3 (v7l) (0.0 bogomips) CPU 3: ARMv7 Processor rev 3 (v7l) (0.0 bogomips) 11:49:55 up 7 min, 2 users, load average: 0.26, 0.12, 0.05; runlevel 5 ------------------------------------------------------------------------ Benchmark Run: 水 7月 31 2019 11:49:55 - 12:17:48 4 CPUs in system; running 1 parallel copy of tests Dhrystone 2 using register variables 10149711.1 lps (10.0 s, 7 samples) Double-Precision Whetstone 2395.4 MWIPS (9.6 s, 7 samples) Execl Throughput 903.9 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 114368.4 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 31691.2 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 315794.9 KBps (30.0 s, 2 samples) Pipe Throughput 160713.9 lps (10.0 s, 7 samples) Pipe-based Context Switching 43675.5 lps (10.0 s, 7 samples) Process Creation 1881.9 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 2418.8 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 733.0 lpm (60.0 s, 2 samples) System Call Overhead 496298.8 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 10149711.1 869.7 Double-Precision Whetstone 55.0 2395.4 435.5 Execl Throughput 43.0 903.9 210.2 File Copy 1024 bufsize 2000 maxblocks 3960.0 114368.4 288.8 File Copy 256 bufsize 500 maxblocks 1655.0 31691.2 191.5 File Copy 4096 bufsize 8000 maxblocks 5800.0 315794.9 544.5 Pipe Throughput 12440.0 160713.9 129.2 Pipe-based Context Switching 4000.0 43675.5 109.2 Process Creation 126.0 1881.9 149.4 Shell Scripts (1 concurrent) 42.4 2418.8 570.5 Shell Scripts (8 concurrent) 6.0 733.0 1221.7 System Call Overhead 15000.0 496298.8 330.9 ======== System Benchmarks Index Score 320.3 ------------------------------------------------------------------------ Benchmark Run: 水 7月 31 2019 12:17:48 - 12:45:43 4 CPUs in system; running 4 parallel copies of tests Dhrystone 2 using register variables 40553830.8 lps (10.0 s, 7 samples) Double-Precision Whetstone 9579.6 MWIPS (9.6 s, 7 samples) Execl Throughput 2702.9 lps (29.9 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 213996.8 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 58113.9 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 616020.2 KBps (30.0 s, 2 samples) Pipe Throughput 613981.1 lps (10.0 s, 7 samples) Pipe-based Context Switching 192241.9 lps (10.0 s, 7 samples) Process Creation 4747.6 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 5828.7 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 798.2 lpm (60.2 s, 2 samples) System Call Overhead 1863799.0 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 40553830.8 3475.0 Double-Precision Whetstone 55.0 9579.6 1741.8 Execl Throughput 43.0 2702.9 628.6 File Copy 1024 bufsize 2000 maxblocks 3960.0 213996.8 540.4 File Copy 256 bufsize 500 maxblocks 1655.0 58113.9 351.1 File Copy 4096 bufsize 8000 maxblocks 5800.0 616020.2 1062.1 Pipe Throughput 12440.0 613981.1 493.6 Pipe-based Context Switching 4000.0 192241.9 480.6 Process Creation 126.0 4747.6 376.8 Shell Scripts (1 concurrent) 42.4 5828.7 1374.7 Shell Scripts (8 concurrent) 6.0 798.2 1330.4 System Call Overhead 15000.0 1863799.0 1242.5 ======== System Benchmarks Index Score 856.4
Jetson nano
Jetson nano のベンチマーク結果
# # # # # # # ##### ###### # # #### # # # # ## # # # # # # # ## # # # # # # # # # # # ## ##### ##### # # # # ###### # # # # # # ## # # # # # # # # # # # # ## # # # # # # # ## # # # # #### # # # # # ##### ###### # # #### # # Version 5.1.3 Based on the Byte Magazine Unix Benchmark Multi-CPU version Version 5 revisions by Ian Smith, Sunnyvale, CA, USA January 13, 2011 johantheghost at yahoo period com Wide character in print at ./Run line 1511. Wide character in printf at ./Run line 1542. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1379. Use of uninitialized value in printf at ./Run line 1380. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. Use of uninitialized value in printf at ./Run line 1589. Use of uninitialized value in printf at ./Run line 1590. 1 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10 1 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10 1 x Execl Throughput 1 2 3 1 x File Copy 1024 bufsize 2000 maxblocks 1 2 3 1 x File Copy 256 bufsize 500 maxblocks 1 2 3 1 x File Copy 4096 bufsize 8000 maxblocks 1 2 3 1 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10 1 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10 1 x Process Creation 1 2 3 1 x System Call Overhead 1 2 3 4 5 6 7 8 9 10 1 x Shell Scripts (1 concurrent) 1 2 3 1 x Shell Scripts (8 concurrent) 1 2 3 Wide character in printf at ./Run line 1484. 4 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10 4 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10 4 x Execl Throughput 1 2 3 4 x File Copy 1024 bufsize 2000 maxblocks 1 2 3 4 x File Copy 256 bufsize 500 maxblocks 1 2 3 4 x File Copy 4096 bufsize 8000 maxblocks 1 2 3 4 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10 4 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10 4 x Process Creation 1 2 3 4 x System Call Overhead 1 2 3 4 5 6 7 8 9 10 4 x Shell Scripts (1 concurrent) 1 2 3 4 x Shell Scripts (8 concurrent) 1 2 3 Wide character in printf at ./Run line 1484. ======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: omasa-jetson-nano: GNU/Linux OS: GNU/Linux -- 4.9.140-tegra -- #1 SMP PREEMPT Wed Mar 13 00:32:22 PDT 2019 Machine: aarch64 (aarch64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: ARMv8 Processor rev 1 (v8l) (0.0 bogomips) CPU 1: ARMv8 Processor rev 1 (v8l) (0.0 bogomips) CPU 2: ARMv8 Processor rev 1 (v8l) (0.0 bogomips) CPU 3: ARMv8 Processor rev 1 (v8l) (0.0 bogomips) 13:00:41 up 1 min, 1 user, load average: 0.87, 0.29, 0.10; runlevel 5 ------------------------------------------------------------------------ Benchmark Run: 水 7月 31 2019 13:00:41 - 13:28:39 4 CPUs in system; running 1 parallel copy of tests Dhrystone 2 using register variables 12361654.2 lps (10.0 s, 7 samples) Double-Precision Whetstone 1466.0 MWIPS (9.9 s, 7 samples) Execl Throughput 1119.3 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 177918.8 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 50193.5 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 512846.0 KBps (30.0 s, 2 samples) Pipe Throughput 310796.1 lps (10.0 s, 7 samples) Pipe-based Context Switching 55926.2 lps (10.0 s, 7 samples) Process Creation 4309.9 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 3574.2 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1076.7 lpm (60.0 s, 2 samples) System Call Overhead 344613.1 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 12361654.2 1059.3 Double-Precision Whetstone 55.0 1466.0 266.5 Execl Throughput 43.0 1119.3 260.3 File Copy 1024 bufsize 2000 maxblocks 3960.0 177918.8 449.3 File Copy 256 bufsize 500 maxblocks 1655.0 50193.5 303.3 File Copy 4096 bufsize 8000 maxblocks 5800.0 512846.0 884.2 Pipe Throughput 12440.0 310796.1 249.8 Pipe-based Context Switching 4000.0 55926.2 139.8 Process Creation 126.0 4309.9 342.1 Shell Scripts (1 concurrent) 42.4 3574.2 843.0 Shell Scripts (8 concurrent) 6.0 1076.7 1794.4 System Call Overhead 15000.0 344613.1 229.7 ======== System Benchmarks Index Score 427.0 ------------------------------------------------------------------------ Benchmark Run: 水 7月 31 2019 13:28:39 - 13:56:38 4 CPUs in system; running 4 parallel copies of tests Dhrystone 2 using register variables 49457389.5 lps (10.0 s, 7 samples) Double-Precision Whetstone 5863.2 MWIPS (9.9 s, 7 samples) Execl Throughput 4133.8 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 279995.5 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 72410.0 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 831965.1 KBps (30.0 s, 2 samples) Pipe Throughput 1264305.1 lps (10.0 s, 7 samples) Pipe-based Context Switching 157316.4 lps (10.0 s, 7 samples) Process Creation 13291.2 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 8405.8 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1189.7 lpm (60.1 s, 2 samples) System Call Overhead 1327968.8 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 49457389.5 4238.0 Double-Precision Whetstone 55.0 5863.2 1066.0 Execl Throughput 43.0 4133.8 961.4 File Copy 1024 bufsize 2000 maxblocks 3960.0 279995.5 707.1 File Copy 256 bufsize 500 maxblocks 1655.0 72410.0 437.5 File Copy 4096 bufsize 8000 maxblocks 5800.0 831965.1 1434.4 Pipe Throughput 12440.0 1264305.1 1016.3 Pipe-based Context Switching 4000.0 157316.4 393.3 Process Creation 126.0 13291.2 1054.9 Shell Scripts (1 concurrent) 42.4 8405.8 1982.5 Shell Scripts (8 concurrent) 6.0 1189.7 1982.9 System Call Overhead 15000.0 1327968.8 885.3 ======== System Benchmarks Index Score 1090.5
Raspberry pi 4 model B
Raspberry pi 4 model B 4G RAM をとりあえず購入してみました。
いくつかのハマりポイント
給電USB
typeC になっています。
また、給電が最低 3A とのこと。
初期ロットは、USB Type C の規格を満たしておらず、USB充電ができない場合が有るらしい。
不安なので、とりあえず公式を購入しました。
なお、ロットの見分け方ですが、
$ cat /proc/cpuinfo ... Hardware : BCM2835 Revision : c03111 Serial : 10000000f2bcc00c Model : Raspberry Pi 4 Model B Rev 1.1
とでてきたら、旧ロット(問題有りVersion)らしいです。
Raspberry Pi 4 Model B Rev 1.1 ← 問題有り
Raspberry Pi 4 Model B Rev 1.2 ← 問題なし
ディスプレイ
hdmi type-D が2つ有る。
Type-D なので、変換ケーブルを購入しました。
発熱
発熱がすごいらしい。
適当にファンを当てておこうと思います。
気になる点
Jetson nano とのバトルになるのではないかと思う。
AIは動くかな?
セットアップ
ガイドに従います。
img
Raspbian Buster with desktop and recommended software Image with desktop and recommended software based on Debian Buster Version:June 2019 Release date:2019-06-20 Kernel version:4.19 Size: 1945 MB
Raspbian Buster ... なんかかっこいいね!
microSD を SD card formatter でフォーマット。
Etcher で焼き込みます。
Wifi Blue tooth OFF
config.txt
dtoverlay=pi3-disable-wifi dtoverlay=pi3-disable-bt
給電
なんか、USB C の規格に準拠していないとか何やら、面倒なので、Pin header 給電を行いました。
5V 4A をつなぎました。
起動後
$ uname -a Linux raspberrypi 4.19.50-v7l+ #895 SMP Thu Jun 20 16:03:42 BST 2019 armv7l GNU/Linux $ vcgencmd measure_temp temp=60.0'C
負荷無しでも、60'c 行ってます。
apt-get update
Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'testing' to 'stable'
$ sudo apt --allow-releaseinfo-change update
$ sudo apt-get update
$ sudo apt-get upgrade
python 初期状態
※update は掛け終わっています。(2019-07-11 現在)
Python のパスは、python2 になっていて、2.7.16 でした。
Python3 も入っていて、 3.7.3 でした。
$ python --version Python 2.7.16 $ python3 --version Python 3.7.3
2019-09-30 追記
技適をとれたようです。
FLiR Dev Kit を試す その6 メーカー情報など
昔はなかったのかな?
日本語のサイト
日本語のメーカーサイトが有りました。
FLiR開発キット www.switch-science.com
入っているモジュールの version が定かではありませんが、解像度: 80 × 60
及び 画角: 水平視野51度
から判断するに、Lepton 1.5 なのでしょう。
型番一覧
名称 | 型番 | 特徴 |
---|---|---|
Lepton 3.5 | 500-0771-01 | 160 x 120 シャッター ラジオメトリック |
Lepton 3.0 | 500-0726-01 | 160 x 120 シャッター |
Lepton 2.5 | 500-0763-01 | 80 x 60 シャッター |
Lepton 2.0 | 500-0659-01 | 80 x 60 |
Lepton 1.6 | 500-0690-00 | 視野角 : Lepton 25:25°(Horizontal) x 31.3度(Diagonal) |
Lepton 1.5 | 500-0643-00 | |
Lepton Breakout Board | 250-0587-00 | 評価ボード? |
FLIR Radiometric Lepton Dev Kit 新バージョン
FLIR Radiometric Lepton Dev Kit www.sparkfun.com
1x FLIR Lepton® 2.5 - Thermal Imaging Module
とのことです。
カメラモデル: レプトン2.5、80×60、50°、シャッター付きラジオメトリック
ラジオメトリック補正?
なにそれ?
ラジオメ トリック補正 放射量の歪を補正することをラジオメトリック補正という。 これらは大に起因するもの,センサに起因するもの太陽地形に起因するものがある。
https://www.jstage.jst.go.jp/article/itej1997/55/12/55_12_1593/_pdf
Lepton 3.5 シャッター付き
販売されている。 ctl-commerce.com
注意書きがあり、
※Lepton3.5および3.0との組み合わせでFLIR社より不具合が報告されております。Lepton3.5および3.0をご使用の場合は弊社までお問い合わせ下さい。
ニキシー管 IN-12B - その2
つぎは、ドライバを使ってみる
制御成功の写真
Raspbery pi からドライバを制御し、3と9を交互に表示させました。
K155ID1
SN74141
互換ということなので SN74141 でデータシートを探した。
電圧について
動作電圧Vcc 4.75v ~ 5.25v
VIH High-level input Min 2v
VIL Low-level input Max 0.8v
ということなので、Vcc に Raspberry pi の 5v を流し、VIH,VIL には、GPIOの3.3v を流したり止めたりすればOK。
ものすごく当たり前のことなのだけど、16本も配線しないといけない。
なんてこった。。。
面倒なので、制御用の A-D と、適当に2箇所だけGND接続することにした。
A-D に High, Low を設定することで、 0-9 の設定になる模様。
その組み合わせが上記。
配線
Raspberry pi | K155ID1 | ニキシー | 電源 |
---|---|---|---|
5v | VCC | ||
GND | GND | GND | |
GPIO 12 | A | ||
GPIO 16 | B | ||
GPIO 20 | C | ||
GPIO 21 | D | ||
1 | 180v | ||
0 | 3 | ||
1 | 9 | ||
2 |
以下略
※注意
鰐口?で配線したため、距離を取るために、3と9を0と1につないでいます。
ほかは結線していないので、光りません。
コーディング
とりあえず、プログラムで光ればいいやーということで、GPIO直接書くような感じです。 ダサいです。
# -*- coding: utf-8 -*- import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.OUT) GPIO.setup(16, GPIO.OUT) GPIO.setup(20, GPIO.OUT) GPIO.setup(21, GPIO.OUT) time.sleep(0.1) GPIO.output(12, GPIO.LOW) GPIO.output(16, GPIO.LOW) GPIO.output(20, GPIO.LOW) GPIO.output(21, GPIO.LOW) time.sleep(1) ~ GPIO.output(12, GPIO.HIGH) time.sleep(2) GPIO.output(12, GPIO.LOW) time.sleep(2) GPIO.output(12, GPIO.HIGH) time.sleep(2) GPIO.output(12, GPIO.LOW) time.sleep(2) ~ GPIO.cleanup()