PDA

View Full Version : pwm schematic help required please?



Tel 27
01-03-2019, 10:33 PM
Hi everyone,

New to the site and hoping someone can help with this....

Recently bought a used cnc milling machine (custom manufactured model), with a spindle problem.

Its currently running mach 3 software, I have managed to get the spindle (dc treadmill motor) running via a 5v supply motor controller board, and verified that there is a variable 0-10v output from the breakout board to a potentiometer (to harmonise the programmed speed to actual speed)

Trouble is this (electrics) isnt really my field, and was wondering if anyone could do me a schematic sketch as to how pwm wires should be connected to the pot?, the original wiring was a bit of a dogs breakfast, but included a 5k resistor and capacitor (assume as part of a smoothing circuit)

I can get the spindle to start & reverse in mdi no problem, but the only spindle speed control I have is manually via the potentiometer, and the motor seems to lack torque for some reason? (assume its lack of pwm input?)

Any help gratefully received thanks...

Voicecoil
02-03-2019, 01:43 AM
If you're using control via an external controller, likely it'll be best to ditch the pot as it could interfere with the settings (if not set it to mid position where it'll have least effect) . Normally you'd connect the 0...10V output to where the wiper connection of the pot connects and ground to the anti-clockwise connection: unless there's a separate input for external control. What driver board is being used for the spindle?? I've investigated a little bit about such things as I'm in the process of converting my pillar drill to a similar DC motor.

Tel 27
02-03-2019, 12:12 PM
If you're using control via an external controller, likely it'll be best to ditch the pot as it could interfere with the settings (if not set it to mid position where it'll have least effect) . Normally you'd connect the 0...10V output to where the wiper connection of the pot connects and ground to the anti-clockwise connection: unless there's a separate input for external control. What driver board is being used for the spindle?? I've investigated a little bit about such things as I'm in the process of converting my pillar drill to a similar DC motor.

25483

I've attached (or at least tried to) a pic of the motor controller board (any help identifying it appreciated)

The problem is I have no electrical diagram or means of identifying the board to ascertain how it works.

There's 240v ac in and dc out, then there's a ribbon lead which was previously (incorrectly I think) wired to a potentiometer.

When powered up via mach3, the 4 wires on the ribbon lead measure as follows:

wire 1 has 5v across wire 4
wire 2 has 5v across wire 4
wire 3 varies but when switched off slowly loses voltage so assume that is capacitor on the board?
wire 4 see wires 1 & 2

The spindle only spins (to 2800 rpm) when wires 3 & 4 are connected, no other connections have that effect, wiring the potentiometer in allows the spindle to be slowed manually.

I've tried various permutations, but cant get the pwm wires from the breakout board to have any effect on rpm?

Any ideas?

Voicecoil
02-03-2019, 02:27 PM
Can you post a pic of the underside of the PCB as well please - then I can probably work out what the circuits doing.

Tel 27
02-03-2019, 02:46 PM
Can you post a pic of the underside of the PCB as well please - then I can probably work out what the circuits doing.

25484

Does this help?

Doddy
02-03-2019, 06:52 PM
Nothing more fun than trying to diagnose boards from photos :)

You're right - Pins 1+2 look to be the local +V supply from the on-board switched-mode PSU, and pin 4 is the ground. Now, pin 3 is connected to the cathode of the opto-isolator (U4), with the anode pulled up to +V via R5 (4k7?, can't make out band 3/4, think its [4][7][0][10^1]... could be wrong) - the output from the opto isolator heads off to the vertically mounted control board - which looks to be the brains of the speed control. That basically means that pin 3 is pretty much all you can use to control the motor - it could be basic PWM, or some other form of digital signalling - unclear, and would need images of front and back of vertical board to even begin to guess). What it almost certainly isn't - is any form of analogue control on the pin-3 input, so I'd bin the pot. I did wonder if the pin-3 was an spindle encoder feed-back input but the absence of any other connector would tend to suggest not.

