2020年10月10日土曜日

Red Pitaya Setup Review

 → Click here for Japanese page ←

My teacher was planning to dispose of it (?). I got a mysterious red dragon fruit called Red Pitaya. (Pitaya = Dragon Fruit) This dragon fruit is not a fruit, but a measuring instrument.

 Red Pitaya is a measurement board born from crowdfunding called Kickstarter.
It is an open source measurement and control tool, and is said to be an alternative to laboratory equipment.It is also possible to easily add functions by installing a new application.Since Linux is running on the board and a web server is running on it, you can check the measurement results in real time from a web browser by accessing this web server. The size fits in the palm of your hand, and you can access and measure from other devices such as PCs and tablets anywhere. It can be said that it is a new type of measurement device that is in line with the recent trends.
 This time, I would like to set up using the case of Windows as an example.

What is Red Pitaya?


Red Pitaya is an open source measuring instrument developed to replace expensive equipment.
This powerful tool is at the heart of a system that makes it easy to discover, experience, learn, develop and share different applications with Red Pitaya.



Bazaar is also an open source application with just one click. Initially the following are available:

・ Oscilloscope
・ Spectrum analyzer
・ Oscilloscope & arbitrary signal generator

Red Pitaya can be any instrument just by changing the application. It can be easily used with oscilloscopes and spectrum analyzers.


Specifications

Main specifications
analog:
・ Input channel: 2
Bandwidth: 50 MHz (DC coupled, 3 dB BW)
Sample rate: 125 Msps
ADC resolution: 14 bits (LTC ADC)
Input impedance: 1 MOhm // 10pF
Input channel gain: fixed (due to improved dynamic range) 14-bit particle size)
Default full-scale voltage: + -0.6 V (+ -6 V 10x probe attenuation). Full-scale reconfigurable by replacing discrete components (+ -15V).
Overload protection: protection diode
Connector type: SMA
・ Output channel: 2
Bandwidth: 49 MHz (3)
DC coupling in dB, 3 dB BW defined by anti-imaging filter) Sample rate: 125 Msps
DAC resolution: 14 bits
Impedance: 50 ohms
Full scale power: 10 dBm (50 ohm load)
Output slew rate: 200 V / us
Short circuit protection: Yes
Connector type: SMA
・connections: 100 Mb Ethernet, USB, USB OTG (2.0), JTAG, I2C, UART, SPI ...


◆Setup◆

①Hardware.

 In Red Pitaya, Linux data etc. are stored in the Micro SD card as storage.
 Use a Micro SD card that is FAT32 and does not exceed 32GB.Download the image to burn to Micro SD and unzip the downloaded Zip file.Copy all the contents of the Zip file to the SD card.
 Carefully insert this Micro SD card into the Red Pitaya Micro SD card slot.
 After inserting the SD card, connect the upper USB as a USB power supply of 2A or more, the lower USB as serial communication with a PC, and the LAN to an appropriate port.
This time it was not a direct connection, but I connected with a wired LAN router.



②Connect to PC.

 Red Pitaya can use a serial console independently of Ethernet. You can check the status at boot time and perform normal command line operations, which is convenient for verification when it does not work, although it is not essential. It is recommended to use it when it is not good like this time. 
 The parameters for the serial connection are as follows:

port
COM XX (recognized virtual port)
baud rate
115200
Data bits
8
Stop bit
1
parity
None
Flow control
None
参考:Tera Term

③Power ON.

 After preparing for ①, connect the USB power supply that can supply 2A and the Micro USB port for the power supply of Red Pitaya, and Red Pitaya will start. If all goes well, the blue and green LEDs on the board should light up and the orange LED0 should flash.

④Power on Red Pitaya(Tera Term)

If the connection is successful, 

Red Pitaya GNU/Linux/Ecosystem version 0.92-378

redpitaya>

 will be displayed on the screen.A regular Linux console is also available.


Try using the app

 Initially, you can use three web applications: oscilloscope, oscilloscope & signal generator, and spectrum analyzer. To check the operation, use Generator & Oscilloscope.
 Connect the probe to the IN1 and OUT1 analog terminals. Connect the probes as shown in the picture below so that you can directly input the generated waveform.


Select Generator & Oscilloscope on the app screen.


After launching the app, click the Signal generator setting item to open it, and set Signal type: Square, Amplitude: 2 Vpp, Frequency: 1000 Hz. Finally, check Channel 1. This will output the waveform from Channel 1.

Gain settings should be Probe attenuation: 1x, Gain setting : HV. (For safety)

To set the oscilloscope, first click the Channel 2 button in the upper left to erase unnecessary waveforms in Channel 2. Set the Trigger setting items as Source: Channel 1, Mode: Normal, Edge: Rising, and Level: 0 V. With this, the waveform can be fixed based on the rise at 0V. If you set X axis: 2ms and Y axis: 2V in the Range setting items, you can display the waveform as shown in the screen below.


