Need a cheap adjustable voltage regulator with an enable/disable input for remote control? Here's a little hack I cooked up the other day that I thought might be of interest.
I started with an MP1584 switching regulator. Modules based on this chip are available cheaply everywhere. The one I used was from Amazon and cost less than $2:
It's rated for an input voltage of 4.5V to 28V, an output voltage of 0.8V to 20V (adjustable via pot on the board), and an output current of 3A. More than enough to power almost any lighting or accessory imaginable. You need to provide it DC power, of course. If you want it track powered, as I did, a simple bridge rectifier and capacitor will do the trick.
All well and good, but I wanted it to be remotely controllable via a function output from a DCC decoder. There is no provision for this on the module, but there is an easy way to add it. The MP1584 has an enable pin. If it is left floating, the regulator output is enabled. If it is grounded, the regulator output is disabled. On this module (and a few others I looked at), it is unconnected on the PCB. To use it, I just soldered a small wire directly to the enable pin on the chip. Just about any logic input can be used to control it at this point - ground the pin to disable the output, or leave it floating or apply voltage (6V max!) to enable the output.
'Case Study'
Here is the specific installation I was working with. I wanted to provide DCC on/off control for the motor and LEDs in an MTH Railking aquarium car.
Note that while this specific case is for a DCC installation, the same approach could be used for any microprocessor control (Arduino, etc) or even a simple remote toggle switch wired to ground. Also, A typical DCC decoder grounds the function output when it is 'on', so in the case of controlling it directly from a decoder, the 'on' and 'off' states of the regulator will be reversed. Some decoders (ESU for example) allow you to swap the logic of the output to correct this. If not, well, I did say it was a cheap hack...
Here is the original board. It already has a bridge rectifier and cap, as well as connectors for the motor, LEDs, pickups, and even an on/off switch. I retained all of this, removing just the linear regulator. Very handy!
Here is the MTH board with the original regulator removed. The two small green boards are the NCE Light-It decoder I was using (on the left, costs about $5), and the voltage regulator (on the right).
Here is the regulator with the enable wire (black) attached. The gray/red wires are the DC input and output.
And here is the decoder/regulator combo installed on the original board. I stuck them back to back with double sided tape. The regulator input/output wires go the the original input/output holes on the PCB. The decoder gets it's track power via the two conductor gray wire soldered to the input of the rectifier. The whole thing can be disabled entirely by the switch on the bottom of the car.
And finally, here it is back in the car:
I suppose I should post a video showing the finished results, but you can probably picture the fishes swimming around in the car.