This circuit was found in old documentation, but it adapts perfectly to modern applications with microcontrollers such as shield. The transistor can be a general-purpose equivalent and the error amplifier can be implemented with an operational amplifier.