Connecting 3-4 spins the motor?, yeah, can see that. So presumably it is a PWM input. What you need now is a PWM controller that generates an inverted output (e.g. more "Space" than "Mark" as the demand increases). The problem is that it's hard to guess what the PWM frequency should be to generate the M/S signal. Something like that would be easy to knock up on an Arduino if you have the inclination - and would allow you to explore the speed range easily. That'd be where I'd be heading next in the absence of any data on the board. You could instead experiment with (I assume you're using Mach3?) the PWM output from the BoB (if available) - don't use the analogue output. Or, re-map the Mach PWM output pin to an unused axis on the BoB and use that to drive the PWM input to the speed controller.

You say you can get the motor to Start AND Reverse?, there must be some other control/switchgear to support that - this only allows a variable 0-XX VDC to the supply, so it should be unidirectional. Is there other switchgear? (heading off on a tangent since this doesn't really address the speed control issue).

Rough-arse sketch of the signalling around the ribbon...

25485

It's only a partial schematic after the opto-isolator, what I'm trying to get at is that the only control you have is the signalling between pin 3 and 4 of the ribbon - that's where you have to introduce a digital PWM signal.

Voicecoil
02-03-2019, 09:22 PM
I guess this is the drive board that came with the motor??? i.e. ripped out of the original treadmill???. From what I've seen these driver boards vary a lot, from moderately complex ones that have all the control stuff on board and are fed directly from a pot on the control panel to things like this where it looks like there's no more than the power switching stage and all the clever stuff will be being done with a microcontroller on the treadmill control panel. From the information available I would agree with Doddy, it'll need a PWM signal to feed it, can you get this from the BOB and control vis Mach3 (which I know very little about, but found this which would suggest it's possible, but might need the signal inverting: http://www.audiohms.com/en/blog/item/155-control-spindle-speed-by-pwm-step-dir).
From looking at other similar circuits I would guess the frequency would need to be between 12 and 25KHz - if you have problems doing this then it would only take a little while and about £1 of components to make a simple analogue circuit that would generate the required signal from the 0-10V O/P. Alternatively you could ditch this driver altogether and go for something like this: https://www.ebay.ie/itm/180V-200V-DC-230V-AC-12A-4-HP-motor-speed-controller-regulator-RS232-CNC-control/183622694369?hash=item2ac0c3f5e1:g:wHEAAOSwQLVcNVd b:rk:2:pf:0

Tel 27
02-03-2019, 10:48 PM
Nothing more fun than trying to diagnose boards from photos :)

You're right - Pins 1+2 look to be the local +V supply from the on-board switched-mode PSU, and pin 4 is the ground. Now, pin 3 is connected to the cathode of the opto-isolator (U4), with the anode pulled up to +V via R5 (4k7?, can't make out band 3/4, think its [4][7][0][10^1]... could be wrong) - the output from the opto isolator heads off to the vertically mounted control board - which looks to be the brains of the speed control. That basically means that pin 3 is pretty much all you can use to control the motor - it could be basic PWM, or some other form of digital signalling - unclear, and would need images of front and back of vertical board to even begin to guess). What it almost certainly isn't - is any form of analogue control on the pin-3 input, so I'd bin the pot. I did wonder if the pin-3 was an spindle encoder feed-back input but the absence of any other connector would tend to suggest not.

Connecting 3-4 spins the motor?, yeah, can see that. So presumably it is a PWM input. What you need now is a PWM controller that generates an inverted output (e.g. more "Space" than "Mark" as the demand increases). The problem is that it's hard to guess what the PWM frequency should be to generate the M/S signal. Something like that would be easy to knock up on an Arduino if you have the inclination - and would allow you to explore the speed range easily. That'd be where I'd be heading next in the absence of any data on the board. You could instead experiment with (I assume you're using Mach3?) the PWM output from the BoB (if available) - don't use the analogue output. Or, re-map the Mach PWM output pin to an unused axis on the BoB and use that to drive the PWM input to the speed controller.

