Is it OK to pull a ttl signal to ground? PWM laser control for CNC

Thread Starter

snortonj

Joined Mar 17, 2018
3
I need some help connecting a diode laser to a PWM control board, and a hi/low signal from my Mach3 parallel port Break Out Board.

None of these cheap Chinese components come with good documentation. None for the BOB, none for the laser, and none for the PWM board.

Lets start with the laser control board. It uses a 12vdc power supply, and has a third pin labeled “s ttl + ,9Khz”. The laser runs at 100% when the 12vdc power is connected, and the ttl pin is left open. I can measure 2.7 vdc across the ttl pin and the 12vdc neg. pin. The laser will turn off when the ttl pin is connected to the 12vdc ground pin. There are some Mach3 user sites that say this method works for turning the laser on and off with the “z” axis up and down direction signal from the breakout board. The BOB signal is high for the z down, and low for the z up. Connecting this signal to the laser will turn it on (hi signal on the ttl pin) when the z travel goes down, and turns the laser off (ttl signal held low) when the z axis goes up. This works well allowing for the g-code generators to turn on and off the laser for simple engraving. That’s all I need , for now, I do not need to get into rastering control for photo etching.

I have tried to use a typical digital volt-ohm meter to measure the ma current on the ttl circuit. The only current I can measure with this tool is the current coming from the laser 12vdc neg. pin. Its 76 to 78 micro-amps when the ttl pin is grounded to the 12vdc neg. pin, and its also 76 to 78 micro-amps when I connect the same two pins to my BOB direction control pins, and then the BOB is flowing this current. If I try to put my meter in series with the signal from the BOB to the Gecko drive for the Z axis, I cannot get any current flow reading, and the in series meter prevents the Gecko from getting the Hi signal to make the z axis go down.

It IS SUCCESSFUL to run both the laser ttl and the z axis from the same signal source on the BOB. This gives the ability to turn the laser on and off with the z commands, and also move the z axis up and down.

So, the challenge is PWM control, when the laser is on, as controlled by the hi/low direction command from the BOB. Sure, it would be great to have Mach3 do it all, but for now, all I want is to run a cheap Chinese PWM board to set the laser strength. My PWM board uses a USB power cable, at 5vdc. It runs the laser just fine when just it is connected, but I cannot measure any signal current with my in line amp meter. It will block the signal.
My plan would be to connect the PWM board to the laser (on the + ttl pin and the 12-), ( connect the BOB COM+ pin to laser ttl pin and BOB DIR pin to laser 12v-), and leave the BOB connected to the Z axis Gecko Drive Board.

So…..what problems might I get (smoke) if I let the BOB pull the PWM signal low, which will shut of the laser when the z axis command is pulled low by the BOB. And, could the 9Khz signal cause any harm or performance issues to the Gecko Servo Motor Drive board? The z axis commands in the g-code are usually there (briefly like "move down .001", "or move up .001") to turn on and off the laser. (the state of the DIR command stays until another command is issued) However, there are some occasions where the z axis is needed to actually travel when engraving with the laser, for curved surfaces or cutting thru thicker materials in multiple passes. (That might project might best be done with g-code and spindle speed to PWM setup, in Mach3.)

If there is an issue trying to pull the PWM signal low, what might a couple of logic gates or transistors/resistor/diodes, do to make it happen? Some way to open the PWM when the laser is held low, and also isolate the Gecko from the 9Khz signal, if that is an issue. If someone with ttl background has a quick answer, I would greatly appreciate it!


Thanks for looking.
 
Last edited:
It runs the laser just fine when just it is connected, but I cannot measure any signal current with my in line amp meter. It will block the signal.
I want to comment on the above. You need a duty-cycle meter to indicate relative output power.

TTL is usually base don levels. The input current is small.

TTL has gotten complicated over the years because there is TTL compatable stuff that isn't TTL.
TTL has typically totem-pole or open collector outputs.

Look here https://en.wikipedia.org/wiki/Open_collector and in the article the link to to push-pull.

Try to reverse engineer the pins that you need to use.
 

DNA Robotics

Joined Jun 13, 2014
649
I think that would be abusing your parallel port. I would use a 74LS08 TTL AND gate to pass the PWM when high or not when low.

The BOB signal is high for the z down, and low for the z up. Connecting this signal to the laser will turn it on (hi signal on the ttl pin) when the z travel goes down, and turns the laser off (ttl signal held low) when the z axis goes up.
You could use that BOB signal as the power for another opto-isolator or even a logic level P-Mosfet.
 
Last edited:

george4657

