Hello Guest it is April 24, 2024, 01:44:14 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tinkeringtechie

Pages: 1
1
PoKeys / Re: Pokeys57CNC PWM outputs in Mach4
« on: October 16, 2018, 11:35:32 AM »
The custom driver worked perfectly. The laser power is now the B axis. B0 is off and B0.0255 is full power. I used a arduino nano to build the driver. The code is very simple:

Code: [Select]
const byte laserPin = 3;
const byte stepPin = 2;
const byte dirPin = 4;
volatile int brightness = 0;
volatile int dir = 0;

void setup() {
  pinMode(laserPin, OUTPUT);
  pinMode(stepPin, INPUT);
  pinMode(dirPin, INPUT);
  attachInterrupt(digitalPinToInterrupt(stepPin), step, RISING);
}

void loop() {
  analogWrite(laserPin, brightness);
}

void step() {
  dir = digitalRead(dirPin);
  if (dir == LOW) {
    if (brightness < 255) brightness++;
  }
  else if (brightness > 0) brightness--;   
}

I ran a few jobs last night that were a couple hours long and it didn't lose a single step... but if you needed to re-zero the axis for a missed step you can just drive it to B1 and back to 0 since it ignores steps beyond the limits. The machine changes speed ever so slightly while changing the power since it's still doing coordinated motions, but it's way better than the spindle commands where it would literally stop for a half second and burn a hole.

2
PoKeys / Re: Pokeys57CNC PWM outputs in Mach4
« on: October 15, 2018, 12:09:58 PM »
I just tested the laser with an analog input and it stays off until over 2 volts and then turns on full. So I think the PWM is actually used to pulse the laser diode.

I also have a spindle and could share the PWM signal from there, but I can't find a way to coordinate spindle output with movement (any macro stops the machine momentarily)

But... I've got another idea: I'm doing to build a custom axis with a microcontroller that uses the step/dir signals to increase/decrease the PWM duty. So G1 B0 would be off, and G1 B0.255 would be full power. I'll report back with the results.


3
PoKeys / Re: Pokeys57CNC PWM outputs in Mach4
« on: October 12, 2018, 07:21:44 PM »
Very interesting... I had not thought of that, but it seems like a good option. The laser expects a PWM signal instead of analog, but I'm sure there's a way to output that with a similar approach. Now you've got me wanting to try the step signal as a crude PWM output. I'm guessing that would limit me to 50% duty cycle, but at the moment the laser is a bit too powerful so that might work.

4
PoKeys / Re: Pokeys57CNC PWM outputs in Mach4
« on: October 12, 2018, 04:42:38 PM »
I was able to control it with a custom macro, BUT... it's slow... too slow to be switched during a program and not coordinated with the machine's movement. I went in a totally different direction and now I'm controlling the On/Off of the laser using the B axis DIR pin with the intensity controlled by my custom macro. It would be sweet if there was some way to synchronize the PWM signal with the machine movement, but it doesn't seem possible with PoKeys. If anyone has an alternative approach I'd love to hear it.

5
PoKeys / Re: Pokeys57CNC PWM outputs in Mach4
« on: October 04, 2018, 11:57:02 AM »
I got a response from PoLabs support that controlling those outputs needs to be done with custom code. I'm going to try it with a custom M-code that adjusts the registers. I'll post back here if it's successful.

6
PoKeys / Pokeys57CNC PWM outputs in Mach4
« on: October 02, 2018, 03:02:50 PM »
I'm interested in using a DRO to control a PWM output in Mach4, but it seems to have limited functionality compared to Mach3.

Here's what it looks like in Mach3:



But in Mach4 I just have enable/disable and no options:



 Are these options hidden somewhere else, or are they not there anymore? Is there any other way to control a pwm output from gcode in Mach4? I'd like to be able to control pin 18 from gcode so that I can change the intensity of my laser, so sharing the spindle output is less desirable. Thanks

Pages: 1