Use GRBL instead of TinyG

bobc
Posts: 22
Joined: Mon Feb 09, 2015 5:54 pm

Re: Use GRBL instead of TinyG

Post by bobc »

Software is mostly set up, but I realised I need some actual hardware to test with :)

My own design is still a pile of extrusions and some SCAD models which need a lot of work. I spent some time getting my 3D printer working nicely again in order to print new parts.

But that was all taking time, so as a backup, I decided to buy an eShapeoko, which is on pre-pre-order :) due to waiting for more Makerslide to be made. The eShapeoko looks like a nice machine, I will try it for P&P, if that doesn't work out could be useful for some light milling.

I then decided a quicker route to getting some motors turning was to fix up on old 3D printer and use it as bit of testbed. I am nearly there with that. It won't be practical for P&P, Z axis is too slow.

I am also writing some simple test software, normally I would use pronterface but it doesn't have JSON support (AFAIK, I didn't check). I want to do low level checks first before running the full Liteplacer software.

It's easy to see how "shave the yak" becomes an item on the TO DO list! :D

Anyway, I should have a clear run this weekend and it should all come together.
bobc
Posts: 22
Joined: Mon Feb 09, 2015 5:54 pm

Re: Use GRBL instead of TinyG

Post by bobc »

Yay! Finally got 3 axes working ok with Tinyg2, cheap Due clone from ebay, and a RAMPS-FD v2. I tried a RAMPS-FD v1 from ebay, I had some suspicions about it so I swapped the board.

I wrote some C# to do some basic commands to Tinyg2, I then realised that Liteplacer already has most of the same functions in the "Setup" tab. Anyway, it was a useful exercise to go through the learning curve with Tinyg and the JSON protocol.

The g2 firmware on Due seems to have some peculiarities !

I had to add some code in the Open() method:

Code: Select all

 Port.PortName = Com;
                Port.BaudRate = 115200;
                Port.Parity = Parity.None;
                Port.StopBits = StopBits.One;
                Port.DataBits = 8;
                Port.Handshake = Handshake.RequestToSend;

--->                Port.DtrEnable = true;
--->                Port.RtsEnable = true;

                Port.Open();
                if (Port.IsOpen)
                {
                    Port.DiscardOutBuffer();
                    Port.DiscardInBuffer();
                }
Otherwise the USB serial port hangs when data is written. It took me a while and hacking with my test program to work that out!

I applied that fix to Liteplacer. When I connect with Liteplacer I now get a message "TinyG Reset" and the following trace
Application Start
{"r":{"fv":0.970,"fb":75.02,"cv":5,"hp":3,"hv":0,"id":"02130215d40","msg":"SYSTEM READY"},"f":[1,0,0]}
"r":{"fv":0.970,"fb":75.02,"cv":5,"hp":3,"hv":0,"id":"02130215d40","msg":"SYSTEM READY"},"f":[1,0,0]}
==> {"sr":""}
###{"xjm":""} discarded, com not open (readyevent set)
And the state shows "Not connected".

There is some puzzling code in CNC.cs, when it sees "SYSTEM READY" it calls "Close()". g2 always sends that when the port is opened, so Liteplacer closes it again!

I've just started exploring the code, so forgive me if I have misunderstand anything. I guess though the behaviour of the g2 firmware is subtly different to the TinyG firmware.
JuKu
Site Admin
Posts: 1110
Joined: Thu Feb 14, 2013 3:06 pm
Location: Tampere, Finland
Contact:

Re: Use GRBL instead of TinyG

Post by JuKu »

Re: dtr, rts: These are hardware handshake settings. Neither of my computers need those, but they don't hurt. Maybe this is windows version dependent or g2 does this a bit or two differently.

> There is some puzzling code in CNC.cs, when it sees "SYSTEM READY" it calls "Close()". g2 always sends that when the port is opened, so Liteplacer closes it again!

With regular tinyG and LitePlacer, the idea is to turn power on, then start the program. After that, we don't expect a system reset, but want to stop if it happens for any reason. Since g2 sends the message on each connection, you need to wait for it in the open() and start talking only after receiving the message. (For example of how to wait, without hanging, noticing a timeout see how cnc communication is done, for example, have a look at CNC_Z_m() function in MainForm.cs.
dandumit
Posts: 8
Joined: Mon Feb 09, 2015 3:28 pm

Re: Use GRBL instead of TinyG

Post by dandumit »

bobc wrote:Yay! Finally got 3 axes working ok with Tinyg2, cheap Due clone from ebay, and a RAMPS-FD v2. I tried a RAMPS-FD v1 from ebay, I had some suspicions about it so I swapped the board.

I wrote some C# to do some basic commands to Tinyg2, I then realised that Liteplacer already has most of the same functions in the "Setup" tab. Anyway, it was a useful exercise to go through the learning curve with Tinyg and the JSON protocol.

The g2 firmware on Due seems to have some peculiarities !
....
I've just started exploring the code, so forgive me if I have misunderstand anything. I guess though the behaviour of the g2 firmware is subtly different to the TinyG firmware.


Hello Bobc,
I have bought myself also an Arduino Due and I woul like to test whole setup on my machine.
Could you please give some hints on how did you compiled TinyG for Due ? and what changes have you made on LitePlacer ?
Br,
Daniel
User avatar
dampfboot
Posts: 48
Joined: Tue Jul 28, 2015 5:51 pm
Location: Hannover, Germany
Contact:

Re: Use GRBL instead of TinyG

Post by dampfboot »

Any news about the Tinyg2 usage with Lite Placer?

Rainer
dandumit
Posts: 8
Joined: Mon Feb 09, 2015 3:28 pm

Re: Use GRBL instead of TinyG

Post by dandumit »

I intend to retrofit a Zeva 460 with LitePlacer.
Until now I have been waiting for other stepper drivers (original ones are expecting kind of quadrature input).

bobc it's more advanced than me.

I hope that next weeks to make some tests and I will let you know.

Daniel
User avatar
dampfboot
Posts: 48
Joined: Tue Jul 28, 2015 5:51 pm
Location: Hannover, Germany
Contact:

Re: Use GRBL instead of TinyG

Post by dampfboot »

Helo Daniel,

thanks for your quick answer! I am interested in the TinyG2 because of the easy availability of the Arduino DUE (clones). The TinyG board you have to order in the USA and pay a lot for freight and customs and additional to wait for shipping quite some time.

But I still think that the TinyG(1) is a great solution for people who want to build and use a p&p machine out of a kit from Juha! It has all you need on a single PCB - no soldering etc.

I want to convert my CNC mill to a p&p machine because I have no space for an extra system. My idea is to have a little table which can be placed on top of the mill table to convert it temporaily. For this I do not need the stepper drivers on the TinyG system because I want to use the already existing 48 Volt power supply and stepper driver system which is operated with MACH3 in the moment.

As you can read on the Synthetos page https://www.synthetos.com/ they think about promoting the G2 system more and more in the future. So it would be a good move for the LitePlacer to keep the door open for the G2!

Rainer
dandumit
Posts: 8
Joined: Mon Feb 09, 2015 3:28 pm

Re: Use GRBL instead of TinyG

Post by dandumit »

I have made today first test to connect on a G2 TinyG.
Unfortunately gives some errors.
bobc input would be very usefull...

DAniel
Post Reply