When you check the waveform, you can see that it is a square wave with a period of 1 ms. (Although the gain in the minus direction is strange.)

Stumbling
Since I considered it differently from this article, I wrote it separately.

◆From now on◆
I'm thinking of adding a protection circuit and buffer to Red Pitaya.
The steering is thought as follows.
・ The input part is undecided. (Op amp buffer and diode protection + α)
-The output part is a buffer circuit.

Since I received it with much effort, I would like to finish it so that it can be used as a substitute for the measuring instruments at home.→「VS410A,MHS-5200A-25M,8040,PicoScope2104,」

Reference◆

Red Pitayaのセットアップレビュー

→ Click here for English page ←

 恩師が片づけで廃棄する(?)予定であった。Red Pitayaという謎めいた赤いドラゴンフルーツを頂いた。(Pitaya=ドラゴンフルーツ)このドラゴンフルーツはフルーツでなく、計測器です。

 Red PitayaはKickstarterというクラウドファンディングより生まれた計測ボードです。
オープンソースの測定、制御ツールであり、実験装置に代わりになるそうです。アプリを新たにインストールすることで手軽に機能を追加することも可能です。ボードではLinuxが動作しており、その上でWebサーバが稼働しているため、このWebサーバにアクセスすることでWebブラウザから計測結果をリアルタイムに確認することができます。サイズも手のひらに収まる大きさで、どこでも他のPCやタブレットといったデバイスからアクセスして計測が可能になります。最近の潮流にのった新たな形の計測デバイスであるといえると思います。
 今回はWindowsでの場合を例にセットアップしていきたいと思います。

Red Pitayaとは?


 Red Pitayaはオープンソース型計測機器で、高価な装置の代わりになるようにと開発されました。
この強力なツールは、さまざまなアプリケーションの発見、体験、学習、開発、共有を容易にするシステムの根幹に当たるものがRed Pitayaです。



また、Bazaarは、オープンソースアプリケーションをワンクリックで利用して、使用できます。最初は以下ものが利用できます: 

・オシロスコープ 
・スペクトラムアナライザー 
・オシロスコープ&任意信号発生器

Red Pitayaは、アプリケーションを変更するだけであらゆる計測器になります。オシロスコープやスペクトラムアナライザーなどの手軽に利用できます。 


主要な仕様

アナログ:
・入力チャンネル:2
帯域幅:50 MHz(DC結合、3dB BW)
サンプルレート:125 Msps
ADC分解能:14ビット(LTC ADC)
入力インピーダンス:1 MOhm // 10pF
入力チャンネルゲイン:固定(ダイナミックレンジの改善による) 14ビットの粒度)
デフォルトのフルスケール電圧:+ -0.6 V(+ -6 Vで10倍のプローブ減衰)。ディスクリートコンポーネントの交換によりフルスケールで再構成可能(+ -15V)。
過負荷保護:保護ダイオード
コネクタタイプ:SMA
・出力チャネル:2
帯域幅:49 MHz(3
dBでDC結合、3 dB BWはアンチイメージングフィルターで定義)  サンプルレート:125 Msps
DAC分解能:14ビット
インピーダンス:50オーム
フルスケールパワー:10 dBm(50オーム負荷)
出力スルーレート:200 V / us
短絡保護:はい 
コネクタタイプ:SMA(「Diagnostic Red Pitaya Kit」で利用可能なSMAからBNCへのアダプタ)
・その他の接続:100 Mbイーサネット、USB、USB OTG(2.0)、JTAG、I2C、UART、SPI ...


◆セットアップ◆

①ハードウェアの接続

 Red Pitaya はLinuxのデータ等がMicro SDカードをストレージとして保存されています。
 FAT32でフォーマットした32GBを超えないMicro SDカードを用意してください。こちらからMicro SDに書き込むイメージをダウンロードし、ダウンロードされたZipファイルを解凍してください。Zipファイルを解凍した中身のファイルをすべてMicro SDカードにコピーします。
 このMicro SDカードを Red Pitaya のMicro SDカードスロットに向きに注意して挿入します。
 SDカードを入れたら、上側のUSBは2A以上のUSB電源として、下側のUSBにはPCとのシリアル通信として、LANは適当なポートに接続します。
今回LAN接続はダイレクトでなく、有線LANルーターを使用して接続しました。



②シリアルコンソールによるPCとの接続

 Red Pitayaでは、イーサネットとは独立して、シリアルコンソールを利用することができます。ブート時のステータスの確認や通常のコマンドライン操作が可能で、必須ではないですがうまく動かないときの検証などに便利です。今回のようなうまういかない時は利用するといいでしょう。シリアル接続のパラメータは次のようにします。

