TinyG connection to SuperPID

Discussion of tinyG control platform
semperfikurt
Posts: 12
Joined: Wed Nov 05, 2014 3:08 pm

TinyG connection to SuperPID

Post by semperfikurt » Sun May 17, 2015 3:55 pm

I am working on connecting my Super PID to my TinyG to be able to control my router and turn it on and off through gcode and have had some mixed results. I wired it up through the PWM setup on the SuperPID instructions and can power it on and off through chilipeppr however, control is reversed: m5 turns the router on, and m3 turns it off. Also I have gotten the PWM input to work, but it does not quite handle the rpm's properly and results in some strange results, it's kind of all over the place really. I did find a couple of web pages that talked about how to set this up but I didn't really understand what I was reading (my understanding of the software side is mediocre, same for the electronics bit) and could really use some "low tech" help on a few issues I have been trying to sort out:

What is the best way to invert the power state of the spin pinout on the TinyG? (super pid "run" input wants the power off to turn the router on, the tinyg "spin" output turns power on to turn the router on)

Do I need to step up the 3.3V PWM signal to 5V in order for it to work properly as a PWM input to the superPID or can it stay at 3.3? As I said, I have gotten the RPM's to respond to gcode "s" commands, but not properly. Is the voltage a problem or is this a configuration issue?

What are the TinyG software configurations I should be using for this? (frequency and all that stuff) Will the standard shapeoko configs on the wiki page work?


If anyone has done this I could really use some help on how to best set everything up.

rtlflatt
Posts: 178
Joined: Sun Jan 18, 2015 2:11 am
Location: Bay Area, CA

Re: TinyG connection to SuperPID

Post by rtlflatt » Sun May 17, 2015 4:03 pm

there a grbl compile option for enable pin active high or low. default is enable high but superpid needs enable low

also you have to set the min/max rpms in compile options to work right.

u know how to change these settings in grbl and then reflash or u need to be walked thru?
Shapeoko 3 #??? (Missing serial plate?)
Lulzbot Taz 5 (Heavily modified)

semperfikurt
Posts: 12
Joined: Wed Nov 05, 2014 3:08 pm

Re: TinyG connection to SuperPID

Post by semperfikurt » Sun May 17, 2015 4:20 pm

I have messed around with the min/max rpm's and can handle that part. do they need to just be the rpm range for the superPID? (5k-30k)

the active high/low I definitely could use a walkthrough on though.

rtlflatt
Posts: 178
Joined: Sun Jan 18, 2015 2:11 am
Location: Bay Area, CA

Re: TinyG connection to SuperPID

Post by rtlflatt » Sun May 17, 2015 4:29 pm

match to your router min/max i have dwp611 and my settings are 8000-25000 i believe to make sure router cant run too slow to cool itself. altho i have tested 8000 to see if that a safe speed yet....

to invert enable pin...

1. download notepad++ or some other decent text editor.
2. not sure how tinyg is programmed.... do u flash grbl thru arduino ide?
since im using arduino ide my grbl settings file is in C:\Users\(username)\Documents\Arduino\libraries\grbl-master\grbl\config.h
3. open with notepad++
4. go down to line 164
#define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.

thats what my setting looks like
Shapeoko 3 #??? (Missing serial plate?)
Lulzbot Taz 5 (Heavily modified)

rtlflatt
Posts: 178
Joined: Sun Jan 18, 2015 2:11 am
Location: Bay Area, CA

Re: TinyG connection to SuperPID

Post by rtlflatt » Sun May 17, 2015 4:31 pm

on line 266 there also option to use spindle direction as spindle enable pin (when enabled) which is what i use
Shapeoko 3 #??? (Missing serial plate?)
Lulzbot Taz 5 (Heavily modified)

semperfikurt
Posts: 12
Joined: Wed Nov 05, 2014 3:08 pm

Re: TinyG connection to SuperPID

Post by semperfikurt » Mon May 18, 2015 5:06 am

I have only ever connected to my tinyg through chilipeppr and flashed the new binaries using the tinyg update app. I didn't have a config file like you are referring to in the library path, I downloaded one from the arduino website however, I haven't touched arduino IDE in a long long time, I don't know what any of this is.

I did find the lines you are referring to in the config file, and I changed mine to be the same as yours, and saved it.... so far so good.
now, how exactly do I update this new config to my board? Like I said, I haven't messed with this stuff hardly at all so I am pretty lost.

so I can still turn the router on and off, but aside from this, I can't control my speed at all, none of the S commands in chilipeppr are working. what pwm settings and such do I need for this? I have only ever gotten it to "sort-of" work with incorrect rpm's.

rtlflatt
Posts: 178
Joined: Sun Jan 18, 2015 2:11 am
Location: Bay Area, CA

Re: TinyG connection to SuperPID

Post by rtlflatt » Mon May 18, 2015 5:20 am

hmm... does tinyg even use grbl? settings im refering to are for grbl version 0.9i so if tinyg uses a modified version of grbl or something entirely different then idk. try manufacturers website for instructions or google it. sorry i figured tinyg used same software
Shapeoko 3 #??? (Missing serial plate?)
Lulzbot Taz 5 (Heavily modified)

cmcgrath5035
Posts: 61
Joined: Thu Oct 31, 2013 6:56 pm
Location: Florida, USA

Re: TinyG connection to SuperPID

Post by cmcgrath5035 » Mon May 18, 2015 2:12 pm

Interesting discussion, I am only vaguely familiar with SuperPID (looks neat though).
The thread is somewhat confusing.
You are asking about connection to TinyG, correct? Why all the GRBL discussion?
I found this document to be fairly clear: http://www.vhipe.com/product-private/Su ... ctions.pdf,
particularly pg 23, "PC speed control using PWM signal".
From what I see, tinyG PWM output, properly conditioned and calibrated, should work here.

Conditioned: tinyG outputs 3.3V logic, may or may not be adequate drive for your SuperPID, which specs 5V logic.
If I read correctly, SuperPID uses an optoIsolator input, so inadequate drive for the opto input is likely at 3.3V.
The text indicates that SuperPID will filter the input PWM signal to generate a DC control voltage (a typical implementation)

Calibrated: TinyG parameters $p1* control the tinyG PWM subsystem.
Here is a set of parameters I use for a DC 800W Spindle
[p1frq] pwm frequency 2500 Hz
[p1csl] pwm cw speed lo 5500 RPM
[p1csh] pwm cw speed hi 12000 RPM
[p1cpl] pwm cw phase lo 0.080 [0..1]
[p1cph] pwm cw phase hi 0.900 [0..1]
[p1wsl] pwm ccw speed lo 1000 RPM
[p1wsh] pwm ccw speed hi 2000 RPM
[p1wpl] pwm ccw phase lo 0.125 [0..1]
[p1wph] pwm ccw phase hi 0.200 [0..1]
[p1pof] pwm phase off 0.000 [0..1]

There is no reason to believe these are right for you, just an example.

Note that the default $p1pof = 0.1 on most FW builds, so PWM is 10% on when M5 executed. That is likely why you think the control is inverted.

Here is a set of notes I made for myself when setting up - perhaps helpful: https://dl.dropboxusercontent.com/u/502 ... st%201.doc
They should be informative, but by no means prescriptive, for your setup.

I suspect that buffering tinyG PWM output to 5V logic and calibration will have you up and running.
Good luck.
ShapeOko (V1) SN 1462
Dual 820mm Y, Double X, ACMEZ. V2 Motor Plates
TinyG V7 Controller; DUE and tinyGV9 test bed for tinyG2

rtlflatt
Posts: 178
Joined: Sun Jan 18, 2015 2:11 am
Location: Bay Area, CA

Re: TinyG connection to SuperPID

Post by rtlflatt » Mon May 18, 2015 5:08 pm

I mentioned grbl cuz I thought tinyg used it but then read that it was forked a while ago I guess and apparently different now
Shapeoko 3 #??? (Missing serial plate?)
Lulzbot Taz 5 (Heavily modified)

cmcgrath5035
Posts: 61
Joined: Thu Oct 31, 2013 6:56 pm
Location: Florida, USA

Re: TinyG connection to SuperPID

Post by cmcgrath5035 » Mon May 18, 2015 8:24 pm

Yes, tinyG forked from GRBL long ago.
I am not all that familiar with grbl, but believe PWM setup is different, so definitely look at tinyG wiki.

Perhaps most important, the Uno (running grbl) and most shields are 5V logic, where as tinyG is 3.3v logic.
Many older setup descriptions do not specify, as there was only 5V at the time.
Last edited by cmcgrath5035 on Tue May 19, 2015 1:34 am, edited 1 time in total.
ShapeOko (V1) SN 1462
Dual 820mm Y, Double X, ACMEZ. V2 Motor Plates
TinyG V7 Controller; DUE and tinyGV9 test bed for tinyG2

Post Reply