Home › Forums › TinyG › TinyG Support › X axis travels ~10 times more than it should
Tagged: firmware, Parameters, spindle
- This topic has 15 replies, 4 voices, and was last updated 6 years, 10 months ago by Zootalaws.
-
AuthorPosts
-
January 5, 2018 at 11:09 am #10725tjkullmanMember
Carl M. has been helping me with this issue. I needed to move to the forum so I could post my Parameters and get some extra eyes on the issue.
In a nutshell here is whats going on:
“My issue now is when I move my X axis, it travels ~10” when I tell it to travel 1”… (the distance is consistent though, and if I change the tr for the x axis from 2.0050” to 20.050” it acts normal…. but it is not right)”
This all happened after wiring up my new spindle and trying to utilize the “SPIN” pin to turn the spindle on/off.Carl recommended:
“What you could try is to start up tinyG, and from a console interface send $defa=1.
This will reinstall all EEPROM parameters to their FW defaults, and you will have to re-enter all your parameters.”
I did so and I also used the Firmware GUI to update to the latest Firmware and I am still experiencing the same symptoms.So I am here now with my parameters:
https://www.dropbox.com/s/uwd6hlwvgz3objb/TinyG_Settings.txt?dl=0Carl, If you want I can post our emails so that it might illuminate the situation for other viewers?
Thanks,
Thomas KullmanJanuary 6, 2018 at 4:35 am #10727ZootalawsMemberYou haven’t given us any information regarding your X-axis – belt or screw, if belt, what pitch/gear, if screw, what pitch/travel (i.e. 2mm belt, 12mm screw, etc.). Without knowing your transport its hard to work out.
Movement is a function of step angles, pitch of transport and stepping.
So, the calculation is:
a step angle of .9 degrees – 400 steps/rotation
8 micro steps per step – 3200 micro steps/rotation
a full rotation travel of 2.0050 requiring 3200 micro steps to complete.For my Z-axis:
1 step at 1.8deg on an 8mm/rotation screw (2mm pitch) is going to travel 0.04mm
1 microstep is 1/8 of that or 0.005mm
1600 Microsteps per rotation to move 8mm.So my screw is, at best, accurate to .005mm
For my X-axis I have GT2-3 belt on a 20-tooth pulley
One rotation of the motor pulls 20 teeth through at a pitch of 3mm for a travel/rotation of 60mm or 2.36″
One step gaining .3mm (200step/rotation)
One microstep gains .0375mm (1600step/rotation).You have (pardon my reluctance to work in base 12) 50.9mm gain per revolution on a .9deg/step motor with 8 micro steps/step.
That works out to:
1 step gaining 50.9mm/400 or 0.1275mm/step
1 microstep gaining 0.016mmSo, your step moves 0.1275mm, my step moves 0.3mm, as you would expect with your double-resolution stepper.
I would set my TinyG to:
[1ma] m1 map to axis 0 [0=X,1=Y,2=Z…]
[1sa] m1 step angle 1.800 deg
[1tr] m1 travel per revolution 60.0000 mm
[1mi] m1 microsteps 8 [1,2,4,8]
[1po] m1 polarity 0 [0=normal,1=reverse]Yours is set to:
[1ma] m1 map to axis 0 [0=X,1=Y,2=Z…]
[1sa] m1 step angle 0.900 deg
[1tr] m1 travel per revolution 2.0050 in
[1mi] m1 microsteps 8 [1,2,4,8]
[1po] m1 polarity 0 [0=normal,1=reverse]Can’t see anything wrong with that.
I did notice your power is set to ‘always on’, where mine is set to ‘in cycle’.
You also didn’t say what happened when you didn’t use the ‘spin’ pin. Does it all work normally?
So – as you have reloaded the latest firmware, we can rule that out – the areas to look at are your basis for calculations: What drive system at what resolution are you using? What are your exact stepper motor models?
More info would help.
January 6, 2018 at 7:53 am #10731cmcgrath5035ModeratorWhat Zootalaws does not see on this thread that was on prior thread is that, the way I read your info, the machine was moving properly with these settings. Perhaps I jumped to that conclusion prematurely.
From you initial thread, and the flashing re leds, it sounded like you have shorted or somehow electrically corrupted the EEPROM or possibly flash.
Here is Thomas’ most recent emailSo I was just able to take some time and play with this. I was able to get the $$ command to work right from the start. (It could be that the other times I tried to use it was after using the TinyG for a while and I overloaded the communication . Not sure…)
I did the recommended :$defa=1, and it did reset to defaults; however it was not successful. M1 still over travels. I did download the firmware GUI from the website and I was able to load in the latest firmware, same result. When I did this, none of my parameters changed. The firmware number was the exact same as what I had loaded on my board so maybe it didn’t actually load because it realized it was already up to date?
I will upload my parameters like you suggested: “If issues continue, copy your full parameter set ($$) to a cloud drive and post a URL for viewing in a new Forum item at …” as soon as I get to my computer this morning.Quick question about how I hooked up my spindle on/off:
I wired from the “SPIN” pin, out to the spindle power supply on/off switch, and back to a “GND” pin on the TinyG. I know this was wrong because of what happened, but should I have wired to “3.3v” instead of “GND”? OR should I have used a relay? I found very little explaining how that pin functions. I did measure the spindle power supply switch prior to hooking up and it measure 0v across as well as to ground so I don’t believe I supplied an outside voltage to the “SPIN” pin.From you extended description, I still have to worry about electrical damage.
The SPIN lead is a 3.3v logic signal from the controller. It “might” be able to turn an opto-isolator switch on and off, but for sure can source or sink much power. I have not see an opto-isolator controlled Spindle Power Supply, but they for sure could exist. Perhaps just post a Model number or easier, a URL to where you bought it.Can I assume you have seen the tinyG wiki at https://github.com/synthetos/TinyG/wiki ?
To summarize, as said above SPIN is logic on(high) off(low)
SPWM is 3v logic PWM interface to variable speed controllers.
Spindle control is via Gcode M3 and M5 commands.Can we assume that you manually loaded the parameters you provided?
They are somewhat unusual.
I see very few folks with $_sa=0.9 degree motors, but they do exist.
Depending on which FW loader you used I think it would be clear if your FW re-install did not work.
All that said, I would expect the FW version to be the same (440.20) and if you do not see changes in the parameters, that implies we are looking at the default parameter set. But I don’t think the defaults have $_sa=0.9, so I am curious.When you come back, please comment on your parameters and where they come from. Are you following a guide for a particular machine?
What are you using to interface to tinyG? PC, MAC, etc
Using CoolTerm or perhaps Chilipeppr or other?
Also, provide more info on wiring SPIN to your power supply control.
What you report implies reasonable functionality, communications wise, which seems to rule out SPIN having experienced a 120V AC event, which I would expect to be rather catastrophic.January 6, 2018 at 8:11 am #10732cmcgrath5035ModeratorAh so, I missed this:
here is the Spindle Thomas has
I have not seen that setup before, appears to be a 500W supply with built in output controller.
You need to get the wiring info, as it is unclear how the switch interface works
Question:
Is there a wiring diagram for the power supply?
Answer:
the product photos on this page include a picture of the wiring diagram.
By iskum kloshe on March 18, 2017
Yes, we have, pls contact us by bigbangamazon@yahoo.com this email, we will send it to you, thanks.
By MySweety SELLER on January 9, 2017
Collapse all answersBe aware that Mach4/Mach4 use different control interface than tinyG, so some fiddling or relays (opto-isolators) may be required.
January 6, 2018 at 9:21 am #10733ZootalawsMemberThomas/Carl,
Oops. Yeah. Wiring cock-up, by the looks.
You’ve got a 110VDC power on/off switch running through a 3.3V Tiny – might be toast. Might be lucky and it’s only that pin that’s toast, in which case you can play with the source and get another pin to do the same function, or use a different function that controls a logic pin – like the ‘cool’ pin.
The SPIN function is a logic switch, meant to be wired to a device that supports logic – 3.3, 5, 12v, it doesn’t matter as it’s the other end that has to see the rise in the level to determine the change of state. I often send a 3.3V logic to a 5V receiver – such as an Arduino. It’s input at the 5V end, so as long as the V rises enough from the Tiny to trigger the logic, all good. Doing it the other way round, not good.
That ‘controller’ is a transformer from 110vAC to 110VDC but they have built in a PWM speed controller. The ‘speed controller’ is a potentiometer, it can be wired to a Mach3 controller, and the TinyG!
You can achieve what you want.
Check the speed controller pins for voltage = it shouldn’t have any (you never know with these Chinese boards… I’ve seen all sorts). PWM needs to have a signal, ground and +xV. If the signal is happy with ~3V, you’re good to go. if not, you will need to shift it to use the PWM on the TinyG. You will also need to provide it with voltage and ground
However, the Tiny is a fragile little beast and I would use voltage and level shifters, as well as a diode to absorb any spikes. It’s a small amount of money compared to replacing the TinyG.
I use cheap adjustable voltage levellers. You can get them from Sparkfun or Ebay for cents. I also use signal level shifters, again from Sparkfun or EBay.
At the least to control the spindle power on/off you need a relay that can handle NO current of whatever amps that thing draws – and triggers with a small DC voltage (<5V) – you may get a car relay to trigger that low…
Personally, I would look at something like this rather than that ‘speed controller’ which you have no idea of the pedigree: https://www.inventables.com/technologies/spindle-speed-controller
And read this: http://blog.inventables.com/2014/06/shapeoko-upgrade-quite-cut-spindle-with.html
As to power relays, I’ve literally just set one up on the TinyG to control my AC Kress 1050. I used one from WeMos, designed for their 3.3V ESP8266. I use it in NO mode. It’s already set up to receive a 3.3V logic signal.
https://wiki.wemos.cc/products:d1_mini_shields:relay_shield
I’m on 220V, but it can handle NO (Normally Open – it’s powered-off state. In NO mode, when power to the relay goes off, the relayed power connection is broken. In NC – normally closed – mode, when the relay power goes away, the relayed power switches on – used in some situations, not in CNC.) current of 5A(250VAC/30VDC), 10A(125VAC), MAX:1250VA/150W – I guess it depends what side of the transformer the power switch is on. The spindle is rated to 500W at 110VDC. If that transformer is pulling more than 5A AC I’d be surprised, but I know nothing of your North American wiring standards. 10A is the max here in 220V land, but that gives you a heck of a powerful device on the end – like a 3500W heater or 2500W electric hammer 🙂
If you’re not sure, give me more info and I can work something up. It’s a bit like working in the dark here…
January 6, 2018 at 10:19 pm #10739tjkullmanMemberAll,
I appreciate the responses, and I apologize for not responding sooner. (Had to work 😛 )
To start off My CNC is 100% custom. I built it with scrap 80/20 and old stepper motors from salvaged printers…. I have since purchased new .9 degree steppers motors, the spindle and a Raspberry Pi hosting the CNCjs webpage.
Prior to the spindle I was using an old dremel tool with good success. Everything was working normally.Here is a copy of my original email to Carl explaining my problem:
“Hello, First off I want to thank you for putting out a fantastic product. It has performed extremely well. I did not see any open topics with this same issue, so that is why I am contacting you here. Up until now I have had no issues with my tinyg board, in fact I love it! I recently purchased a spindle and for now I am using the Potentiometer that it came with for my speed control, I did attempt to use the “Spin” pin and “Gnd” pin as my spindle on/off control. When I powered up the board though the board locked up and flashed a red light a couple times. I removed that wiring and now control the spindle completely independently from the TinyG board. My issue now is when I move my X axis, it travels ~10” when I tell it to travel 1”… (the distance is consistent though, and if I change the tr for the x axis from 2.0050” to 20.050” it acts normal…. but it is not right) I connected the same motor to a different axis and changed the settings for my tr and it acts normal leading me to believe it is something in the controller board. I have double checked my wiring and everything looks good. I am not sure what to do next (maybe update the firmware?) Please advise what I should do next. Thank you in advance Sincerely, Thomas Kullman”Things I have tried:
-I reinstalled the EEPROM defaults using $defa=1.
-Re-installing the firmware using the Firmware GUI found here: https://github.com/synthetos/TinyG/wiki/TinyG-TG-Updater-App
-I then tried re-flashing the TinyG using Avrdude and the .hex fileUnfortunately none of these fixed the issue, so I decided to verify if the issue was reliably consistent and I wired up an old stepper motor and after several hours of manipulating my setting I came to the conclusion that my travel per revolution is actually exactly 8 times what it should be (if I tell the motor to move 1″ it moves exactly 8″ every time.) So I changed my $1tr from 2.005″ to 16.04″. I ran some gcode to test the machine and everything worked perfectly.
I am okay with this outcome for now, but slightly baffled as to what happened and why restoring the EEPROM parameters to default and re-installing the firmware did not fix it….
Concerning the spindle and power supply I did measure the voltage across the Spindle On/Off terminals as well as to ground and it reads 0 volts. I believe what shorted the TinyG board was the way I wired it. I wired from the TinyG “SPIN” pin to one side of the power supply On/Off switch then out and back to the “GND” pin on the TinyG…. I realize in retrospect that this was foolish because it probably created a short, but I was not sure how to wire it.
Hopefully this helps explain my situation a little better, and like I said i have it working for the time being and will continue using this setup if we cant figure out a solution. BTW if you do want any pictures and/or details on my pulleys, belts, motors etc. I can provide that.
Thank you all for your help.
Sincerly,
Thomas KullmanJanuary 7, 2018 at 12:05 am #10740ZootalawsMemberThe fact that it’s exactly 8x the distance may point to a ‘stuck’ bit. Maybe it could be resurrected using some of the AVR tools that check and diagnose every location in the chip and memory? Atmel Studio is the main tool for AVR-based systems.
The chip used in my V8 board is the ATxmega 192A3-AU
https://www.microchip.com/avr-support/atmel-studio-7
Setting up Atmel Studio for the TinyG: https://github.com/synthetos/TinyG/wiki/Project-Setup-For-Atmel-Studio6.2
This is the full test program for the V8 boards – you can run through it yourself at home – it is very detailed: https://github.com/synthetos/TinyG/wiki/TinyGv8-Production-Test-Instructions-for-Revision-2-Tester
Without knowing how the speed controller/PSU is constructed, it’s hard to know how it works – a momentary switch triggering another switch circuit within the controller, a power junction that feeds all of the power between the poles…that you have to keep the link connected shows it’s not a momentary switch (like in a PC PSU).
I’ve found the same unit on multiple sites in China, but there’s little information on the spec of switch needed. If you have anything with a switch rating, that will help. If it’s rated at amps, all the power goes through it, but you said there was zero volts between the poles, which lends itself to being a low-power link to indicate power should be allowed to flow inside the controller. The size of the cable they used as a shunt was what led me to believe it was just a link in the power path.
And lastly, it might be a problem with the TI DRV8818 on your X-Axis. Have you tried moving that motor to a different axis? You can buy a cheap polulu-type driver for a 3D printer (or pinch one off a GRBL board for testing) and wire it as an external driver before going down the route of testing every memory location and processor function. That would be my second step, after using a different axis for testing (use Z axis and leave your Z disconnected during the test).
Good luck.
January 7, 2018 at 1:11 am #10743ZootalawsMemberHere is my relay to run my spindle. The 3.3V provided by the TinyG is fine for the job and M03/M05 works perfectly:
https://www.dropbox.com/s/rh7dr2xnpo6ebis/relay-tinyg.jpg
Another thing I thought of, Thomas: as you are using a Raspberry Pi already, rather than using the TinyG js page, you might want to have a look at Chilipeppr: http://chilipeppr.com/tinyg
Nothing wrong with the JavaScript page, but chilipeppr is a few technology leaps up the chain.
- This reply was modified 6 years, 10 months ago by Zootalaws.
January 7, 2018 at 4:22 am #10745tjkullmanMemberI will look into the Atmel Studio. I didn’t realize there were those tools available.
I have looked at Chilipeppr, but where I have my cnc setup there is no internet connectivity. There is a offline Chilipeppr, but I had little success getting it to work. That is why I use CNCjs. Honestly, I am pretty surprised at how well it has functioned.
I did wire up my motor to M2 to troubleshoot and the problem stayed with the M1 port. I use M1 for X, M2 & M3 for Y and M4 for Z. I did consider abandoning the M1 port and moving to M2 and having M3 handle both Y motors. I will try the Atmel Studio first before resorting to that.
Concerning the spindle, I do have a relay that has a 3.3v – 5v coil that will work nicely. I will use that.
Yesterday Carl asked:
When you come back, please comment on your parameters and where they come from. Are you following a guide for a particular machine?
What are you using to interface to tinyG? PC, MAC, etc
Using CoolTerm or perhaps Chilipeppr or other?
Also, provide more info on wiring SPIN to your power supply control.
What you report implies reasonable functionality, communications wise, which seems to rule out SPIN having experienced a 120V AC event, which I would expect to be rather catastrophic.I have modeled my Cnc based on the OX Cnc: https://openbuilds.com/builds/openbuilds-ox-cnc-machine.341/
The parameters I came up with on my own by experimenting. I am sure they could use some adjusting/fine tuning, but they have been working nicely so I left them alone. I use a Windows 10 laptop and up until recently I have been using the USB straight into the laptop. Software wise I use CoolTerm to change parameters and test settings and/or jog, and CNCjs for my gcode. I have recently implemented a Raspberry Pi to host the CNCjs page and am very happy with the results. During all of this though I have gone to hard wired so I can use CoolTerm. Here is how I had the Spindle connected:
Concerning the spindle and power supply I did measure the voltage across the Spindle On/Off terminals as well as to ground and it reads 0 volts. I believe what shorted the TinyG board was the way I wired it. I wired from the TinyG “SPIN” pin to one side of the power supply On/Off switch then out and back to the “GND” pin on the TinyG…. I realize in retrospect that this was foolish because it probably created a short, but I was not sure how to wire it.I will look into the Atmel Studio and wiring up the relay as I get time today. I have to work again, but I will try to check back here periodically.
Thanks again guys,
Thomas Kullman
January 7, 2018 at 8:44 am #10746cmcgrath5035ModeratorThese are some random thoughts.
Relay – Make sure that any relay coil you connect has a flyback diode included. Most relays intended for logic applications do – otherwise the port pin plays flyback and often the reverse bias results in death.
Power supply switch teads- It would be informative to know what voltage you measure on the two leads when the shorting wire is removed. I’ll guess one is GND, since you measure 0 volts, but the other could be Line in (120/240) AC, or something DC, if there is some sort of standby that is always on.
8 – When I see the number 8, I immediately wonder if microstepping is not working but tinyG calculations assume that it is. Microstepping is communicated between the ATxmega and the Driver device by two port pins. Perhaps those two port pins fried ? All the tinyGV8 schematic pages are here https://github.com/synthetos/TinyG/tree/master/hardware/v8schematics/v8h
Atmel Studio – I defer to Zootalaws, I have never used it. My impression was/is that useful debugging at this level might require an AtmelICE in addition to the working (running) tinyG
GND – Be a bit cautious assuming that all Power supply grounds are the same potential. I have to assume that the relatively compact 500W spindle supply is a buck converter(transformerless). I’ll guess that your tinyG and Stepper supply is also a buck supply, most are. Exercise caution (e.g. use relay or opto-isolator) to keep tinyG GND and Logic isolated from other power supplies.
FW Upgrade – https://github.com/synthetos/TinyG/wiki/TinyG-TG-Updater-App works sometimes, not others. Most all the various updaters end up calling a local copy of AVRDUDE. My read of the thread overall says that you knowingly had, before this spindle event, customized your parameter set to work your unique machine, and that all moved and worked as you expected.
If either $defa=1 or a FW reload was successful, then your parameter set would have returned to the defaults and you would have to reload you unique set.
It is not clear to me that you had to reload you parameters.Parameter set – What triggered me to ask was seeing
[1tr] m1 travel per revolution 2.0050 in but
[2tr] m2 travel per revolution 2.3575 in as well as [3tr].
It is unusual, but clearly possible, for the X and Y drivetrains to be different.
Also, $1tr = 50.927 is a unique (unusual) number in this space, but easily explained when you say your are cannibalizing old gearUnits – Are you using inch, rather than mm, for a specific reason?
If not, I suggest you convert to mm. tinyG uses mm in native calculations. Some Gcode generated in inch does not work, related, I think, to loss of precision in multiple mm to inch to mm conversions done on the 8bit
ATxmega.- This reply was modified 6 years, 10 months ago by cmcgrath5035.
January 7, 2018 at 10:10 am #10749tjkullmanMemberUnits- Hmm. After reading the very last paragraph it shed some light on the tendency for the TinyG to revert to MM. I use Inches because it is what I am familiar with, thats all.
Parameters-My Y pullys are these:http://makerstore.cc/product/gt2-2mm-aluminum-timing-pulley-30/
And this is the belt I am using: http://makerstore.cc/product/gt2-2mm-timing-belt-per-meter/
My X axis is a part I pulled from an old printer. Here is a picture of it: https://www.dropbox.com/s/2i6f5hmbg22b5hb/X_Axis_Pully.jpg?dl=0
Hope this explains a little.Power Supply Switch Leads- I will verify here shortly, but I believe I measured 0V accross the leads as well as 0V to Ground on both sides when I called for the M3 command. I will double check though.
Will let you know here shortly,
Thomas KullmanJanuary 7, 2018 at 12:11 pm #10750cmcgrath5035ModeratorThanks for the links. Most Ox builders use a 30 tooth 2 mm pitch system, $_tr=60mm, so that is what I am familiar seeing.
But obviously this work too.
Interesting stuff in makerstore.ccX axis confirms what I suspected.
I’ll wait to hear on the switch leads.
I suppose it could be an opto-isolator, with perhaps one end grounded.
Or, a really I suppose.
But that would require an active “switch”.January 7, 2018 at 2:29 pm #10752tjkullmanMemberWell I feel silly….
I double checked the Spindle Power Supply switch pins and they do in fact have ~ 80 volts to ground and 25ish volts across them…..
I don’t know how to make the embarrassed emoji, but if I did I would be using it right now. I don’t know how I messed that up (maybe I had my Multimeter in Amps not Volts??)Embarrassment aside, I double checked the “SPIN” pin and after using the M3 command it remains at 0V (it never changes state) The “SDIR” and “COOL” Pins do change state and provide a 3V signal.
I believe I must have burned something out on the board and will just have to suck it up and buy a new one. I apologize for giving you guys the run-around, but I have learned a lot in the process. If you have any ideas about fixing the board I wouldn’t be apposed to trying. Otherwise, thank you both very much for all of your time and input.
Sincerely,
Thomas KullmanJanuary 7, 2018 at 4:00 pm #10753ril3yKeymasterHappens man.
January 7, 2018 at 5:41 pm #10756cmcgrath5035ModeratorI would go ahead and contact the spindle sellers at
contact us by bigbangamazon@yahoo.com this email
so you know what sort of switch or relay is need to control the Powersupply.
A relay such as Zootalaws has, perhaps an SSR, would likely do the trick.
Were you measuring AC or DC scale? The typical first stage of a buck converter is L1 and L2 into a full wave bridge. Perhaps you are measuring the rectified input. -
AuthorPosts
- You must be logged in to reply to this topic.