Hi everyone,
I'm helping my sister-in-law remotely with her school project—a CNC machine with an Arduino, stepper motors, and a blue/violet laser. She's in Cebu, Philippines, and I'm assisting via video calls, so I can't manipulate the hardware directly.
Project Setup
Hardware:
- Arduino Uno
- CNC shield V3
- 2 Nema 17 stepper motors (4-lead)
- 2 DRV8825 stepper motor drivers
- 500mW 405NM 12V Blue Violet Laser Module (Adjustable Focal, TTL PWM Control)
- 12V 10A power supply
Software:
- LaserGRBL
Issue: Laser Not Powering On with Arduino
The laser works when we press the button on top of it, but it doesn’t turn on via the Arduino.
Wiring:
-Red wire -> 12V (CNC shield)
-Black wire -> GND
-Yellow wire -> Z+ (D11)
-White wire -> (Also tried SpnEN)
What We've Tried So Far:
Followed the guide from this YouTube video: https://www.youtube.com/watch?v=td4D...ToMechatronics
(including importing the LaserGRBL settings)
Laser works manually: Pressing the button on the laser turns it on at full power.
Motors are working properly and move as expected.
LaserGRBL settings confirmed:
-$30=1000
-$31=0
-$32=1
Tested multiple G-code commands:
- M3 S500, M3 S1000, M3 S100, M3 S50 ? Laser does not turn on.
- M3 + G1 X10 F1000 S255 ? Motors move, but the laser does not turn on.
Multimeter testing:
-12V power is delivered properly.
-SpnEN and 5V signals are live.
-No output detected on D11 when running commands.
Tried alternate wiring:
-Connected PWM wire to 5V (hoping for a constant signal) ? No response.
-Wired using the "4-wire" version (White to SpnEN, Yellow to 5V) ? No response.
Custom Arduino code test:
/ Pin definitions
#define LASER_PWM 11 // Laser PWM control (D11)
#define SPINDLE_EN 12 // Spindle enable (D12)
#define X_STEP 2 // X stepper step pin
#define X_DIR 5 // X stepper direction pin
#define Y_STEP 3 // Y stepper step pin
#define Y_DIR 6 // Y stepper direction pin
#define X_LIMIT 9 // X+ limit switch
#define Y_LIMIT 10 // Y+ limit switch
#define MOTOR_EN 8 // Stepper motor enable pin
void setup() {
pinMode(LASER_PWM, OUTPUT);
pinMode(SPINDLE_EN, OUTPUT);
pinMode(X_STEP, OUTPUT);
pinMode(X_DIR, OUTPUT);
pinMode(Y_STEP, OUTPUT);
pinMode(Y_DIR, OUTPUT);
pinMode(X_LIMIT, INPUT_PULLUP);
pinMode(Y_LIMIT, INPUT_PULLUP);
pinMode(MOTOR_EN, OUTPUT);
digitalWrite(SPINDLE_EN, HIGH); // Enable spindle (if needed)
digitalWrite(MOTOR_EN, LOW); // Enable stepper motors (active LOW)
Serial.begin(115200);
Serial.println("Setup complete");
}
void loop() {
// Turn on the laser at 50% power
analogWrite(LASER_PWM, 127);
Serial.println("Laser ON");
delay(1000);
// Move X axis forward 100 steps
Serial.println("Moving X axis");
digitalWrite(X_DIR, HIGH);
for (int i = 0; i < 100; i++) {
digitalWrite(X_STEP, HIGH);
delayMicroseconds(500);
digitalWrite(X_STEP, LOW);
delayMicroseconds(500);
}
delay(500);
// Move Y axis forward 100 steps
Serial.println("Moving Y axis");
digitalWrite(Y_DIR, HIGH);
for (int i = 0; i < 100; i++) {
digitalWrite(Y_STEP, HIGH);
delayMicroseconds(500);
digitalWrite(Y_STEP, LOW);
delayMicroseconds(500);
}
delay(500);
// Check limit switches
if (digitalRead(X_LIMIT) == LOW) {
Serial.println("X Limit reached!");
}
if (digitalRead(Y_LIMIT) == LOW) {
Serial.println("Y Limit reached!");
}
// Turn off laser
analogWrite(LASER_PWM, 0);
Serial.println("Laser OFF");
delay(2000);
}
Sent an analog signal to D11 while moving motors ? No laser activation.
Measured output from D11 (got a signal), but laser still does not respond.
Possible Concerns & Questions:
-Could the laser’s internal wiring be faulty, preventing TTL/PWM control?
-Are there any other tests we can do to confirm whether it's a wiring issue, software issue, or a defective laser?
The problem is that we ordered this laser online, and with the project deadline approaching, we don’t have time to wait for a replacement. Any guidance or troubleshooting tips would be greatly appreciated!
Thanks in advance!