I have a model train set which runs on 0-12v based on the position of a rotary encoder. I would like to have somewhat granular, digital control over the voltage on the track.
So far, I'd implemented one of those bog standard eBay's finest voltage controllers, which has a potentiometer on the input, thus can't be controlled from a Raspberry Pi.
I then moved on to the L298N (see thread in Context), but this produces a few problems - namely a "lumpy" DC output, producing resonance in the motor windings, as well as very rough running. I'm now contemplating adding a smoothing circuit to this, but need to understand the electronics behind it to do so.
Another option I'm looking at is the possibility to use a digital potentiometer in conjunction with one of the earlier mentioned motor controllers, which would theoretically give as smooth running as I had previously on the analog input system, with the addition of digital control.
I've considered an ADC, however these are generally more audio-focused, and in my experience tend to cap out at 5v. If this is the right solution, I could do with some direction in terms of a chip or part number for a board that would work.
I'm currently not sure if I'm trying to reinvent the wheel. I suspect this problem has been encountered before, be that for controlling lighting, audio, motors, or any other auxiliary device from a Pi.
I've recently created this thread questioning how to make this work with an L298N.