Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Build my own PWM to Voltage Converter

Status
Not open for further replies.

Nightowl171

New Member
I run a hobby CNC powered by a Duet3 MB6HC control board quite satisfactorily, but I do have a problem buying in PWM-Voltage converters, as they don't seem to cut the mustard.

I've yet to determine the output signal from the control board, as I don't really understand the principles of - or how to measure - PWM output, so at this stage I just want to understand if it's conceivable to DIY this project.

As I understand it, the PWM output from the control board ranges from 0V to 5VDC (based on how the operating code is programmed) which is then converted from 0V to 10VDC to control the speed of the CNC's milling motor. Both board are powered by a 24VDC 350W PSU.

There is a plethora of PCBs available from various online retailers which sell for £10-15, but not one of them reaches the 10VDC output, so I thought I might build my own.

Is this conceivable/viable, and where would I even start? I'm pretty handy with a soldering iron.

Thank you.
 
Check my tutorial 'extras' - specifically the sixth diagram, with two transistors. Simply change the 12V supply to 10V, and the collector of T2 will give a 10V PWM signal - you should replace the lamp La2 with a pull-down resistor, or there may already be on on the motor driver?.

You don't really give much much information, in particular if you have a motor driver that requires a 10V PWM signal or not?.
 
Well something along the lines of a Mosfet driver with it's vcc from a 10V linear regulator from the 24V. Mosfet drivers output connected to low pass filter (design depends on your frequency etc) and then buffered by a rail to rail in/out op-amp to suit the load impedance. So could do with a few more bit's of information about your system :)
 
I'm not sure what extra information you need, but here goes...

The control board provides a 5V level signal for a TTL-compatible input for the PWM-Voltage converter, which in turn provides an output to the spindle. The control (input) voltage specification to control the spindle's speed is:

0V = 4,000rpm
2V = 8,200rpm
4V = 12,400rpm
6V = 16,600rpm
8V = 20,800rpm
10V = 25,000rpm

To achieve the required speed, the GCode command required is M3 Sn, where n is a numerical value of the speed required, e.g. M3 S10000 should give a spindle speed of 10,000rpm, and M3S18,000 a speed of 18,000rpm.

The actual speeds with the purchased PWM-Voltage converter deviate from this, where the lower programmed speeds are higher and the higher speeds are lower, The latter is probably due to the limited output voltage from the PWM-Voltage converter of 8.6V

I'm confident the signal from the control board is correct and the correct voltage applied to the spindle will produce the correct voltage. What I'm not confident of is the 'conversion' by the converter, so the actual speed is adrift from the programmed speed.

What I'm actually getting is this, but I've got another converter board that can supply 9.6V, to that might improve things:

Screenshot 2023-01-08 at 08.58.10.png


To be fair, I normally use the spindle between 10,000-18,000rpm, but I would like to make the actual speed as close as possible to the programmed speed, but maybe I'm expecting too much?

Thanks
 
So you're wanting a steady DC voltage (not PWM) to feed a speed controller - or will the speed controller accept a pulsed PWM waveform.

The circuit I linked to takes a 5V PWM signal, and converts it to a 10V PWM signal - you could convert it to a steady DC voltage with a low-pass filter, a simple resistor and capacitor might be all that's required, again it depends on exactly what the input of the speed controller is. My worry would be that as it's single ended (just an open-collector PNP source), there's no discharge path for the capacitor in the low-pass filter.

Have you tried feeding the 5V PWM directly to the speed controller?, if so does it work?, although the speeds will be corresponding low, if it works the speed should change (with about 14,500 with it at max).

If that works, then it should work with a simple 10V PWM, as I linked to.
 
The exact board you link to is being used by other Duet users for spindle control.
Is that the one you are using?

How do you have it wired to the Duet board, and what do you have in config.g relating to that - it is a configurable output that can be used in various ways.;
eg. the M453 and M950 lines?

Also, what spindle drive are you actually using?
 
I'm not sure what extra information you need, but here goes...

The control board provides a 5V level signal for a TTL-compatible input for the PWM-Voltage converter, which in turn provides an output to the spindle. The control (input) voltage specification to control the spindle's speed is:

0V = 4,000rpm
2V = 8,200rpm
4V = 12,400rpm
6V = 16,600rpm
8V = 20,800rpm
10V = 25,000rpm

To achieve the required speed, the GCode command required is M3 Sn, where n is a numerical value of the speed required, e.g. M3 S10000 should give a spindle speed of 10,000rpm, and M3S18,000 a speed of 18,000rpm.

The actual speeds with the purchased PWM-Voltage converter deviate from this, where the lower programmed speeds are higher and the higher speeds are lower, The latter is probably due to the limited output voltage from the PWM-Voltage converter of 8.6V

I'm confident the signal from the control board is correct and the correct voltage applied to the spindle will produce the correct voltage. What I'm not confident of is the 'conversion' by the converter, so the actual speed is adrift from the programmed speed.

What I'm actually getting is this, but I've got another converter board that can supply 9.6V, to that might improve things:

View attachment 139906

To be fair, I normally use the spindle between 10,000-18,000rpm, but I would like to make the actual speed as close as possible to the programmed speed, but maybe I'm expecting too much?

Thanks
Well the one important thing I would be looking for is not there, that being the frequency of the 5V pwm signal, you might see your amazon linked product has a range of 1-3Khz, perhaps you are way outside of that and that's why it doesn't work very well, who knows but to design a circuit properly you need to know it.
 
The exact board you link to is being used by other Duet users for spindle control.
Is that the one you are using?

How do you have it wired to the Duet board, and what do you have in config.g relating to that - it is a configurable output that can be used in various ways.;
eg. the M453 and M950 lines?

Also, what spindle drive are you actually using?
This is what I'm using yes.

The section relating to the motor/spindle config.g file looks like this:

; Milling motor and relay configuration
M950 R0 C"vfd+out7" L4000:25000 Q1000 ; enable router relay on out7
M563 P0 S"George" R0 ; assign spindle 0 to tool 0 and name it George
T0 ; select tool 0
M5 ; ensure motor is turned off

The +out7 part relates to an external relay that turns the mains supply to the spindle on, as the minimum spindle speed is 4,000rpm in digital mode. The spindle is a Sorotec SFM1000 PV-ER (which is technically identical to a Mafell FM1000 PV-ER).

I use M453 early on in config.g to set the machine to CNC mode.
 
Well the one important thing I would be looking for is not there, that being the frequency of the 5V pwm signal, you might see your amazon linked product has a range of 1-3Khz, perhaps you are way outside of that and that's why it doesn't work very well, who knows but to design a circuit properly you need to know it.
This converter is in common use for those using a spindle with a digital interface to control the spindle speed, and as far as I understand it, 1khz is the recommended setting on the programmes config.g file. The actual line looks like this:

M950 R0 C"vfd+out7" L4000:25000 Q1000

...with the Q1000 parameter setting the output frequency from the control board to 1khz.

The specification for the output pins on the controller board...:
"...provides 5V power and a 5V level signal for a TTL-compatible input to a laser controller, a PWM-to-0 to 10V converter (for variable-frequency drives), or a servo."
 
OK, got it..
The L4000:25000 defines the speed<>PWM duty cycle.
Zero duty cycle equates to 4000 RPM, 100% duty to 25000

You will need to trim the PWM converter gain to match maximum speed, that's presumably what the blue pot is for on the PWM converter PCB.

For an analog control open-loop spindle, 1 - 2% error is considered good on full size machine tools.
 
I think the issue was with the supply voltage to the converter board.

It seems a 12VDC supply from the control board isn't adequate, so I've test-wired it to directly to the 24VDC supply from the PSU, and I can now get a 9.6VDC output with the blue pot adjusted to its limit, so that's a bit closer!

Maybe a 30VDC PSU would make the difference but, if the programmed speed tests are closer to actual speeds, then it's as good as it's going to get.

Thanks for your time and efforts, though. It's really appreciated :)
 
Probably whatever opamp they use for the 10V output is not rail-to-rail and could not get close to the positive voltage. I doubt higher voltage will make any difference, it would probably give the same output from around 14V upwards.

You could adjust the minimum and maximum speed parameter in the M950 line to match whatever the lowest and highest speeds actually are at the spindle, for better overall speed tracking.
 
Not to muck up the already good suggestions, but its fairly simple to
do a learning procedure where RPM is measured versus a V applied by
PWM, and use that data in a least squares or power curve flitting
algorithm. That would present very good accuracy, and could be used
for load and or material changes as well, eg. bits used. Eg. a table of
values for each bit for use in the correction equation.

Somewhat akin to the use of gcode ripper to level the cutter positions
when milling stuff like PCBs.


Regards, Dana.
 
Not to muck up the already good suggestions, but its fairly simple to
do a learning procedure where RPM is measured versus a V applied by
PWM, and use that data in a least squares or power curve flitting
algorithm. That would present very good accuracy, and could be used
for load and or material changes as well, eg. bits used. Eg. a table of
values for each bit for use in the correction equation.

Somewhat akin to the use of gcode ripper to level the cutter positions
when milling stuff like PCBs.


Regards, Dana.
I had thought of doing that as a last resort, but it would require altering the speed for every tool in the entire tool database.

I'll see how close the 24V supply gets me and go from there.

Thank you
 
You could adjust the minimum and maximum speed parameter in the M950 line to match whatever the lowest and highest speeds actually are at the spindle, for better overall speed tracking.
That is the actual minimum and maximum speeds of the spindle, when digitally controlled, but I was wondering if changing the Q setting might make a difference.
 
So, I've been out to the workshed (too small to be a workshop, too big to be a toolshed) and, with the (cheapest) PWM-Voltage converter managed to achieve the following:

Programmed - Actual Speeds
  • M10000 gives 10,150rpm
  • M14000 gives 14,010rpm
  • M18000 gives 18,000rpm
As this is the speed range within which I primarily use the spindle, I think that'll do!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top