Close

PWM into Spindle Controller Working!

A project log for 3040 CNC Milling Machine Mods

Upgrades to 3040Z-DQ

johnnyJohnny 06/18/2019 at 15:085 Comments

So I've worked out how to enable PWM on this controller and in the process discovered more features.

From what I can tell, there are three modes of speed control, trimpot/dial, +/- push buttons and PWM mode.

To enter into a mode connect momentarily either P3.0/P3.1/P3.2 to GND while spindle enable is off. P3.0 is dial, P3.1 is PWM and P3.2 is +/- buttons mode. Now enable the spindle and control the speed. To control the speed in +/- buttons mode, P3.0 is + and P3.2 is -.

P3.6, P5.4 and P5.5 are serial pins that go to a seven segment driver IC, looks to be TM1638. P3.6 is CLK, P5.4 is DIO and P5.5 is STB. From what I've decoded on my oscilloscope, the display says which mode you are in, current state of the spindle (on/off) and the spindle set speed represented as a percentage. Data in the image below is reversed, should have been LSB. 0xC0, 0x73, 0x89, 0xC2, 0x06, 0x89, 0xC4, 0x40... If the TM1638 is used, more buttons might be available.

I've got PWM to work through Pin 17 of the parallel port, but mind you, the signal from GRBL needs to be inverted first, otherwise for example g-codes S1 would be flat-out and S11000 off.

Here's how it's connected...

Signal into Stepper Controller (JP-382A) via DB25 and circuit pre four pin connector:

If you're curious, the ISO +5V is a isolated 5V generated on the stepper controller by this unmarked black box:

Four pins on the Stepper Controller connector labeled PWM-OUT go to another four pins on the Spindle Controller connector labeled PWM:

The image below is the PWM in circuit on the Spindle Controller.

Also a side note. The Stepper Enable signal from the DB25 Connector does nothing due to a missing resistor on the LED side of the optocoupler. The Enable on the stepper drivers are permanently on.

Discussions

Chris Ekiert wrote 04/21/2023 at 11:28 point

You did a awesome job, unfortunately my hardware is different slightly my jp-382c doesn't spit out pwm or spindle enable, spots are there though. So making the jumper wire harness does nothing on mine.

I could have tried a different method to get pwm to the jp-1482 but spindle limited to 65% if I read correctly 

My original cnc control box is labeled td and is a 4axis, though box says 3. And is controlled via USB, has a lpt port, as well.

I've been busy working on adding spindle speed control mql and air compressor control. I've assembled a hardware solution. I am In the process of finalizing the software that inserts the proper gcode to make communication with my hardware. And a write up on how to build the hardware.

I don't want to set a overly ambitious timeline but I'm expecting to wrap it up in the next few weeks to month depending on how demanding work goes.

The first version of hardware is a Arduino uno based, using off the shelf parts sourced from Amazon, power board, 8 relay module, i2c 1602 lcd, alps motorized pot.  A lpt port connector, level converter. The pot setup makes it universally compatible with spindle upgrade options too

For the enclosure I 3d printed a box on my ender 3, and glued the boards onto plastic standoffs with gorilla gel super glue

Not very space efficient as a custom PCB would be, but I'm expecting limited interest, as I know planet CNC isn't popular on these machines. It seems like a licensing dispute.

From what I've pieced together planet CNC had a diy version, and China zone CNC seemed to make a board from that. The developer wasn't likely happy a commercial product was shipping with it

And tried deactivating the questionable license shipped from China zone CNC. I purchased a license, with the understanding it might randomly reset as it's unofficial hardware. My solution has been change the host file for planet CNC to reflect it as 127.0.0.1 and install zonealarm to failsafe block USB CNC controller from phoning home. Or as per developer is will constantly change its board id. It's been 2 years now

  Are you sure? yes | no

Chris Ekiert wrote 04/22/2023 at 13:51 point

https://github.com/Cekiert/Porcupine-CNC-Mod

I have the code up here still working on

Drawing up the wiring I used, hopefully I'll finish that this weekend 

  Are you sure? yes | no

Johnny wrote 04/23/2023 at 05:48 point

Hey Chris,

Sounds like a interesting project and you've put a lot into it, I look forward to reading about how it all goes and might inspire me to plug in the CNC and start playing around with it again, it's been some time. Please leave a link to your project page!

All the best, Johnny.

  Are you sure? yes | no

DSam wrote 07/28/2020 at 21:33 point

HI there. Thank you, this information has been very helpful to getting spindle on/off control and some spindle speed control on my 3040T.

I am using the JP-1482 and JP-382C boards with CNC USB Controller. The 4 pin headers labelled PWM-OUT on the JP-382C board can be used as output 1 and output 2 in that software to turn the spindle on/off and bit bang pwm control through the JP-1482 PWM/switch pins after pulling P3.2 to GND in my case.

The speed signal coming out of CNC USB Controller doesn't seem to be proper PWM and without an oscilloscope I can't really figure out what it is that the software is doing. In any case, with this setup and software I am able to control the speed of the spindle between roughly 5000 RPM and 11100 RPM.

  Are you sure? yes | no

Johnny wrote 07/28/2020 at 23:51 point

Hey, no problem. Cool, nice work. I wonder if we have different firmware on the spindle controller.

  Are you sure? yes | no