Electronics, Arduino, PWM, oh my!
October 18, 2023 4:40 PM Subscribe
I'm waaaaaay over my head trying to convert one PWM signal to another. More inside.
I have an old 3D printer that controlled its 24V fan via a 500hz 24V PWM signal. I am repurposing that to connect to a device that expects a 5000hz 5-12V PWM signal.
(When I say "24V PWM" I mean that when I set the output to 0 it stays at 0V and when I set it to full it pegs at 24V)
In any case I need something that will convert the signals. I'm imagining running the signal through an Arduino. Once I get it into digital form I can do amazing things, but I suspect there are a lot of things to know about the electronics side that people with actual expertise can warn me about. Any pointers will be gratefully received.
(For the record I am the archetypal programmer with a screwdriver. Electronics is magic. Please use small words and speak slowly.)
I have an old 3D printer that controlled its 24V fan via a 500hz 24V PWM signal. I am repurposing that to connect to a device that expects a 5000hz 5-12V PWM signal.
(When I say "24V PWM" I mean that when I set the output to 0 it stays at 0V and when I set it to full it pegs at 24V)
In any case I need something that will convert the signals. I'm imagining running the signal through an Arduino. Once I get it into digital form I can do amazing things, but I suspect there are a lot of things to know about the electronics side that people with actual expertise can warn me about. Any pointers will be gratefully received.
(For the record I am the archetypal programmer with a screwdriver. Electronics is magic. Please use small words and speak slowly.)
I agree with flabdablet that if this is aiming at something analog that's going to average the pwm then you almost certainly don't need to change the base frequency and just need to shift the voltage levels with maybe a MOSFET or two but in case direct conversion is in fact required:
At those incoming speeds you can measure the 400Hz duty cycle using the Arduino pulseIn() function, assuming its frequency is steady (so you can measure on-time and deduce duty cycle). The analogWrite() function defaults to about s 450 Hz PWM signal but that's just too avoid some issues with trying to wiggle a motor too fast; the atmega328 PWM generator can go way faster than that but you'll have to tinker with the setup bits to make it happen, eg:
analogWrite(10, dutyCycle);
TCCR1B &= ~2;
... will modify the base frequency of the pwm generator connected to D10 to be 31.4 kHz. You can get a wide range of frequencies with variable resolution depending on how much you want to muck around with the timer/counter control registers directly. This is the kind of microcontroller nitty-gritty that Arduino was specifically created to avoid but it's all still there under the hood and you can use the datasheet to figure out how to get exactly what you need.
posted by range at 7:00 PM on October 18, 2023
At those incoming speeds you can measure the 400Hz duty cycle using the Arduino pulseIn() function, assuming its frequency is steady (so you can measure on-time and deduce duty cycle). The analogWrite() function defaults to about s 450 Hz PWM signal but that's just too avoid some issues with trying to wiggle a motor too fast; the atmega328 PWM generator can go way faster than that but you'll have to tinker with the setup bits to make it happen, eg:
analogWrite(10, dutyCycle);
TCCR1B &= ~2;
... will modify the base frequency of the pwm generator connected to D10 to be 31.4 kHz. You can get a wide range of frequencies with variable resolution depending on how much you want to muck around with the timer/counter control registers directly. This is the kind of microcontroller nitty-gritty that Arduino was specifically created to avoid but it's all still there under the hood and you can use the datasheet to figure out how to get exactly what you need.
posted by range at 7:00 PM on October 18, 2023
Response by poster: The new device is this laser.
I did a first run at this with a similar laser from the same company but I dodged the conversion problem by simply setting it up so that the laser would be on at full power or off. This time I’d like to have more complete control.
Unfortunately I lack specifications for the 3D printer’s control port.
posted by Tell Me No Lies at 7:45 PM on October 18, 2023
I did a first run at this with a similar laser from the same company but I dodged the conversion problem by simply setting it up so that the laser would be on at full power or off. This time I’d like to have more complete control.
Unfortunately I lack specifications for the 3D printer’s control port.
posted by Tell Me No Lies at 7:45 PM on October 18, 2023
There's a little more to PWMing a 10 W laser than the simple duty cycles needed by a cooling fan. Can the circuit you're repurposing generate the 5 kHz the laser needs? There are inexpensive laser controllers out there that are designed for this application
posted by scruss at 8:20 PM on October 18, 2023
posted by scruss at 8:20 PM on October 18, 2023
Response by poster: The 3D printer controller is moving the laser; if I’m going to sync up the power level with the movement then life is much easier if the 3D printer controller is in charge of that as well.
There's a little more to PWMing a 10 W laser than the simple duty cycles needed by a cooling fan
I’m not sure how the PWM signal would differ between a fan and a laser? The PWM waveforms are exactly the same I think. Or is there some special variance a laser would require?
posted by Tell Me No Lies at 8:41 PM on October 18, 2023
There's a little more to PWMing a 10 W laser than the simple duty cycles needed by a cooling fan
I’m not sure how the PWM signal would differ between a fan and a laser? The PWM waveforms are exactly the same I think. Or is there some special variance a laser would require?
posted by Tell Me No Lies at 8:41 PM on October 18, 2023
Response by poster: I should say by the way that many 3d printer to laser cutter conversions reuse the fan controller in this exact way. I just haven’t found an existing transformation that matches the conversion problems I’m facing.
posted by Tell Me No Lies at 8:44 PM on October 18, 2023
posted by Tell Me No Lies at 8:44 PM on October 18, 2023
Best answer: If I'm reading the spec sheet that you linked correctly, the problem is way way simpler than you think it is.
The PWM control input is specified as 0/3-12V, 0-5kHz. I'm pretty sure that means that the PWM signal is supposed to swing between zero volts and anywhere between 3 and 12V, with a pulse rate anywhere from DC to 5kHz.
500Hz is between DC and 5kHz, so you don't need to re-sample the PWM waveform you already have in any way. All you need to do is cut its present peak voltage of 24V back to something between 3V and 12V, and all that takes is a simple resistive potential divider.
Using the component names from that Wikipedia article, 3.9k for R1 and 1k for R2 would make a potential divider that cuts your 24V PWM input down to a much more logic-friendly 4.9V output.
I'm suggesting that kind of level rather than the 12V you initially asked for just because the silk screen markings on the P-DA-01 driver adapter board on your linked sheet annotate the PWM pins with "TTL", and 0V for logic 0 and 4.9V for logic 1 are perfectly fine TTL signal levels.
If you're not going to use that adapter board but instead talk directly to the inbuilt driver board, you could go for a couple of 2.7k resistors and get a 12V PWM output from the divider, but the 4.9V TTL-friendly version is still well within the 3-12V spec and I'd be inclined to use that anyway.
I have no strong theoretical justification for keeping the total resistance of the divider around 5k, just rules of thumb and experience. With 24V continuous applied to the divider its total power dissipation is going to be around 0.1W, comfortably under what commonly available quarter-watt resistors are rated for, and 5k is a low enough input resistance that you probably won't see noise pickup issues.
posted by flabdablet at 1:44 AM on October 19, 2023 [4 favorites]
The PWM control input is specified as 0/3-12V, 0-5kHz. I'm pretty sure that means that the PWM signal is supposed to swing between zero volts and anywhere between 3 and 12V, with a pulse rate anywhere from DC to 5kHz.
500Hz is between DC and 5kHz, so you don't need to re-sample the PWM waveform you already have in any way. All you need to do is cut its present peak voltage of 24V back to something between 3V and 12V, and all that takes is a simple resistive potential divider.
Using the component names from that Wikipedia article, 3.9k for R1 and 1k for R2 would make a potential divider that cuts your 24V PWM input down to a much more logic-friendly 4.9V output.
I'm suggesting that kind of level rather than the 12V you initially asked for just because the silk screen markings on the P-DA-01 driver adapter board on your linked sheet annotate the PWM pins with "TTL", and 0V for logic 0 and 4.9V for logic 1 are perfectly fine TTL signal levels.
If you're not going to use that adapter board but instead talk directly to the inbuilt driver board, you could go for a couple of 2.7k resistors and get a 12V PWM output from the divider, but the 4.9V TTL-friendly version is still well within the 3-12V spec and I'd be inclined to use that anyway.
I have no strong theoretical justification for keeping the total resistance of the divider around 5k, just rules of thumb and experience. With 24V continuous applied to the divider its total power dissipation is going to be around 0.1W, comfortably under what commonly available quarter-watt resistors are rated for, and 5k is a low enough input resistance that you probably won't see noise pickup issues.
posted by flabdablet at 1:44 AM on October 19, 2023 [4 favorites]
Seconding flabdablet's simple and elegant answer.
posted by seanmpuckett at 5:07 AM on October 19, 2023
posted by seanmpuckett at 5:07 AM on October 19, 2023
→
3d printer fan control is usually on or off, with not much concern about duty cycle. Laser cutters use duty cycle to control depth of cut, with the very low levels used for surface marking/shading. If your repurposed printer has that kind of control, great; otherwise, expect holes in things.
posted by scruss at 2:00 PM on October 19, 2023
I’m not sure how the PWM signal would differ between a fan and a laser?
3d printer fan control is usually on or off, with not much concern about duty cycle. Laser cutters use duty cycle to control depth of cut, with the very low levels used for surface marking/shading. If your repurposed printer has that kind of control, great; otherwise, expect holes in things.
posted by scruss at 2:00 PM on October 19, 2023
Response by poster: 3d printer fan control is usually on or off
Interesting. I wonder why they would bother with PWM at all at that point.
posted by Tell Me No Lies at 2:26 PM on October 19, 2023
Interesting. I wonder why they would bother with PWM at all at that point.
posted by Tell Me No Lies at 2:26 PM on October 19, 2023
when I set the output to 0 it stays at 0V and when I set it to full it pegs at 24V
I take it you're using G-code to do that.
If you make up the 3.9k/1k potential divider I recommended, and temporarily wire a 100µF 16V electrolytic capacitor from its output to ground instead of connecting it to your laser (positive terminal of the capacitor to the divider output, negative terminal to ground), then you should be able to use an ordinary digital multimeter to measure the voltage across the capacitor and verify that you can put it anywhere from 0V to 4.9V using the appropriate G-code S parameter.
The capacitor acts to average out the PWM signal being applied to it, smoothing it into a DC voltage that's proportional to the PWM duty cycle and stable enough for the multimeter to measure accurately. If you're using an analog (old-school swinging pointer) multimeter on a DC voltage range then you don't even need the capacitor. You might see the pointer blur a tiny bit from the 500Hz component of what it's measuring but you'd have to look really really close.
If you get only a restricted range of output voltages - if the measured voltage remains exactly the same for, say, S64 through S71 but steps up suddenly at S72 - then the fan speed controller might indeed be too crude for laser drive purposes as scruss warns. But measuring it will tell you definitively.
Don't leave the capacitor wired in when you drive the laser, though. The laser controller wants to see a digital PWM signal, not an analog voltage level.
posted by flabdablet at 3:28 PM on October 19, 2023
I take it you're using G-code to do that.
If you make up the 3.9k/1k potential divider I recommended, and temporarily wire a 100µF 16V electrolytic capacitor from its output to ground instead of connecting it to your laser (positive terminal of the capacitor to the divider output, negative terminal to ground), then you should be able to use an ordinary digital multimeter to measure the voltage across the capacitor and verify that you can put it anywhere from 0V to 4.9V using the appropriate G-code S parameter.
The capacitor acts to average out the PWM signal being applied to it, smoothing it into a DC voltage that's proportional to the PWM duty cycle and stable enough for the multimeter to measure accurately. If you're using an analog (old-school swinging pointer) multimeter on a DC voltage range then you don't even need the capacitor. You might see the pointer blur a tiny bit from the 500Hz component of what it's measuring but you'd have to look really really close.
If you get only a restricted range of output voltages - if the measured voltage remains exactly the same for, say, S64 through S71 but steps up suddenly at S72 - then the fan speed controller might indeed be too crude for laser drive purposes as scruss warns. But measuring it will tell you definitively.
Don't leave the capacitor wired in when you drive the laser, though. The laser controller wants to see a digital PWM signal, not an analog voltage level.
posted by flabdablet at 3:28 PM on October 19, 2023
Response by poster: Yes, I'm using a G-code command that takes an argument from 0-255 . I've looked at about ten random wave forms and I really do appear to get about that granularity.
The suggestion for the multimeter is well received but I feel like I'm getting pretty good data from the oscilloscope. Any reason to be looking at averages when I can see the voltages directly?
posted by Tell Me No Lies at 8:23 PM on October 19, 2023
The suggestion for the multimeter is well received but I feel like I'm getting pretty good data from the oscilloscope. Any reason to be looking at averages when I can see the voltages directly?
posted by Tell Me No Lies at 8:23 PM on October 19, 2023
No, I'd just assumed that a programmer with a screwdriver who viewed electronics as dark magicks wouldn't have access to an oscilloscope. Scope > multimeter almost always.
posted by flabdablet at 9:27 PM on October 19, 2023
posted by flabdablet at 9:27 PM on October 19, 2023
Incidentally, it seems likely to me that the reason for the 5kHz limit on the PWM rate is that the PWM signal is probably being used directly to gate the power to the laser, which means that the actual beam will be switching on and off at the PWM pulse rate, and there is probably a limit to how fast a power laser can be switched like that.
5kHz doesn't sound all that quick, but a 5kHz PWM pulse train with a 1 in 256 duty cycle has a frequency spectrum with significant power up into the MHz region. Another way of thinking about that is to consider that 5kHz translates to a repetition period of 1/5000 s = 200µs, and if it's only high for 1/256 of that time on each cycle, that's an on-time of well under 1µs per cycle which sounds to me about as fast as you'd want to switch a power laser.
If you're running your PWM at 500Hz instead, the minimum on- or off-time is going to be ten times as long as that, which is going to be well within the switching capability of any laser rated for both 5kHz PWM control and continuous full-power operation.
Really the only downside of the lower rate is that if the laser really truly can switch on and off hard and fast and the spot size where it hits the target surface is very tiny, you might actually see the effects of the 500Hz modulating signal on lines it draws as it moves. If you're drawing a line at say 100mm/s, then the laser is going to be switching five times per mm and you might be able to see some kind of 0.2mm-scale pulse artefact in the resulting line.
I have no practical experience with CNC laser engravers but 100mm/s sounds kind of fast to me and 2ms isn't much time for a surface to heat or cool, so you probably won't see this, but there it is as a theoretical possibility. I still wouldn't be reaching for an Arduino before I'd tested the simple voltage divider, which you would still need in any case if you were going to use your existing PWM signal as input to an Arduino rather than feeding it directly to the laser.
The 3.9k/1k resistors I already recommended would be fine for an Arduino that expects 5V signal levels. If you're working with one that wants 3V logic levels, a 4.7k/680Ω divider would work for that.
posted by flabdablet at 10:11 PM on October 19, 2023
5kHz doesn't sound all that quick, but a 5kHz PWM pulse train with a 1 in 256 duty cycle has a frequency spectrum with significant power up into the MHz region. Another way of thinking about that is to consider that 5kHz translates to a repetition period of 1/5000 s = 200µs, and if it's only high for 1/256 of that time on each cycle, that's an on-time of well under 1µs per cycle which sounds to me about as fast as you'd want to switch a power laser.
If you're running your PWM at 500Hz instead, the minimum on- or off-time is going to be ten times as long as that, which is going to be well within the switching capability of any laser rated for both 5kHz PWM control and continuous full-power operation.
Really the only downside of the lower rate is that if the laser really truly can switch on and off hard and fast and the spot size where it hits the target surface is very tiny, you might actually see the effects of the 500Hz modulating signal on lines it draws as it moves. If you're drawing a line at say 100mm/s, then the laser is going to be switching five times per mm and you might be able to see some kind of 0.2mm-scale pulse artefact in the resulting line.
I have no practical experience with CNC laser engravers but 100mm/s sounds kind of fast to me and 2ms isn't much time for a surface to heat or cool, so you probably won't see this, but there it is as a theoretical possibility. I still wouldn't be reaching for an Arduino before I'd tested the simple voltage divider, which you would still need in any case if you were going to use your existing PWM signal as input to an Arduino rather than feeding it directly to the laser.
The 3.9k/1k resistors I already recommended would be fine for an Arduino that expects 5V signal levels. If you're working with one that wants 3V logic levels, a 4.7k/680Ω divider would work for that.
posted by flabdablet at 10:11 PM on October 19, 2023
Response by poster: I avoid saying "Programmer with an Oscilloscope" because it's A) more dangerous than a screwdriver, and B) implies a level of knowledge I do not currently possess.
Speaking of which, somewhere down the line I managed to literally cross wires. There was smoke and despite 24V being delivered to the board no pins are now showing anything near that. The most I'm seeing is, ironically, the PWM circuit working perfectly at 4V.
(that fact leads me to wonder if there wasn't something wrong with the board before I started this, which provides me some comfort)
In any case thank you for your help. It clarified a great many things that I'm certain will be useful in the future.
posted by Tell Me No Lies at 7:50 AM on October 21, 2023
Speaking of which, somewhere down the line I managed to literally cross wires. There was smoke and despite 24V being delivered to the board no pins are now showing anything near that. The most I'm seeing is, ironically, the PWM circuit working perfectly at 4V.
(that fact leads me to wonder if there wasn't something wrong with the board before I started this, which provides me some comfort)
In any case thank you for your help. It clarified a great many things that I'm certain will be useful in the future.
posted by Tell Me No Lies at 7:50 AM on October 21, 2023
There was smoke
Oh dear.
24 volt magic smoke is particularly difficult to force back in once it's been let out.
posted by flabdablet at 3:08 AM on October 22, 2023
Oh dear.
24 volt magic smoke is particularly difficult to force back in once it's been let out.
posted by flabdablet at 3:08 AM on October 22, 2023
Maybe something like a "lm2596 buck converter" ?
(Seen just 30m ago on this guys video - https://www.youtube.com/watch?v=3M76VUJzwqY)
posted by rozcakj at 12:41 PM on October 23, 2023
(Seen just 30m ago on this guys video - https://www.youtube.com/watch?v=3M76VUJzwqY)
posted by rozcakj at 12:41 PM on October 23, 2023
A buck converter is for efficiently deriving a DC power supply from another whose voltage is higher, not for changing the logic level of a digital control signal.
posted by flabdablet at 8:34 PM on October 23, 2023
posted by flabdablet at 8:34 PM on October 23, 2023
Response by poster: Right. If anyone is still reading, my foreshadowing about programmers and oscilloscopes paid off when I realized I had accidentally flipped the scale switch on the probe and in fact the voltages were still fine despite the smoke.
I am now getting what looks to me to be the desired signal at the entry connector to the laser. I would appreciate if someone could look at these pictures and comment on whether I'm reading things correctly.
The laser is powering up (fan comes on) but never turning on for any of these states.
posted by Tell Me No Lies at 9:36 AM on October 24, 2023
I am now getting what looks to me to be the desired signal at the entry connector to the laser. I would appreciate if someone could look at these pictures and comment on whether I'm reading things correctly.
The laser is powering up (fan comes on) but never turning on for any of these states.
posted by Tell Me No Lies at 9:36 AM on October 24, 2023
What I think I'm looking at on those display pictures:
Top picture: neither probe 1 nor probe 2 sees any signal.
Middle picture: Probe 1 sees a DC signal at +5.37V with respect to ground, probe 2 sees no signal.
Bottom picture: Probe 1 sees a 490Hz pulse train whose voltage averages out to +2.63V with respect to ground, probe 2 sees no signal.
If all three pictures had probe 1 connected to the same signal, they're consistent with probing a PWM control signal, set for 0% duty cycle for the top picture, 100% duty cycle for the middle picture and a smidge under 50% for the bottom picture.
5.37V is kind of a weird logic level. Did you in fact build a voltage divider to get that from what used to be the power rail for your 24V fan? Or have I been labouring under a mistaken assumption that the 24V fan was a two-wire type with the wires being just PWM-gated power and ground, when in fact it was a three- or four-wire type with separate 24VDC and PWM control wires and possibly a fourth wire for a tacho output, and that the 5.37V pulse train you're now probing is what the fan was always being supplied with on its dedicated PWM control wire?
490Hz PWM with 5.37V for logic 1 is compatible with your laser driver board's spec for its PWM control input. So if the original fan did indeed have separate 24VDC and PWM wires, and the error you made involved connecting the fan's 24VDC power supply wire directly to the driver board's PWM input, then your laser's failure to turn on now makes sense to me: there's a chip on the driver board that's supposed to use a logic-level PWM input to gate the laser's power supply, that input is rated for +12V maximum, and connecting 24VDC to it has let the magic smoke out of the chip so it now doesn't work any more.
Unfortunately the photo of the driver board included in the information sheet you linked above is not detailed enough to let me identify the chips on it, so I can't be more specific than that.
posted by flabdablet at 4:48 PM on October 24, 2023
Top picture: neither probe 1 nor probe 2 sees any signal.
Middle picture: Probe 1 sees a DC signal at +5.37V with respect to ground, probe 2 sees no signal.
Bottom picture: Probe 1 sees a 490Hz pulse train whose voltage averages out to +2.63V with respect to ground, probe 2 sees no signal.
If all three pictures had probe 1 connected to the same signal, they're consistent with probing a PWM control signal, set for 0% duty cycle for the top picture, 100% duty cycle for the middle picture and a smidge under 50% for the bottom picture.
5.37V is kind of a weird logic level. Did you in fact build a voltage divider to get that from what used to be the power rail for your 24V fan? Or have I been labouring under a mistaken assumption that the 24V fan was a two-wire type with the wires being just PWM-gated power and ground, when in fact it was a three- or four-wire type with separate 24VDC and PWM control wires and possibly a fourth wire for a tacho output, and that the 5.37V pulse train you're now probing is what the fan was always being supplied with on its dedicated PWM control wire?
490Hz PWM with 5.37V for logic 1 is compatible with your laser driver board's spec for its PWM control input. So if the original fan did indeed have separate 24VDC and PWM wires, and the error you made involved connecting the fan's 24VDC power supply wire directly to the driver board's PWM input, then your laser's failure to turn on now makes sense to me: there's a chip on the driver board that's supposed to use a logic-level PWM input to gate the laser's power supply, that input is rated for +12V maximum, and connecting 24VDC to it has let the magic smoke out of the chip so it now doesn't work any more.
Unfortunately the photo of the driver board included in the information sheet you linked above is not detailed enough to let me identify the chips on it, so I can't be more specific than that.
posted by flabdablet at 4:48 PM on October 24, 2023
Response by poster: If all three pictures had probe 1 connected to the same signal, they're consistent with probing a PWM control signal, set for 0% duty cycle for the top picture, 100% duty cycle for the middle picture and a smidge under 50% for the bottom picture.
Yes, this is what the pictures were meant to show. Probe 2 was not connected in any of them.
The fan circuit was 3 wires -- Ground, Vcc, and PWM. I don't have the specs for the printer but the measurements were consistent with that. Voltages and duty cycles are different, but the wiring itself appears to be identical for the fan and laser.
The voltage is... weird, and makes me once again question my ability to measure accurately. The resistors are 2.2k and 4.4k and working backwards that seems to imply the max voltage is 16.8v?
I too fear for the laser, but the smoke escaped from the board while the laser was not connected. It's entirely possible that I accidentally hooked up the overpowered PWM at some other point, so that circuit being dead is not out of the question.
I'm going to move the laser back to the bench and run some tests, but modulo some measurement errors on my part your approach seems to have yielded exactly what I was looking for.
posted by Tell Me No Lies at 11:08 PM on October 24, 2023
Yes, this is what the pictures were meant to show. Probe 2 was not connected in any of them.
The fan circuit was 3 wires -- Ground, Vcc, and PWM. I don't have the specs for the printer but the measurements were consistent with that. Voltages and duty cycles are different, but the wiring itself appears to be identical for the fan and laser.
The voltage is... weird, and makes me once again question my ability to measure accurately. The resistors are 2.2k and 4.4k and working backwards that seems to imply the max voltage is 16.8v?
I too fear for the laser, but the smoke escaped from the board while the laser was not connected. It's entirely possible that I accidentally hooked up the overpowered PWM at some other point, so that circuit being dead is not out of the question.
I'm going to move the laser back to the bench and run some tests, but modulo some measurement errors on my part your approach seems to have yielded exactly what I was looking for.
posted by Tell Me No Lies at 11:08 PM on October 24, 2023
The fan circuit was 3 wires -- Ground, Vcc, and PWM.
Can you show me another three sets of scope traces for PWM 0, 50%, 100%, all three having the scope hooked up to the plug that used to supply your 24V fan and that plug connected to nothing but the scope, with both of the scope probes' grounds connected to Ground, probe 1 connected to PWM, and probe 2 connected to Vcc?
the smoke escaped from the board while the laser was not connected
Which board?
posted by flabdablet at 12:36 AM on October 25, 2023
Can you show me another three sets of scope traces for PWM 0, 50%, 100%, all three having the scope hooked up to the plug that used to supply your 24V fan and that plug connected to nothing but the scope, with both of the scope probes' grounds connected to Ground, probe 1 connected to PWM, and probe 2 connected to Vcc?
the smoke escaped from the board while the laser was not connected
Which board?
posted by flabdablet at 12:36 AM on October 25, 2023
What concerns me is that you say your fan was 24V, and yet you've got its Vcc, which I'm presuming is a steady 24V with probably some degree of grunt behind it, connected to Vcc on the laser and I'm not at all convinced that your laser wants 24V on its own Vcc.
"Vcc" is just fancy electronics talk for "DC power supply, usually positive"; it doesn't imply any particular voltage in and of itself, and you cannot rely on one device's Vcc output being compatible with another's Vcc input purely on the strength of their being labelled the same.
The laser user manual does indeed specify "12 or 24V" for the laser module driver board's Vcc, but I'm gathering from context that the laser is available in two models, one built for a 12V power supply and the other built for 24V. Working with that assumption is the only way I can make sense of the "Only voltage not matched" section on page 7.
Can you show me a photo of your laser module driver board (the one pictured on page 4 of the user manual)? Because I'm pretty sure that the voltage it actually wants will be whatever is silkscreened onto the board next to the input connector's Vcc pin. And if that isn't 24V, having your voltage divider adapter board connect the fan's Vcc pin to the laser module driver board's Vcc input is a potentially catastrophic error.
posted by flabdablet at 12:55 AM on October 25, 2023
"Vcc" is just fancy electronics talk for "DC power supply, usually positive"; it doesn't imply any particular voltage in and of itself, and you cannot rely on one device's Vcc output being compatible with another's Vcc input purely on the strength of their being labelled the same.
The laser user manual does indeed specify "12 or 24V" for the laser module driver board's Vcc, but I'm gathering from context that the laser is available in two models, one built for a 12V power supply and the other built for 24V. Working with that assumption is the only way I can make sense of the "Only voltage not matched" section on page 7.
Can you show me a photo of your laser module driver board (the one pictured on page 4 of the user manual)? Because I'm pretty sure that the voltage it actually wants will be whatever is silkscreened onto the board next to the input connector's Vcc pin. And if that isn't 24V, having your voltage divider adapter board connect the fan's Vcc pin to the laser module driver board's Vcc input is a potentially catastrophic error.
posted by flabdablet at 12:55 AM on October 25, 2023
The voltage is... weird, and makes me once again question my ability to measure accurately. The resistors are 2.2k and 4.4k and working backwards that seems to imply the max voltage is 16.8v?
I think what's probably happening here is that the fan's PWM signal is coming out of a drive circuit that is itself a voltage divider, where the top resistor (between Vcc and the output) is a real resistor, and the bottom one (between the output and ground) is a transistor whose effective resistance is either very close to zero (if the output is supposed to be low) or very nearly infinite (if the output is supposed to be high).
It will be that way because (a) the signal that actually controls it is at a much more "normal" logic level, like 0V for logic zero and 3V for logic 1 (b) one transistor plus one resistor (or two, if the transistor in question is a bipolar junction transistor rather than a FET) is very cheap, and (c) unlike for a two-wire fan that's actually being powered by the PWM signal, this is purely a control signal and doesn't need to supply significant amounts of current.
If we assume that (a) the voltage supplied to the top of the top resistor is +24V and (b) the output of your own little voltage divider has a negligible load on it, which is justified if all it's driving is a scope probe and maybe a CMOS input, then we can even work out the value of that top resistor (which I'll call Rs, for source resistance) as follows:
When the fan PWM signal is logic high (i.e. would be 24V if it had no load on it) then Vout from your little divider is 5.37V = 24V * 2.2k / (Rs + 4.7k + 2.2k).
Multiplying both sides by (Rs + 4.7k + 2.2k) / 5.37V, we get
Rs + 4.7k + 2.2k = 24V / 5.37V * 2.2k = 9.8k
So Rs is 9.8k - 4.7k - 2.2k = 2.9k. Which means that when the output transistor is pulling the output down to 0V, Rs will be dissipating (24V)2 / 2.9kΩ = ~200mW, which is close to a quarter of a watt, which is a pretty common power rating for resistors, which is probably why they picked a resistance no lower than that.
As another sanity check: a voltage divider with 2.9k in the R1 position and your whole divider string (4.7k + 2.2k) in the R2 position, fed from 24V, would output (4.7k + 2.2k) / (2.9k + 4.7k + 2.2k) * 24V = 16.8V, which is what you initially back-calculated as the max voltage for logic 1.
posted by flabdablet at 2:00 AM on October 25, 2023
I think what's probably happening here is that the fan's PWM signal is coming out of a drive circuit that is itself a voltage divider, where the top resistor (between Vcc and the output) is a real resistor, and the bottom one (between the output and ground) is a transistor whose effective resistance is either very close to zero (if the output is supposed to be low) or very nearly infinite (if the output is supposed to be high).
It will be that way because (a) the signal that actually controls it is at a much more "normal" logic level, like 0V for logic zero and 3V for logic 1 (b) one transistor plus one resistor (or two, if the transistor in question is a bipolar junction transistor rather than a FET) is very cheap, and (c) unlike for a two-wire fan that's actually being powered by the PWM signal, this is purely a control signal and doesn't need to supply significant amounts of current.
If we assume that (a) the voltage supplied to the top of the top resistor is +24V and (b) the output of your own little voltage divider has a negligible load on it, which is justified if all it's driving is a scope probe and maybe a CMOS input, then we can even work out the value of that top resistor (which I'll call Rs, for source resistance) as follows:
When the fan PWM signal is logic high (i.e. would be 24V if it had no load on it) then Vout from your little divider is 5.37V = 24V * 2.2k / (Rs + 4.7k + 2.2k).
Multiplying both sides by (Rs + 4.7k + 2.2k) / 5.37V, we get
Rs + 4.7k + 2.2k = 24V / 5.37V * 2.2k = 9.8k
So Rs is 9.8k - 4.7k - 2.2k = 2.9k. Which means that when the output transistor is pulling the output down to 0V, Rs will be dissipating (24V)2 / 2.9kΩ = ~200mW, which is close to a quarter of a watt, which is a pretty common power rating for resistors, which is probably why they picked a resistance no lower than that.
As another sanity check: a voltage divider with 2.9k in the R1 position and your whole divider string (4.7k + 2.2k) in the R2 position, fed from 24V, would output (4.7k + 2.2k) / (2.9k + 4.7k + 2.2k) * 24V = 16.8V, which is what you initially back-calculated as the max voltage for logic 1.
posted by flabdablet at 2:00 AM on October 25, 2023
Response by poster: The laser user manual does indeed specify "12 or 24V" for the laser module driver board's Vcc, but I'm gathering from context that the laser is available in two models, one built for a 12V power supply and the other built for 24V.
Ding ding ding! I went to the ordering page and indeed there are separate options for 12v and 24v. And I ordered the 12V.
So, I need to redo the bench test with 12V and see if I've bricked the laser. Then I'm guessing it will be time to reinstall my older, wimpier laser that I know takes 12V. However, my old wiring only supported 0% and 100% and now I know how to wire it for gradations.
Just for grins here is the wiring for the old extruder. The ribbon cable plugs into the controller board on the printer. I mis-remembered the wiring for the fan and pwm although from a logical standpoint they are still 3 lines.
Thank you again for going the extra mile here.
posted by Tell Me No Lies at 11:14 AM on October 25, 2023
Ding ding ding! I went to the ordering page and indeed there are separate options for 12v and 24v. And I ordered the 12V.
So, I need to redo the bench test with 12V and see if I've bricked the laser. Then I'm guessing it will be time to reinstall my older, wimpier laser that I know takes 12V. However, my old wiring only supported 0% and 100% and now I know how to wire it for gradations.
Just for grins here is the wiring for the old extruder. The ribbon cable plugs into the controller board on the printer. I mis-remembered the wiring for the fan and pwm although from a logical standpoint they are still 3 lines.
Thank you again for going the extra mile here.
posted by Tell Me No Lies at 11:14 AM on October 25, 2023
Response by poster: Yup, bricked the new one. Old one still works but the new voltage drop for it will allow more flexibility and the redone wiring is much prettier. All in all a pretty successful failure to upgrade.
posted by Tell Me No Lies at 11:41 AM on October 25, 2023
posted by Tell Me No Lies at 11:41 AM on October 25, 2023
Glad you got a result.
Still curious about exactly which board smoked, though.
posted by flabdablet at 4:06 PM on October 25, 2023
Still curious about exactly which board smoked, though.
posted by flabdablet at 4:06 PM on October 25, 2023
If you're going to power your new 24V laser off wiring that used to power a 24V fan, you'll want to make sure that the fan's original power supply is actually grunty enough to supply the current that the new laser will want to draw.
Your manual specifies 1.5A for the 24V version, or 3A for the 12V version; in both cases that works out to 36 watts. You can make a cheap and robust 40 watt test load out of 12V automotive bulbs: get four 12 volt 10 watt tail lamp bulbs, then wire them like this:
To load test a 12V supply, connect it between points A and B and also connect point C to point A. Again, if the supply is good for 40 watts it will light up all the bulbs while maintaining a full 12V across them.
If you use this rig to test both your 24V fan connector and the 12V power supply you're currently using for the wimpy laser, you might find out that replacing the bricked one with another 12V model is your better option.
posted by flabdablet at 4:44 PM on October 25, 2023
Your manual specifies 1.5A for the 24V version, or 3A for the 12V version; in both cases that works out to 36 watts. You can make a cheap and robust 40 watt test load out of 12V automotive bulbs: get four 12 volt 10 watt tail lamp bulbs, then wire them like this:
A ------+-----+ | | 💡 💡 | | B ------+-----+ | | 💡 💡 | | C ------+-----+To find out whether a 24V supply can handle a 40 watt load, connect it between points A and C, then measure the voltage between those points. If the supply is good for that amount of load, it will light up all the bulbs while maintaining 24V and not leaking any smoke.
To load test a 12V supply, connect it between points A and B and also connect point C to point A. Again, if the supply is good for 40 watts it will light up all the bulbs while maintaining a full 12V across them.
If you use this rig to test both your 24V fan connector and the 12V power supply you're currently using for the wimpy laser, you might find out that replacing the bricked one with another 12V model is your better option.
posted by flabdablet at 4:44 PM on October 25, 2023
Response by poster: The smoke came out of the printer chassis.
There are four items of note inside the chassis: the power supply, the main controller board, the LCD controller board, and something I can't identify that is just a couple of components hooked together on a cable that runs between the power supply and a socket named POWER-DET on the controller board.
None of these items have any obvious char marks on them and there's no melted plastic anywhere. Given the location the smoke came out of the controller board is the most obvious candidate, but a very close inspection has revealed nothing. On the other hand I haven't cracked open the power supply so there could be something charred inside that.
Thank you for the information on testing the power supply... the thing claims to be pretty beefy and now that I'm drawing power directly from it (another excellent benefit of this side quest) I'm pretty confident in it. Having recently demonstrated the actual value of me being confident in something, it's good to have a way to double check. :-)
posted by Tell Me No Lies at 5:46 PM on October 25, 2023
There are four items of note inside the chassis: the power supply, the main controller board, the LCD controller board, and something I can't identify that is just a couple of components hooked together on a cable that runs between the power supply and a socket named POWER-DET on the controller board.
None of these items have any obvious char marks on them and there's no melted plastic anywhere. Given the location the smoke came out of the controller board is the most obvious candidate, but a very close inspection has revealed nothing. On the other hand I haven't cracked open the power supply so there could be something charred inside that.
Thank you for the information on testing the power supply... the thing claims to be pretty beefy and now that I'm drawing power directly from it (another excellent benefit of this side quest) I'm pretty confident in it. Having recently demonstrated the actual value of me being confident in something, it's good to have a way to double check. :-)
posted by Tell Me No Lies at 5:46 PM on October 25, 2023
something I can't identify that is just a couple of components hooked together on a cable that runs between the power supply and a socket named POWER-DET on the controller board
I'm guessing that those components are just a couple of resistors wired as a voltage divider, so that when 24V gets applied to the power supply end of that cable, a lower-voltage logic 1 appears at the POWER-DET (power detect?) socket.
This kind of thing is sometimes seen in designs that have an on-board DC voltage converter to supply the computery bits. Given that computery bits that run on 24V basically don't exist, that's sure to include your printer's controller board.
Those voltage converters will often have enough energy stored in assorted capacitors to keep the computer running for a second or two after the upstream supply is shut off, and sometimes it's useful to have a bit of early warning that that has just happened.
The smoke came out of the printer chassis. ... None of these items have any obvious char marks on them and there's no melted plastic anywhere.
If you're exceedingly lucky, it might just have been a wire that got a bit hot. A thinnish bit of wire that briefly short-circuits a 24V 350W power supply's output might well get hot enough to vaporize a little of its PVC jacket without causing visible burn marks.
But I wouldn't be at all surprised to find that the printer is now impaired in some way that will show up in due course.
posted by flabdablet at 6:10 PM on October 25, 2023
I'm guessing that those components are just a couple of resistors wired as a voltage divider, so that when 24V gets applied to the power supply end of that cable, a lower-voltage logic 1 appears at the POWER-DET (power detect?) socket.
This kind of thing is sometimes seen in designs that have an on-board DC voltage converter to supply the computery bits. Given that computery bits that run on 24V basically don't exist, that's sure to include your printer's controller board.
Those voltage converters will often have enough energy stored in assorted capacitors to keep the computer running for a second or two after the upstream supply is shut off, and sometimes it's useful to have a bit of early warning that that has just happened.
The smoke came out of the printer chassis. ... None of these items have any obvious char marks on them and there's no melted plastic anywhere.
If you're exceedingly lucky, it might just have been a wire that got a bit hot. A thinnish bit of wire that briefly short-circuits a 24V 350W power supply's output might well get hot enough to vaporize a little of its PVC jacket without causing visible burn marks.
But I wouldn't be at all surprised to find that the printer is now impaired in some way that will show up in due course.
posted by flabdablet at 6:10 PM on October 25, 2023
And if you're wiring stuff directly to that power supply, please please please be double triple quadruple super extra careful with its terminal strip. Having the mains input right next to the DC output on a single strip that uses the same kind of fully exposed screw terminals for both is horrible design from a safety point of view. Make absolutely sure that none of the wiring you're screwing down to those terminals has dangling whiskers before you plug the thing into the mains.
posted by flabdablet at 6:20 PM on October 25, 2023
posted by flabdablet at 6:20 PM on October 25, 2023
Response by poster: The connections are not made directly to the power supply but rather where the 24V leads connect to the controller board. I agree with you entirely about the "let's make life exciting" layout of the power supply terminals.
posted by Tell Me No Lies at 8:18 PM on October 25, 2023
posted by Tell Me No Lies at 8:18 PM on October 25, 2023
And I agree with you that that PSU is likely to be more than grunty enough to have 40W to spare for running a laser. Using the 24V version of the laser also means that the wiring to it needs to carry only half the current that the 12V version would draw; the 1.5 amps it wants should be well within the capacity of even a relatively skinny ex-fan wiring loom, so there's probably no need to build the light bulb load-testing rig.
Once you get the thing wired up and working I'd love to see some photos of its first test burns!
posted by flabdablet at 11:33 PM on October 25, 2023
Once you get the thing wired up and working I'd love to see some photos of its first test burns!
posted by flabdablet at 11:33 PM on October 25, 2023
« Older Finding Details of a California Criminal Case... | Direction for Western U.S. train trip? Newer »
This thread is closed to new comments.
Reason I ask: if it is another fan, or something similarly mechanical that is just going to average out that PWM signal and treat it as effectively equivalent to an analog voltage - especially if the response time to changes doesn't have to be at all quick - then doing the conversion in the digital domain is way, way overkill.
If in fact you do just want to power a different fan from this thing, then there is almost certainly a way to use a very small number of analog components to limit the voltage excursions into a safe range for the new fan in a way that would let you get away with not even having to provide another source of 12V power for it.
posted by flabdablet at 5:35 PM on October 18, 2023