You say you can get the motor to Start AND Reverse?, there must be some other control/switchgear to support that - this only allows a variable 0-XX VDC to the supply, so it should be unidirectional. Is there other switchgear? (heading off on a tangent since this doesn't really address the speed control issue).

Rough-arse sketch of the signalling around the ribbon...

25485

It's only a partial schematic after the opto-isolator, what I'm trying to get at is that the only control you have is the signalling between pin 3 and 4 of the ribbon - that's where you have to introduce a digital PWM signal.

2549225493

The direction is switched via relays on the other board (I assume as they click when direction is programmed), the voltage from the breakout board when I mdi input s240 m4 is 0.5v, then at s500 measures 1.0v, at s1000 2.0v etc etc.

Are you advocating connection of the + PWM lead from the breakout board go to wire 3 and the other pwm to wire 4?

I did say electrics are not my field!

Doddy
02-03-2019, 11:41 PM
2549225493

The direction is switched via relays on the other board (I assume as they click when direction is programmed), the voltage from the breakout board when I mdi input s240 m4 is 0.5v, then at s500 measures 1.0v, at s1000 2.0v etc etc.

Are you advocating connection of the + PWM lead from the breakout board go to wire 3 and the other pwm to wire 4?

I did say electrics are not my field!

Hmmm, looking at that you might want to take up Italian cooking, to make sense of that spaghetti :). <-- intended with tongue in cheek

Okay, I don't know your BoB - but looks pretty generic. That makes me think that the "outputs" from the controlling PC will be buffered with the two large chips (74HC244s?) - they'll be able to drive the PWM output low enough to activate the opto-isolator, and so *should* work (or at least not blow anything up). Suck it and see. My other comment was thinking that if, and I don't know about this, but if the BoB doesn't output the standard PWM pin out, but instead only provides the resulting analogue drive, then instead of trying to route the standard PWM, use the other outputs that are associated with the typical 4/5 axis drives on the BoB - as these are easily available (and from within Mach its easy to remap the PWM output to any pin).

My conversation about arduinos is simply to take an unknown (mach) out of the equation to help better understand how to drive the speed controller, but I'm presuming - perhaps too much - that that's in your interest/comfort zone. It's nothing to do with CNC but would be a great way to test the board in (almost) isolation.

Voicecoil
03-03-2019, 10:42 AM
2549225493

The direction is switched via relays on the other board (I assume as they click when direction is programmed), the voltage from the breakout board when I mdi input s240 m4 is 0.5v, then at s500 measures 1.0v, at s1000 2.0v etc etc.



It would be instructive to measure on that same point with your meter set to AC rather than DC whilst inputting s240, s500, s1000 etc. and see what you get: if there's a decent (a volt or two) AC level there at s1000 then it's a PWM output, if not then as Doddy says it will have been converted into DC. A DC meter will average out a PWM signal and give a reading corresponding to the duty cycle:
25494
The AC level will be zero at 0% and 100% duty cycle, but doesn't vary so much in the middle range.

Tel 27
04-03-2019, 11:17 AM
Hmmm, looking at that you might want to take up Italian cooking, to make sense of that spaghetti :). <-- intended with tongue in cheek

Okay, I don't know your BoB - but looks pretty generic. That makes me think that the "outputs" from the controlling PC will be buffered with the two large chips (74HC244s?) - they'll be able to drive the PWM output low enough to activate the opto-isolator, and so *should* work (or at least not blow anything up). Suck it and see. My other comment was thinking that if, and I don't know about this, but if the BoB doesn't output the standard PWM pin out, but instead only provides the resulting analogue drive, then instead of trying to route the standard PWM, use the other outputs that are associated with the typical 4/5 axis drives on the BoB - as these are easily available (and from within Mach its easy to remap the PWM output to any pin).

My conversation about arduinos is simply to take an unknown (mach) out of the equation to help better understand how to drive the speed controller, but I'm presuming - perhaps too much - that that's in your interest/comfort zone. It's nothing to do with CNC but would be a great way to test the board in (almost) isolation.

Truth be told the whole electrical thing is outside my comfort zone!

I've no problem with programming and machining, (been doing that since I left school in 79') but electrics are a mystery to me!

This is a sketch of how the potentiometer was previously wired up - I think its incorrect, looking at previous comments, there is NOTHING going to wire 3 (this was merely cut off), and it sounds like wire 3 is the ONLY way the PWM output can connect to the controller board? (with or without the potentiometer in the circuit)

I'm at a bit of a loss here - is there anyone in the UK who could take a look at it for me?25495