ポート
COM XX(認識された仮想ポート)
ボーレート
115200
データビット
8
ストップビット
1
パリティ
None
フロー制御
None
参考:Tera Term

③Red Pitayaに電源を投入(ハードウェア)

 ①の準備の後、2A供給可能なUSB電源と Red Pitaya の電源用のMicro USBポートを接続すると、 Red Pitaya が起動します。うまくいっていれば、基板上の青と緑のLEDが点灯し、オレンジのLED0が点滅するはずです。

④Red Pitayaに電源を投入(Tera Term)

接続に成功すると、画面に

Red Pitaya GNU/Linux/Ecosystem version 0.92-378

redpitaya>

と表示されます。通常のLinuxコンソールも利用できます。


Red Pitayaのアプリを使ってみる

デフォルトの状態で、Red Pitayaに接続すると、オシロスコープ、オシロスコープ&シグナルジェネレータ、スペクトルアナライザの3つのWebアプリケーションが確認できるはずです。今回、簡易的に動作テストを行うため、Generator & Oscilloscopeを利用しました。


プローブをIN1とOUT1アナログ端子に接続します。プローブを下の写真のようにつなぎ生成した波形を直接入力できるようにします。


アプリを起動したら、Signal generatorの設定項目をクリックして開き、Signal type: Square、Amplitude: 2 Vpp、Frequency: 1000 Hzとします。最後に Channel 1 をチェックしてください。これで、Channel 1から波形が出力されます。

Gain settingsはProbe attenuation:1x、Gain setting::HVにします。(安全のため)

オシロスコープの設定は、まず、左上のChannel 2ボタンをクリックして、Channel 2の必要ない波形を消します。Triggerの設定項目のSource: Channel 1 、Mode: Normal 、Edge: Rising 、Level: 0 Vとします。これで0Vでの立ち上がりを基準に、波形を固定できます。Rangeの設定項目でX axis: 2ms 、Y axis: 2V に設定すると下の画面のように波形を表示できます。


波形を確認するときちんと1ms周期の方形波になっていることがわかります。(マイナス方向のゲインがおかしいけど。)

◆つまずき◆
本記事と違う考察をしたので別に記載しました。

◆今後◆
Red Pitayaを計測器として、作り上げるにしても直接信号を入れるのは、保護回路があるとはいえ、個人的には怖い。あと、出力部分も負荷をひき過ぎた際動作が安定しなくなると思われるので、入出力ともにステアリング回路を考えます。
どのようなステアリングをするかは以下のように考えています。
・入力部分は未定。(オペアンプバッファとダイオード保護+α?)
・出力部分はバッファ回路。

せっかくいただいたものなので、家にある計測器の代わりになるぐらいには仕上げていきたいと思っています。
「VS410A,MHS-5200A-25M,8040,PicoScope2104,」

http://rp-f00ab0.local/

参考サイト

Red Pitayaのセットアップで苦戦した

 → Click here for English page ←

 恩師が片づけで廃棄する(?)予定であった、"Red Pitaya"。これのセットアップに関して、そこそこ苦戦したのでまとめておきます。

動作確認(ハードウェア)

 Red Pitayaのセットアップレビューでも、記載したが、以下の動作の際はハード的には問題ない。このことから、ハードが壊れているとかではないことが予想できる。

動作確認(SDHCカード内ファイル)

ファイル内は以下のようになっていれば動くはず。仮に動かなさそうであれば、
こちらを利用してください。

動作確認(シリアル)

シリアルコンソールでログを確認。
正常に起動していると以下のようなログが最後に出る。

Red Pitaya GNU/Linux/Ecosystem version 0.92-378

redpitaya>

しかし、以下のようなログを確認すると



red pitaya /opt/etc/init.d/rcS not found.

と表示されています。
これは、SDカード内の"etc"以下すべてのファイルが見つけられていないということだということです。しかし、SDカード内には存在するため、SDカード自体の問題だと考えられます。
SDカードの問題は以下が考えられます
・SDカードの破損                    ・・・    PCにつないだ際認識される。
・SDカードの容量が大きすぎる   ・・・    32GB以下なので問題なし。
・FAT32でない                        ・・・    確認済み。
・SDカードの速度に問題            ・・・    Class4

速度に関して問題があると思われるのでSDカードをClass10に変更してみる。
KIOXIAのSDHCを利用します。


SDカードを交換して、シリアルコンソールでログを確認。
正常に起動していることが確認できた。


この理由はSDカードの動作が遅いため、マウントされていないと考えられます。そのためClass4では動作しなかったがClass10で動作しました。Class4を利用して、エラーが出た際、Class10に交換してみると動作するかもしれないです。
また、RedPitaya セットアップ レビューでのエラーも同様のことが起きていたと思われます。