This one has me beat so far, I am not a programmer, so I am a bit in the dark about how to fix this issue.
I have flashed a nano with GRBL 1.1h and have a relay module connected to pin D13.
This relay module is to be used to switch the trigger on a CNC plasma cutter.
The problem I have is that the relay on startup will switch on and I have to manually switch it off with the UGCS program that is setup to switch D13 high and low using gcode M3 and M4 to switch off.
After the initial switching off, the relay works perfectly, but is a very dangerous situation when first starting up or resetting the system.
The relay module is an active low type.
Any help would be appreciated.
I am not sure exactly what you mean by this. Can you please provide more details and post the "GRBL 1.1h" file (is that really its name ?) here or if it is to big, post a link to it.
Part of the problem is that the ARduino initialises its pins so there is often a small/short start up.
There is no real way around that that I know of.
Also be aware that a spindle relay should be used on certain pins only for GRBL and that will depend on the GRBL version used.
Here I have a switch AFTER the relay so I can manually control the spindle if needed.
Moving this to a better location too.
Could you take a few moments to READ THIS.
It will help you get the best out of the forum.
UKHeliBob:
I am not sure exactly what you mean by this. Can you please provide more details and post the "GRBL 1.1h" file (is that really its name ?) here or if it is to big, post a link to it.
GRBL has different versions and the latest version is 1.1h (just released last month)
Pin13 on a Nano can be problematic, even if you can mod the software.
A Nano has a LED connected directly to pin13, pulling the pin LOW-ish on bootup.
Writing a HIGH to the pin before pinMode does not pull that pin fully up either.
That pin also might flash (high/low) during bootup by the bootloader.
Can't you use another pin? (analogue pins can also be used as digital).
If not, try a 220ohm resistor between pin13 and the 5volt pin.
Leo..
Wawa:
Pin13 on a Nano can be problematic, even if you can mod the software.
A Nano has a LED connected directly to pin13, pulling the pin LOW-ish on bootup.
Writing a HIGH to the pin before pinMode does not pull that pin fully up either.
That pin also might flash (high/low) during bootup by the bootloader.
Can't you use another pin? (analogue pins can also be used as digital).
If not, try a 220ohm resistor between pin13 and the 5volt pin.
Leo..
Thanks for that info Les,
I could remove that LED on the nano board? I see it comes on when I trigger that pin.
I will try using a resistor across D13 and 5v
I don't know enough about what I am doing to change to another pin.
regpye:
Thanks for that info Les,
I could remove that LED on the nano board? I see it comes on when I trigger that pin.
I will try using a resistor across D13 and 5v
I don't know enough about what I am doing to change to another pin.
I tried the resistor across D13 and 5v and it made the situation worse. Instead of just being on at startup, it now is flashing violently on and off for several seconds before it stays on. I can still turn it off using M4 and then turn it on again using M3
I will try removing the LED on pin D13 and see if that makes any difference.
regpye:
I tried the resistor across D13 and 5v and it made the situation worse. Instead of just being on at startup, it now is flashing violently on and off for several seconds before it stays on. I can still turn it off using M4 and then turn it on again using M3
I will try removing the LED on pin D13 and see if that makes any difference.
Removed the LED and it made no difference, except now there is no LED.
Double check the GRBL pin functions IIRC they changed the spindle enable at some point so you may be looking to use the relay on the wrong pin.
There was also an issue about PWM on a spindle pin which has caused problems for relay use.
IIRC some people got around it by using other methods before the relay and also changing something in the definitions.
Cannot remember the whole story so you may have to dig around a little with google and "grbl spindle relay"