Jools
04-03-2019, 11:36 AM
I've just done this to my MX3660 BOB and driver. The thread is here https://forum.linuxcnc.org/38-general-linuxcnc-questions/35702-controlling-spindle-speed-on-siegx2-with-0-10v-analogue-on-mx3660-output-solved have a read through and then see how it stacks up to yours. On mine in the end I removed the whole POT circuit board and wired mine straight to the wires. If you have a spare output you can get the spindle to reverse too incase you want to tap.

Jools

Jools
04-03-2019, 01:34 PM
If you measure voltage across the middle and right hand pin on the POT this should go from zero to 5v (or what ever the voltage in is) The missing central wire from the pot is the variable part of the voltage that controls speed. I would think that this should be wired up to your wire four from previous posts.

On mine I simply took out the pot and wired the PWM 10v in to the right hand pot connector (wire 1) (So I took my power from the machine) . The left hand ground to ground (wire 4). and the wiper to wire three. This controls mine perfectly.

Page 8 from this BOB manual helped me http://cnc4pc.com/Tech_Docs/C11GS-R1_1_USER_MANUAL.pdf though your's might differ. Though it may be the same.

This is my BOB's wiring digram though it was the same to my machine not using a VFD as they show.25496

Jools

Doddy
04-03-2019, 02:08 PM
The issue here is that the OP's spindle speed control looks to be a digital PWM input drive, not an analogue input voltage. I accept this is somewhat different to the standard option on many speed-controllers on a standard spindle inverter driver.

In using the BOB the OP has inadvertently adapted the PWM output from the PC to an analogue voltage.

The Speed Controller looks to use only a PWM input.

The easiest test now would be to try to source the PWM output from the PC (looks to be available on pin 'P1' output on most BOBs), and feed this to the pin-3 of the speed controller. Connect BOB ground to pin 4. If this works at all - if the speed range is inverted (low = high speed, high = low speed) then write to confirm.

Or, if the PWM output from the PC (into the PWM input on the BOB) then look to remap via Pins/Ports from Mach to a different output than '1', and try again.

The original Pot set-up looks (a) to be mis-wired, and (b) likely intended to be a potential divider to scale input - whether this was PWM or analogue to a lower voltage/current. If the value of R5 is 4k7 then this just isn't needed for the opto-isolated input for any supply up to 10V (If ~= 4mA on the opto-isolator LED at 10V input). BUT, unless you get a PWM signal into it I doubt from the quick look at the board that this will give anything other than On/Off. The OP needs a PWM source.

EDIT:

OP: On the image of your BOB - what's the label on the fourth pin from the left on the top edge of the board (after the Red/Red/Yellow cables)? - Is that P1?

john swift
05-03-2019, 12:17 AM
looking at the second photo in post 8
the BOB looks like this BOB

25497

John

Doddy
05-03-2019, 08:39 AM
looking at the second photo in post 8
the BOB looks like this BOB
John

Thanks John, that's very clear and I think supports my advice above.

Tel 27
05-03-2019, 09:52 PM
Thanks John, that's very clear and I think supports my advice above.

Thanks for the replies gents - good to have people at least trying to help me despite my limited electrical understanding!

Havent had much time to look at it for a couple of days, but having read the reply about measuring the output voltage with the meter set on ac, it does indeed read 0.2v ac when programmed s1000 via mach 3 (assume that means its a result of pwm "wave"?)

25498

As you can see pwm is activated to output on p1

Doddy
05-03-2019, 09:58 PM
Be bold :) Just wire it up. There's not much that you can do via ribbon #3(+) / #4(-) to cock it up. #3 to P1, #4 to gnd.

Tel 27
09-03-2019, 07:33 PM
Be bold :) Just wire it up. There's not much that you can do via ribbon #3(+) / #4(-) to cock it up. #3 to P1, #4 to gnd.

Well, tried that, (pwm to wire 3) the spindle fires up and goes to 3500rpm (when s250 m4 is mdi input on mach3)

Altering the s value makes no difference to the spindle rpm, (i.e. s25 gives the same 3500rpm!) although the pwm output voltage does alter accordingly...

any more ideas?

Doddy
09-03-2019, 07:50 PM
Well, tried that, (pwm to wire 3) the spindle fires up and goes to 3500rpm (when s250 m4 is mdi input on mach3)

