Why are boards that have software-controllable stepper current settings using those super-expensive Digipot chips instead of something as simple as an SPI PWM chip (+ a two-component lowpass), a real DAC or even one of the spare outputs of the ATMega? After all, all the stepper driver needs is a reference voltage and not a reference resistance.
Excellent question. The designers were probably looking at the pot, and thinking, “how can I make that digital?”, rather than looking beyond the pot and thinking, "how can I give that chip its input without using this pot? "
It is the evolutionary vs. revolutionary approach. I think RepRap projects do this a lot. I am more in favour of revolution as a means to make progress.
A lot of the 32 bit mcu’s have a DAC which will get job done.
Pwm would only be good if it didn’t need constant commands and it doesn’t create too much noise.
There are also programmable voltage supplies which would work, though they might need a bigger load.
I’m voting you up because I understand some of these words and 100% of everything you post is good stuff.
You might have to ask Johnny about that. But at first glance, I don’t know if equivalent DAC is necessarily cheaper than an equivalent resolution digipot being used.
A PWM with filters might do.
What’s amusing is the Vref is fed into an internal DAC on the driver.
@Stephanie_A It might be possible to operate the PWM output in a free-running mode where frequency and duty cycle are hardware controlled. That would be low-overhead and generate the least error. I wish that 32 bit devices had more than one DAC. I guess lots of analogue inputs are easily provisioned by a multiplexer but analogue outputs require dedicated circuits (discounting the use of polled sample and hold mechanisms).
Well, most of the controller boards are running low on available PWM outputs, so using one for each stepper may not be an option. There could also be issues with using a less than steady output voltage, as would be the case if you filter PWM. I can imagine the PWM frequency going into VREF interacting with the sampling rate (which I’m guessing varies with the stepper driver’s output frequency, which itself varies with duty cycle since most stepper drivers use a fixed off- or on-time rather than a fixed frequency) causing some big problems that you would have to smooth the PWM a LOT to avoid.
As for a DAC, I don’t see any obvious reason that wouldn’t work. You could even follow it with a voltage divider or two to scale its output range to that of the VREF input to get the most out of the DAC’s resolution.
I just looked it up, the A4988 draws ±3µA from the reference voltage, so PWM + a high-resistance RC lowpass would be virtually ripple-free. Hardware PWM channels are limited, but isn’t Marlin doing interrupt-based, “software” PWM anyways? As far as precision goes, how much do we need? I feel that 8 bits are already overkill, 6 bits should easily do.
RC filtered PWM or DAC is exactly how you want to do it. Eeprom pots are great when you want the values to be persistent immediately after power up, or have very simple up/down controls, or the pot is actually used as a linear passive in an analog design.
Tl; dr: yes.
@Thomas_Sanladerer I thought about designg a ARM Cortex-M4 based board with the following DAC MCP4728 4 channel DAC with i2c. Which seems to cost around 2€ and should be sufficient. The i2c DAC approach saves GPIOs and CPU.
BTW Printrboard http://reprap.org/wiki/Printrboard is using this DAC.
@Thomas_Sanladerer Ultimaker is using the free atmega PWM channels. I do not know why the other boards do not use it.
@Whosa_whatsis You need to filter PWM adequately to create a true analogue signal anyway. Ripple would be due to loading of the filter in which case you might add a buffer or make the filter an active type.
Does Marlin implement per-stepper digipot control? I did not notice any, immediately obvious, channel select logic the last time I browsed that area of code.
@Neil_Darlow yes, it’s per-stepper (driver)
@Neil_Darlow A simple RC filter is enough.
@erik_vdzalm Likely it would be. My post was intended to show how shortcomings of the technique can be worked around. To quote one of my mentors “Sometimes a little over-engineering can bring benefits”.
Having finally gotten around to looking at the RAMBo schematics, one chip does all the drivers, and the price doesn’t seem that high to me: