PWM Pin For a Laser Module

Post anything you want to discuss with others about the software.

PWM Pin For a Laser Module

Postby P_Pav » Wed Apr 07, 2021 3:59 am

Good morning all,

Well I've managed to get myself a little NEJE 7.5w laser diode with a TTL control board. Now I'm trying to get the TTL controller and UCCNC to work together. I'm trying to keep this simple so that I don't over complicate the issue but here's the problem I'm coming up against.

I may get some of this wrong but bare with me and correct me if I'm going astray.

I created a basic program to run which is lower down this page, you'll see some possibly unnecessary M11s and some other bits that might not be needed but I've tried all sorts of codes and combinations to try and get the PWM/Vref signal to make sense.

The TTL board wants to see between 0v and 12v to set the power of the laser. I was expecting that when I send a command "M3" followed by "M10 Q128" I'd get have of the voltage I'm referencing off but that's not the case for all values. Whilst doing some tests before hooking it up with a 12v power supply I assumed that by connecting up my multi-meter between the 24v UCBB board's power in (at 24v) and the negative probe on the multi-meter going to the pin selected for the laser control (pin 14 ch.2) I would get a proportional reading depending on the M10 Qxxx in the G code. So when the code says "M10 Q255" the readout would be 24v. It is, but if I change the G code to read "M10 Q128" I don't get what I was expecting, that being 12v. Instead I get 17.7v, and for "M10 Q64" I get 12v, and "M10 Q1" I get 6v.

In brief...

Using the 24v power supply for the UCBB I get...
M10 Q255 = 24.2v
M10 Q128 = 17.7v
M10 Q64 = 12v
M10 Q1 = 6v

Using 12v from the analogue board (that's connected to the UCBB)

M10 Q254 = 12V
M10 Q128 = 9.3V
M10 Q64 = 6.6V
M10 Q32 = 5.1v
M10 Q1 = 0V

Proportionally the PWM to voltage seems out of sync. Have I missed something out here? The TTL board does say the following on it...

TTL: 0-20KHZ
VPP: 3.3v - 12v

What is going on? Have I misunderstood something? I changed the PWM settings in the spindle control to "0" for all pins and ports so as to not confuse myself (and others reading this) that the spindle PWM has anything to do with it. I might be wrong but I assume those spindle PWM settings are for something else.

I've included my profile settings for those wishing to check this out further.

I'm going nuts over this and I can't work out what's wrong.

Code: Select all
(I added  M3 to set M11)



G0 X10 Y10

M10 Q255
G1 X500 F3000

G0 X10 Y20

M10 Q128
G1 X500 F3000

G0 X10 Y30

M10 Q64
G1 X500 F3000

G0 X10 Y40

M10 Q32
G1 X500 F3000


Here's the little TTL board...

NEJE TTL Board.jpg

When I hook the TTL line to the 12v on the analogue breakout board and the GND to the pin I use for the laser it shows "28" flickering to "29" as if it's floating. When I run the code above it goes to 100 when at Q255 but no matter what Q code I run it won't go below "28-29". It does change accordingly with the lowering of the Q values but it's lacking a regular pattern.

Software Version 1.2111
Firmware Version 1.0340
Hardware Version 1.0
API version 2.1790
Device UC300ETH_5LPT
My settings whilst sorting this issue out.
(36.22 KiB) Downloaded 19 times
Posts: 5
Joined: Sun Sep 27, 2020 12:55 am

Re: PWM Pin For a Laser Module

Postby cncdrive » Wed Apr 07, 2021 12:48 pm

The UCBB has open collector outputs, so you cannot just measure voltage on the output without anything connected to the output, because the output can only sink current it cannot source.
You need a resistor from the output to the positive power supply voltage you will use.
You could use for example a 1k resistor, that will produce an approximately 24mA current flow through the output transistor, or you could use a higher value for lower current, but you need at least a minimum amount of current to be sourced when the transistor is turned off, otherwise the output will not work properly.
Site Admin
Posts: 3718
Joined: Tue Aug 12, 2014 11:17 pm

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: Bing [Bot] and 7 guests