Altering the s value makes no difference to the spindle rpm, (i.e. s25 gives the same 3500rpm!) although the pwm output voltage does alter accordingly...

any more ideas?

You say:-

"PWM to wire 3", and separately, "although the PWM output voltage does alter accordingly".

What have you wired to the speed controller pin 3?, the PWM ("...output voltage does alter...") or the P1 pin?


EDIT: Sorry, I appreciate I seem to be repeating myself, without explanation:-

The PWM ("Pulse Width Modulation") output from the PC is typically Pin1 of the parallel port - and you've confirmed this is how it's assigned in Mach. Okay so far. This pin/signal is a digital signal, alternative between On ("Mark") and Off ("Space"). The ratio of Mark/Space defines the PWM value, essentially a per-unit measure from 0 to 1 for Off to Full-speed. Increase the Mark ratio vs Space and you denote a speed increase.

Pin 1 of the BOB is connected (using the schematic from John), to two inputs on one of the octal transceivers (74x245) - inputs B2 & B3. The "DIR" direction pin on that chip is set to transfer from port B to port A. So the PWM input appears on A2 & A3. A3 is connected to the connector P1 on the BOB, and as such presents a buffered copy of the digital PWM (Mark/Space signalling) from the PC. It is this that needs to be connected to the speed controller. The other port, A2 is connected to an opto-isolator, through to the op-amp (half of LM358) which is configured as an integrator - it converts the Mark/Space ratio to an analogue voltage. This would be used for an analogue input to a speed controller (but NOT a digital PWM input).

It's for this reason that I'm asking you to confirm which PWM signal you have connected to the speed controller - because you refer to the PWM signal in an analogue sense.

Tel 27
11-03-2019, 10:41 PM
You say:-

"PWM to wire 3", and separately, "although the PWM output voltage does alter accordingly".

What have you wired to the speed controller pin 3?, the PWM ("...output voltage does alter...") or the P1 pin?


EDIT: Sorry, I appreciate I seem to be repeating myself, without explanation:-

The PWM ("Pulse Width Modulation") output from the PC is typically Pin1 of the parallel port - and you've confirmed this is how it's assigned in Mach. Okay so far. This pin/signal is a digital signal, alternative between On ("Mark") and Off ("Space"). The ratio of Mark/Space defines the PWM value, essentially a per-unit measure from 0 to 1 for Off to Full-speed. Increase the Mark ratio vs Space and you denote a speed increase.

Pin 1 of the BOB is connected (using the schematic from John), to two inputs on one of the octal transceivers (74x245) - inputs B2 & B3. The "DIR" direction pin on that chip is set to transfer from port B to port A. So the PWM input appears on A2 & A3. A3 is connected to the connector P1 on the BOB, and as such presents a buffered copy of the digital PWM (Mark/Space signalling) from the PC. It is this that needs to be connected to the speed controller. The other port, A2 is connected to an opto-isolator, through to the op-amp (half of LM358) which is configured as an integrator - it converts the Mark/Space ratio to an analogue voltage. This would be used for an analogue input to a speed controller (but NOT a digital PWM input).

It's for this reason that I'm asking you to confirm which PWM signal you have connected to the speed controller - because you refer to the PWM signal in an analogue sense.

Unfortunately much of what you are telling me is going over my head!

This is how its currently wired:

25532

Does the fact the altering of the pwm voltage through mach3 commands makes no difference to the output from the controller board to the motor indicate a problem with the board itself?

Doddy
12-03-2019, 12:20 AM
Unfortunately much of what you are telling me is going over my head!
Does the fact the altering of the pwm voltage through mach3 commands makes no difference to the output from the controller board to the motor indicate a problem with the board itself?

No. In fact it's exactly as I'd expect from the information that you've supplied to date. If you was to set the speed to 10% of max (assuming you've calibrated it) then I'd expect the spindle to be OFF. And above about 25% I'd expect it to be full-on. This is simply the (wrong) application of the analogue output from the BOB to the opto-isolator input to the speed controller, which instead expects a PWM input.

Simply. Connect the BOB output pin P1 to ribbon Pin 3. Connect the Ground used for the BOB to ribbon Pin 4. There is no need for any of the resistors.

