Closed axg20202 closed 4 months ago
I'm controlling my spindle using VFD and modbus (both enabled in firmware and working) instead of the spindle PMW/0-10v connections. Could this be the reason why the spindle enable pins on my board don't go high when the spindle is turned on?
Yes, because the ModBus controlled spindle uses commands rather than the PWM related spindle signals (PWM, enable and direction) for control. Some users are switching between the PWM spindle (typically a laser) and a VFD - this means I cannot just change the code to set the enable signal when the VFD is active. Either a compile time option or a plugin has to be added to "fix" this. I'll come back to this when I am back home.
Thanks Terje. Understood. If there is a tweak I can make at compile time to make the enable go high when I start the VFD, that would be ideal.
It should be pretty easy to make your VFD output a signal when the spindle is active and just use that. Many VFDs have an entire PLC built in for things like this.
Possibly, but I'd much prefer a firmware solution that uses no additional wiring and lets me use the vac controls on the BOB instead, which also has a header for a manual vac override switch for general cleanup without the VFD running.
It would be great to have the ability allow any number of relay outputs be controlled by M3/M5. Dust Collection is the current request but also air assist and exhaust for lasers and flood/mist for mills. I could see a grbl setting "Link to Spindle on/off" that would have bits for various outputs. 0 - Spindle (always set), 1 - Mist, 2 - Flood, 3 and up for digital outputs.
The suggestion to use VFD to control the DC is a good one short term fix though.
I'm currently using the vfd to trigger the spindle water cooling pump. Could get messy adding another thing to trigger. Could be doable I guess, but a line or two of of code to keep the spindle controls live along with the modbus would be better if possible.
It would be great to have the ability allow any number of relay outputs be controlled by M3/M5.
I think I'll try to add such an option to the fans plugin, will look into this soon. Sitting in AMS now on my way home, need a few days to get rid of jet lag and clear the issue backlog...
That makes sense.
Schiphol, as airports go, is pretty good. But then it is still an airport... Bon Voyage.
The fans plugin has now been extended with setting $483 for linking spindle enable to fan(s). If building the iMXRT1062 driver with a single VFD spindle enable and direction signals are repurposed as aux outputs allowing the use of the dust extraction pin via mapping (use $386 for fan 0). Note that if the fan is turned on manually (via M106 or the real time command) before the spindle is started it will not be turned off automatically when it is stopped.
I may allow the use of the spindle enable signal to switch the fan later for dual spindle machines - if I can make it safe...
Thanks for adding this feature. Alas, I don't think it solves my problem. I'm using the dust TTL signal outputs of the BOB to trigger the relay to switch on dust collection. These pins are linked to spindle enable. I also want to use the manual dust collection pins on the board, which when shorted by a physical switch, also make the dust TTL output go high. This works if not using MODBUS (but I am using MODBUS). Unfortunately, linking the fan Aux 0 to spindle enable looks as though it makes Aux 0 pins (and probably its associated TTL signal out) go high with spindle enable, but I really need it to make the dust TTL out go high. That way I can have a single point of connection for dust triggering, which can come on with the spindle OR if I throw the manual switch.
Assuming you are set up to build grblHAL, one approach would be to make spindle enable an aux output. I'm not sure how grblHAL knows the number of outputs. Is it as simple as adding
#define AUXOUTPUT3_PIN (12u) // AUX3
to T41U5XBB_map.h at line 102 (or so)?
Or, you could just changeAux0 to 12u in T41U5XBB_map.h like this?
#define AUXOUTPUT0_PIN (12u) // AUX0
You'd lose Aux0 as an Output, though.
Hi Phil. Yes, I'm compiling my own. My head is spinning tbh :-) I'm not understanding how the pin assignments for aux and enable relate to their physical outs, and also how the manual dust pins link to that. I don't get an enable signal using MODBUS, so thinking the above wouldn't work....but no idea.
If only one VFD spindle is selected for build spindle enable and spindle dir are remapped as aux outputs. Then fan 0 can be mapped to Aux3 (which is routed to the dust output if I am not mistaken) with $386
.
Use the $pins
command to see the active pin mappings.
$pins [PIN:14,Emergency stop] [PIN:16,Feed hold] [PIN:17,Cycle start] [PIN:15,Probe] [PIN:20,X limit min] [PIN:21,Y limit min] [PIN:23,Y limit min 2] [PIN:22,Z limit min] [PIN:36,Aux input 0,P0] [PIN:30,Aux input 1,P1] [PIN:34,Aux input 2,P2] [PIN:35,Aux input 3,P3] [PIN:2,X step] [PIN:4,Y step] [PIN:6,Z step] [PIN:8,Y2 step] [PIN:3,X dir] [PIN:5,Y dir] [PIN:7,Z dir] [PIN:9,Y2 dir] [PIN:10,X enable] [PIN:40,Y enable] [PIN:39,Z enable] [PIN:38,Y enable] [PIN:19,Flood] [PIN:18,Mist] [PIN:31,Aux out 0,Fan 0] [PIN:32,Aux out 1,P0] [PIN:33,Aux out 2,P1] [PIN:12,Aux out 3,P2] [PIN:11,Aux out 4,P3] [PIN:0,RX,Modbus] [PIN:1,TX,Modbus]
Pins above. I then changed fan 0 out to AUX 3, hit save, and did a hard reset. It sent the board back to 'unable to communicate'
Calling it a day today. Will revisit this tomorrow. Thanks for your help guys.
You probably need to go and reset your input inversions in grbl settings.
The manual DC header signal and the spindle enable signal (same one that goes to the En screw terminal) go to the inputs of an OR gate. The output of that gate goes high if either input is high. The output of that gate goes to the VAC/DC output headers.
In the map file (T41U5XBB_map.h) in src, you can change actual pin assignments. Spindle Enable is on the Teensy 4.1 pin 12. The 3 Aux outputs are on pins 31, 32 and 33. So, if you change one of those to 12 it will show up on the spindle en and VAC/DC outputs.
I have now added a checkbox for Add PWM spindle to the General tab in the Web Builder. If a VFD spindle is selected in the dropdown above and Add PWM spindle is left unchecked pin 12 (spindle enable) is remapped as Aux out 3 and pin 11 (spindle dir) as Aux out 4.
Mapping fan 0 to Aux out 3 and linking it to spindle enable (the internal signal, not the pin) with $483
(in the Spindle settings group in ioSender) works for me.
If Add PWM spindle is checked no remapping is done and the PWM spindle can still be used.
That's great! Thank you!
Brilliant! Is this relatively easy to accomplish when self-compiling too?
Is this relatively easy to accomplish when self-compiling too?
Yes, enable the VFD you want with uncommenting VFD_ENABLE
and set it to the appropriate id in _mymachine.h (do not set it to -1) and leave N_SPINDLE
at 1 in grbl/config.h.
Great. Thanks very much for your help with this.
Just to check, I just need to recompile with the above. Fans plugin not needed? I've just recompiled and the dust TTL out isn't going high with spindle start, and now it also doesn't go high when I close the manual switch either. I have updated the modified submodules. Essentially I want to check that your compile note above achieves the same as 'Add PWM spindle'. If so, doesn't appear to be working.
Fans plugin not needed?
Still needed, it provides the $-commands and the binding to the internal spindle enable signal.
Aha, thanks. Probably needs a conditional setting in the Web builder - I don't think ticking the add spindle box forces the fan plugin selection.
I don't think ticking the add spindle box forces the fan plugin selection.
Ticking the Add PWM spindle box enables the "normal" PWM signals even when a VFD is selected, and remapping to Aux outputs is not done. The fans plugin is enabled in the Plugins tab:
OK, got it. I think it just killed my Teensy. This was after compiling with add spindle ticked but no fans plugin. I am guessing that closing my manual dust switch sent 5v to it. Pretty miffed.
Hmmm, I don't see how that would kill your teensy. The VAC/DC header is actually powered via 3.3V.
Is it completely dead? If you try to talk to it via a terminal app does it do anything? Also, what happens when you press the button on the teensy? You should see programming lights go on briefly.
OK. Maybe it was a static jolt from taking it in and out of my enclosure. I guess they are quite sensitive to esd. Looks pretty dead. Doesn't get picked up on usb, and no red led. Pressing or holding button does nothing. doesn't work in the BOB.
Ugh. Sorry to hear that. It sucks. I've blown several Teensies. Learned the hard way they don't like 12V or getting shorted out.
New Teensy shoved in with the new firmware. Fan checkbox ticks on and off with Spindle on/off. TTL out for dust collection still isn't going high though. Is there another grbl setting I need to make to link things up?
$386
is set to map Fan 0 to pin 12? Check with $pins
command.
[PIN:36,Aux input 0,P0] [PIN:30,Aux input 1,P1] [PIN:34,Aux input 2,P2] [PIN:35,Aux input 3,P3] [PIN:2,X step] [PIN:4,Y step] [PIN:6,Z step] [PIN:8,Y2 step] [PIN:3,X dir] [PIN:5,Y dir] [PIN:7,Z dir] [PIN:9,Y2 dir] [PIN:10,X enable] [PIN:40,Y enable] [PIN:39,Z enable] [PIN:38,Y enable] [PIN:19,Flood] [PIN:18,Mist] [PIN:31,Aux out 0,Fan 0] [PIN:32,Aux out 1,P0] [PIN:33,Aux out 2,P1] [PIN:12,Aux out 3,P2] [PIN:11,Aux out 4,P3] [PIN:0,RX,Modbus] [PIN:1,TX,Modbus]
[PIN:31,Aux out 0,Fan 0]
This is incorrect, map it to Pin12 with $386=3
Thanks Terje. I just made the change with hard reset. Still not working unfortunately.
[PIN:14,Emergency stop] [PIN:16,Feed hold] [PIN:17,Cycle start] [PIN:15,Probe] [PIN:20,X limit min] [PIN:21,Y limit min] [PIN:23,Y limit min 2] [PIN:22,Z limit min] [PIN:36,Aux input 0,P0] [PIN:30,Aux input 1,P1] [PIN:34,Aux input 2,P2] [PIN:35,Aux input 3,P3] [PIN:2,X step] [PIN:4,Y step] [PIN:6,Z step] [PIN:8,Y2 step] [PIN:3,X dir] [PIN:5,Y dir] [PIN:7,Z dir] [PIN:9,Y2 dir] [PIN:10,X enable] [PIN:40,Y enable] [PIN:39,Z enable] [PIN:38,Y enable] [PIN:19,Flood] [PIN:18,Mist] [PIN:31,Aux out 0,P0] [PIN:32,Aux out 1,P1] [PIN:33,Aux out 2,P2] [PIN:12,Aux out 3,Fan 0] [PIN:11,Aux out 4,P3] [PIN:0,RX,Modbus] [PIN:1,TX,Modbus]
I have just retested and it works for me. $483=1
(true), $386=3
.
If you use the VAC override switch does it still work?
And is the spindle enable signal working?
If you have a voltmeter carefully measure directly on pin 12 of the Teensy and the VAC pin on the relays header, do these change when you enable/disable the spindle or toggle the Fan checkbox?
OK, will do further testing. I'm really hoping that something on the BOB didn't get taken out when my Teensy died.
Following some testing, looks like spindle enable pins don't go high when spindle is turned on, and nothing goes to the vac TTL out either. Manual dust trigger doesn't cause vac TTL out to go high when switched either,
Just as an experiment, I tried the webbuilder firmware. Same result but different pin assignments.
[PIN:14,Emergency stop] [PIN:16,Feed hold] [PIN:17,Cycle start] [PIN:15,Probe] [PIN:20,X limit min] [PIN:21,Y limit min] [PIN:22,Z limit min] [PIN:36,Aux input 0,P0] [PIN:30,Aux input 1,P1] [PIN:34,Aux input 2,P2] [PIN:35,Aux input 3,P3] [PIN:2,X step] [PIN:4,Y step] [PIN:6,Z step] [PIN:8,Y2 step] [PIN:3,X dir] [PIN:5,Y dir] [PIN:7,Z dir] [PIN:9,Y2 dir] [PIN:10,X enable] [PIN:40,Y enable] [PIN:39,Z enable] [PIN:38,Y enable] [PIN:12,Spindle on] [PIN:11,Spindle direction] [PIN:19,Flood] [PIN:18,Mist] [PIN:31,Aux out 0,P0] [PIN:32,Aux out 1,P1] [PIN:33,Aux out 2,Fan 0] [PIN:0,RX,Modbus] [PIN:1,TX,Modbus] [PIN:13,Spindle PWM]
Just tested another TTL out (flood) and that's working.
Still no joy getting this working. Hopefully it's just a pin assignment that's tripping me up.
@phil-barrett Is there a fault condition that would damage only the vac/dc ttl output but leave the others working? I'm now wondering if this was taken out when my Teensy died. Closing the dust/vac manual trigger isn't making the vac TTL go high. I tried a different TTL out and that is working.
It is possible if vac output was shorted to ground at some point. Also, inspect the board around the area of IC16, IC17 and IC19.
If IC16 was damaged, that would prevent Vac from working at all.
Looking at the schematic, maybe my external relay board drew too much current from the TTL out? I wonder if I should use the relay screw termals on the BOB instead? The external relay board has separate 5v coil power and a HI/LOW trigger input, which was connected to the vac TTL out.
It's possible but those relay boards draw very little current - usually around 2 mA. Typically, they use a 2700 ohm input resistor.
Unfortunately, if the TTL driver is blown, the relay coil output is too because the relay driver takes it input from the TTL driver.
Can't see any damage anywhere on the board. So is replacing IC16 a likely candidate for a fix? I tested the screw terminals for Vac and they output about 1.7v at rest and jump up to 2v when the spindle is run. Back down to 1.7 when stopped. Not sure if that means much.
Maybe but if it was an output short, IC17 is probably the issue. You can determine if IC16 is bad by looking at the output on pin 4 while shorting the Vac control header. It should register something like 3.1-3.3 VDC.
If it doesn't, then it is bad. If you have soldering skill, you probably can replace it. But, I suspect the problem is IC17, 74ACHT541. You might want to verify that.
Rather than replacing IC17, you could just bodge to a different output pin, say aux1 (which is right next to vac) on IC17. First verify that aux1 works. See the picture below. Cut 2 wires (Vac and Aux1) and then connect IC16 output to the Aux1 input on IC17. Then you use aux1 in place of Vac.
Great. Thanks Phil. And sorry to you both for the million questions.
Not a problem. Let me know what you find.
With the board on the bench, powered by 5v terminals, no Teensy installed, I get 0v at the Y terminal of IC16 when the vac header is shorted. I assume I don't need the Teensy installed for this test. I also see 0v at the Vcc of IC16. The Y pin has a resistance of only 1.6 to ground. Was kind of expecting to see voltage at Vcc even if the IC is dead.
Hi. I have Phil B's breakout board for Teensy. On that board, the dust extraction trigger pins are linked to the spindle enable pins, so that gcode M3 turns on dust extraction. However, I'm controlling my spindle using VFD and modbus (both enabled in firmware and working) instead of the spindle PMW/0-10v connections. Could this be the reason why the spindle enable pins on my board don't go high when the spindle is turned on? I'm currently unable to trigger the dust extraction because of this. Phil recommended I ask here in case it's a firmware issue related to using modbus.