vlachoudis / bCNC

GRBL CNC command sender, autoleveler and g-code editor
GNU General Public License v2.0
1.58k stars 537 forks source link

How to Blink LEDs in bCNC according to command ? #1623

Open ImranKhan203 opened 3 years ago

ImranKhan203 commented 3 years ago

Hello,

Please help me out. I am using GRBL 0.9 with the help of bCNC software and I want to attach Tower Lamp/Stack Light on our CNC machine. I would like to add 2 outputs on our machine to indicate if we’re running the program (green light) or if we’re in pause (called ‘hold’ in the program / red light). For that, I have to work on bCNC that is the software used in all our machines.

So, when the program is running, the green light has to be lighted, and if we’re in pause, the red light has to be lighted. The orange one will probably be used for something else in the future. To do that, I’ll have to detect the state of the program and send it to the lights (2 outputs).

Please suggest me in which file of bCNC and which type of program I have to use?

Here is the file which I am using on Python 2.7.16 : bCNC01.ZIP

I want to attach this type of Tower Lamp/Stack Light : tower-lamp-230v-ac-500x500

Guenni75 commented 3 years ago

Hi. You could switch one relais with spindle on pin. NC for green and NO for red.

When the spindle is off, green light, spindle on, red light.

But it could be that the pin switches the other way around. depends on the compilation of grbl. For my CNC, i had to change this.

ImranKhan203 commented 3 years ago

@Guenni75 Thank you for the information.

Can you please tell me how can I operate the relay with coolant command (M8 & M9) automatically. Like if I click on "Run" the relay should be ON and if I use "Pause" command the relay should be Off automatically not manually. Is this possible?

I know the pin on CNC shield for coolant command that is pin A3 on Arduino Uno (GRBL 0.9).

Please suggest me that in which file of bCNC (v 0.9) I have to change the Python program and what program I have to use for this?

Thank you.

Guenni75 commented 3 years ago

First, you think too complicated and you don't have to change anything in the programm.

To automatically switch the relais with M8 & M9, you have to connect pin A3 to the relay and send the commands M8 at the start and M9 at the end of the gcode.

Second, why coolant? You have to be safe, if the spindel is running, not the coolant. Pin 12 is spindle enable. I would do it with this pin, because i will never forget to start the spindle!!

ImranKhan203 commented 3 years ago

@Guenni75 Thank you.

Actually, I want to use this because in our machine there is a requirement of heater so I will be use it in future via this way.

Can you please tell me, how can I operate the relay and the spindle with the same pin D12. Is this possible? & How?

Thank you.

Guenni75 commented 3 years ago

On every relais, you have three pins DC(+), DC(-) and IN. You have to connect D12 with the signal pin of two relais. One for the spindle and one for the LED. Or juse something like this

You connect IN1 to D12 and bridge IN1 and IN2. Better use an external 5V power supply for the relais. Search for it. There are thousand manuals in the web for relais and arduino.