Joined Apr 12, 2016
15
To run a laser in mach3 you want to use the spindle control command where speeding up the spindle increases the power.
Assign a pin on the breakout board to spindle speed control and ttl control on laser.
If your breakout board has a relay output hook it up to power to laser to turn laser off.
M5 command then turns laser off and m3 command turns laser on using relay.
S command sets speed of spindle/power to laser by PWM command of ttl control
S0 leaves power connected but no output, S1000 sets power at 100% assuming you configure your system to 1000 = 100%
Don't have mach3 on this machine so I can not look up all commands but check Mack3 manual for control of spindle motor with PWM.
Using a laser you set z height for best focus and then do not change it for engraving.

George
 

Thread Starter

snortonj

Joined Mar 17, 2018
3
Thanks, George.
I'm using CamBam for now, and didn't want to invest in more capable g-code software. The S codes are generated in CamBam, but I am not familiar with generating the M3/M4 spindle rotation and M5 spindle stop codes for each letter. That might be hundreds of occurrences that are needed for the text. I only have a few weeks experience in CamBam, and it looks to me like each letter would need to have its own operation definition if I needed the on/off commands for each letter, verses listing the entire string of text to just one operation. The tool path generator will automatically generate the z axis command at the start and end of each letter because of the engrave depth and the "safe travel" height in that "operations" settings. I can set the safe height and the engraving depth to very small numbers so that the z axis only moves a thousand or so, but that DIR signal holds that state until another z axis signal changes it. Can you steer me in the right direction as to generating that part (the M codes) of the g-code? (is it done in the post processor?) Iv'e also read that there may be delays in the M commands, some times associated with the z commands.
Regarding using the relay for on /off control of the laser power, I wasn't too keen on cycling the relay (on the BOB) that much, it would be hundreds of times a minute when engraving small text.
FYI: this is the best sheet I can find on the BOB: https://www.aliexpress.com/item/A11...Breakout-board-interface-board/486958987.html
It states that the axis drivers are "Standard TTL Level"
I do have the need to move the z axis when cutting thru the material in multiple passes, usually at 100% power, as well as reducing the power to do the text without cutting the material. It would be nice to do it all in one program setup.
There's another option by J Tech Photonics, its a driver board and software for under $150.
And thats where it just made sense that if the ttl pin on the laser and PWM board could be held low by the DIR pin on the BOB, all is GOOD!
Thank, JIM
 

george4657

Joined Apr 12, 2016
15
The M3 command is only done at the start of the program to apply power to the laser.
This is usually done with a M3 S0 command to turn on at zero power.
If using Z dir command to turn on you would enable the laser when you jog the Z axis which is a potential safety concern.
M5 command is only run at the end of the program to remove power.
During the program S0 and S1000 is used to turn of beam.
So even if you use the z dir for control I would power the laser by relay using the M3/M5 spindle commands
 

Thread Starter

snortonj

Joined Mar 17, 2018
3
The M3 command is only done at the start of the program to apply power to the laser.
This is usually done with a M3 S0 command to turn on at zero power.
If using Z dir command to turn on you would enable the laser when you jog the Z axis which is a potential safety concern.
M5 command is only run at the end of the program to remove power.
During the program S0 and S1000 is used to turn of beam.
So even if you use the z dir for control I would power the laser by relay using the M3/M5 spindle commands

Thanks for the nudge over to the side of Post Processors and G-codes. I found that the newest version of CamBam has some new functions that will insert commands like M3/M4, M10, M11 or M5 (user choice, just type it into the "Main heading" box of the post processor. ) It inserts the command when the Z value goes above "0" or below"0". (set up the engraving with , say .0005" up for the "safe travel" height, and engrave depth of just.0005". ) The M3 or M4 and M5 work with Mach3 and my axis driver and BOB, but as some of the forums point out, its a bit slow or I would call it "clunkie" because it introduces a one line pause. They say the M10 and M11 (with a output pin value attached will turn on and off a BOB output ) will be more seamless, but I don't know how to incorporate that relay operation with the ability to let CamBam and Mach 3 do the PWM via spindle control, thru the Axis driver signal. But, yes, the M3/M4 start codes, and the M5 stop code will work, along with the Sxx code for the spindle speed( if spindle is set to PMW) all work thru the one signal on the BOB axis driver, for full range of power and on off based on Z axis, for the laser. I had to play around a bit with the frequency setting in Mach3 spindle PWM settings, some trial and error found that "140" worked. The ttl pin on the Laser said 7Khz, , but Mach 3 "couldn't get there form here" so the "140" works (instead of 7Khz) .....Success!
 
Top