Rough-arsed sketch - the PC output pin-1 is a digital PWM output. The BOB routes this to two different outputs - the BOB "P1", which is a facsimile of the PC output - and is the signal you need. There's also an on-board (the BOB) integrator that converts the PWM to the analogue output, that you don't need. Your speed controller takes a digital PWM input and uses this either to generate the analogue drive to the onboard speed controller, or simply uses this to drive the onboard MOSFET to drive the spindle. Regardless, the important bit is that the speed controller around the pin 3/4 terminals is designed around having a Digital PWM input, and NOT an analogue input (which, confusingly, is derived from a PWM source)

25533

Tel 27
12-03-2019, 10:57 PM
No. In fact it's exactly as I'd expect from the information that you've supplied to date. If you was to set the speed to 10% of max (assuming you've calibrated it) then I'd expect the spindle to be OFF. And above about 25% I'd expect it to be full-on. This is simply the (wrong) application of the analogue output from the BOB to the opto-isolator input to the speed controller, which instead expects a PWM input.

Simply. Connect the BOB output pin P1 to ribbon Pin 3. Connect the Ground used for the BOB to ribbon Pin 4. There is no need for any of the resistors.

Rough-arsed sketch - the PC output pin-1 is a digital PWM output. The BOB routes this to two different outputs - the BOB "P1", which is a facsimile of the PC output - and is the signal you need. There's also an on-board (the BOB) integrator that converts the PWM to the analogue output, that you don't need. Your speed controller takes a digital PWM input and uses this either to generate the analogue drive to the onboard speed controller, or simply uses this to drive the onboard MOSFET to drive the spindle. Regardless, the important bit is that the speed controller around the pin 3/4 terminals is designed around having a Digital PWM input, and NOT an analogue input (which, confusingly, is derived from a PWM source)

25533

confused really is the term that springs to mind!

how exactly would I calibrate the speed?

Doddy
13-03-2019, 08:16 AM
Just do this:-
Connect the BOB output pin P1 to ribbon Pin 3. Connect the Ground used for the BOB to ribbon Pin 4. There is no need for any of the resistors.


To answer your question:-
Google Mach3 Spindle Settings to find out how to setup. What I meant by "calibrate" was perhaps misleading, my fault.

My intent, when you issue lets say a speed of S1000, that the actual speed would be a ratio of the commanded speed vs the maximum spindle speed - so if the max spindle speed was set within Mach to 2000rpm, then a S1000 command would set the PWM output at 50% Mark/Space. If the max spindle speed was set within Mach at 4000rpm, then the same S1000 command would set the PWM output at 25% Mark/Space ratio. My comment was to ensure that the commands that you issue to test the speed control would respond with a sensible response from the PC/machine.

Tel 27
24-04-2019, 07:36 PM
Just do this:-
Connect the BOB output pin P1 to ribbon Pin 3. Connect the Ground used for the BOB to ribbon Pin 4. There is no need for any of the resistors.


To answer your question:-
Google Mach3 Spindle Settings to find out how to setup. What I meant by "calibrate" was perhaps misleading, my fault.

My intent, when you issue lets say a speed of S1000, that the actual speed would be a ratio of the commanded speed vs the maximum spindle speed - so if the max spindle speed was set within Mach to 2000rpm, then a S1000 command would set the PWM output at 50% Mark/Space. If the max spindle speed was set within Mach at 4000rpm, then the same S1000 command would set the PWM output at 25% Mark/Space ratio. My comment was to ensure that the commands that you issue to test the speed control would respond with a sensible response from the PC/machine.

Well, that didnt work either, I'm getting to the end of my tether with it now, got a few things I'd like to do with it looming large (been calling in favours elsewhere too long now)
Is there anyone in the UK I could take it to?, (preferably in the North East but it's easily transportable in my van)
Happy to pay someone for their time....

Voicecoil
25-04-2019, 08:51 PM
If you can't find anyone over in the NE, I'm not too far away ont' t'other side of the Pennines - not exactly on your doorstep but at least the roads are good. Shame, I was over your way for a guitar show back at the end of March, could have dropped round and sorted it.