北東北 LabVIEWユーザー会

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

LabVIEW G-code Sender

Abstract
In this article, I will show you how to control inexpensive CNC milling cutter with LabVIEW to make it as a measuring fixture.
For devices that perform 3 axis control such as CNC milling machine, laser processing machine, 3D printer, etc., firmware operating with G-code called Grbl is widely used. By sending the G - code from LabVIEW to the 3 - axis control device, measurement can be easily made by measuring at appropriate timing. Since Grbl operates on Arduino board (UNO, Nano etc.) using Atmega 328p chip, it can also be used for original measurement fixture and so on.

 

 

要約

安価なCNCフライスをLabVIEWで制御して測定治具にしたてる方法を紹介します。

CNCフライスやレーザー加工機、3Dプリンターなど3軸制御を行う装置ではGrblというG-codeで動作するファームウェアが広く使われています。LabVIEWからG-codeを3軸制御機器に送り、適切なタイミングで測定を行うことで容易に測定治具とすることができます。GrblはAtmega328pチップを使用したArduinoボード(UNOやNanoなど)で動作するため独自の測定治具などにも活用することができます。

 

作成中

(2017.10.06)

メッセージ1/11
8,900件の閲覧回数

----- 時間が経つと編集できなくなるようで ----

手直し中ですが、フロントパネルとダイアグラムの概要を載せます。

lvGS12p.pnglvGS12d.png

 

G-codeについて

G-codeは3軸から6軸のマシン二ングセンターの駆動に使用される数値制御用プログラム言語です。ただし、各社で独自のコマンドが導入されて標準があって無きがごとくなっているようです。NISTのG-code標準書「The NIST RS274NGC Interpreter」は古くなり、「LinuxCNC」が頼りになるとか、、。


コマンドとパラメータを行単位で記述して機械の動作を指示します。
(例)
「G1 X30.0 Y10.0 F250;」
250という速度(F250)で、XY座標の(30.0, 10.0)まで直線的に移動(G1)する。
mmやinchなどの単位系や絶対座標あるいは相対座標などの座標系は事前に指示されているものが使われます。

 

<<< CNCは全くの素人なので間違いがあると思います >>>

 

G-code制御のCNCフライスキット

$220で購入できるCNCフライス組み立てキットではGrblという制御用ファームウェアでG-codeを受けてステッピングモーターのパルスと主軸用PWMを生成します。

PA030006 2.JPGPA030001 2.JPGPA030004 2.JPGPA030005 2.JPG

 

Grbl

GrblはオープンソースのCNC制御ファームウェアでAtmega328pチップを使うArduinoボードで動作します。3軸のステッピングモータにパルスと方向を出力し、フライス用モーターの回転数をPWMで制御できます。

 

Arduino UNOを使用した場合にピンに割り当てられた機能を示します。

D2/D5:X軸Step Pulse / X軸Direction
D3/D6:Y軸Step Pulse / Y軸Direction
D4/D7:Z軸Step Pulse / Z軸Direction
D8:Stepper Enable/Disable
D9:X軸Limit SW
D10:Y軸Limit SW
D11:主軸PWM
D12:Z軸Limit SW
D13:主軸回転Direction

A0:Reset/Abort (DI Pullup)
A1:Feed hold (DI Pullup)
A2:Cycle Start/Resume (DI Pullup)
A3:Coolant Enable
A4:(NotUsed/Reserved)
A5:Probe

 

 

ArduinoにGrblを書き込むのはライブラリを追加してサンプルフォルダにある「grblUpload.ino」を書き込むだけでOKです。また、G-codeファイルは、[直線移動]、[停止]、[原点に戻る]、[速度を指定する]程度なら簡単に書くことができます。したがって、LabVIEWでG-code Senderプログラムを書けば、移動と計測処理のインテグレーションが容易です。

 

計測治具の制御ファームウェアにArduinoとGrblを使って、LabVIEWで制御したら簡単で便利です。

 

>>>>後日VIをアップします。

また、NIDays2017のユーザー会で話をする予定です。

(2017.10.06)

後で編集できなくなるのは辛いな、、、。

メッセージ2/11
8,887件の閲覧回数

LabVIEW G-code SenderのVIを添付します。LabVIEW2014以降で動作します。

3番目のループの測定ルーチンはダミーですので適宜改造してください。G-codeファイル「demo_measure_6points.lvgs」はテキストファイルですのでエディターで開くことができます。

lvGS_diagram.jpg

メッセージ3/11
8,838件の閲覧回数

NIDays2017のユーザー会コーナーでは、多くの方に興味を持って話を聞いていただけました。Demoではパルスモーターは動作しておりましたが、スライドテーブルが跳ねて予定通りの動作ができず残念でした。

 

機会があればLabVIEWによるG-code Senderのコンセプトをご検討ください。

参考になる部分もあるかと思いますので当日のプレゼン資料をアップします。

疑問、質問があれば分かる範囲で対応しますので、以下に連絡ください。

ohashi(アットマーク)mac.email.ne.jp

 

(2017.10.29)

メッセージ4/11
8,685件の閲覧回数

Thank you a lot for your nice code. I am working on setting up an arduino controlled CNC Laser Printer as a self-learning project for students and it would have taken me forever to find the correct handshake for the GRBL on the Arduino myself.

 

I had to include two minor changes in regard to reading and producing position strings. Because, sadly, we are using another delimiter in Germany and LabView is sometimes using the system setting (comma instead of period). 

 

1. In the WaitFirstRes.vi the last "format string"-argument for the "scan from string"-function needed changing from "%f,%f,%f]" to "%.;%f,%f,%f]". The additional first command defines the period as delimiter. Otherwise it gave an error on my German system.

2. In the move.vi the "number to fractional string"-function needed an additional False constant for the "use system delimiter"-argument. Otherwise it produced wrong commands like "G91G0X-1,00" with a comma instead of period delimiter on my German system.

 

I invite you to add these points to your code if you share it further (which it deserves!). the additions should change nothing for period-countries. But there are even more countries which use a comma delimiter.

 

0 件の賞賛
メッセージ5/11
7,780件の閲覧回数

BaZi,

Thank you for finding and utilizing the program I posted though it is an article in Japanese.

Would you please submit subVIs you modified here if possible? I think that it will surely be possible for LabVIEW users in many countries to try it.

0 件の賞賛
メッセージ6/11
7,767件の閲覧回数

Look at my driver that i developed. I think it helps to implement any controller that respect the standard RGBL v 1.1.

 

https://lavag.org/files/file/303-rgbl-11/

 

メッセージ7/11
7,044件の閲覧回数

Hello,
Thank you for sharing the GRBL drivers. I regret that I do not have the opportunity to use GRBL soon, but I was deeply moved because the diagram was drawn very beautifully. If possible, I think that Maker who uses the home version will be delighted if it can be downloaded also in LabVIEW 2014 version.

 

GRBL.png

0 件の賞賛
メッセージ8/11
7,036件の閲覧回数

I am agree with you, but since I do not have 2014, i cannot validate the result after save.

I do have a license for 2011 somewhere... I'll to do it.

Benoit

0 件の賞賛
メッセージ9/11
7,031件の閲覧回数

Hello, can you please send me your Gcode sender?

mallorquin2696@gmail.com

Thank you!

0 件の賞賛
メッセージ10/11
5,857件の閲覧回数