BUS PIRATE: 0.8-5.0volt programmable output power supply

  1. MOSI
  2. CLOCK
  3. MISO
  4. CS
  5. AUX
  6. AUX2 (formerly ADC)
  7. Vpu
  8. 3.3V
  9. 5.0V
  10. GND

After adding buffered voltage measurements to every IO pin, we eliminated the dedicated ADC pin and turned it into a general purpose IO (AUX2). Now we’re going to take a hatchet to the on-board voltage regulators (3.3V, 5.0V) and replace them with a robust programmable output power supply.

Power supplies background

On-board power supplies are toggled with w and W.

The Bus Pirate has two on-board voltage regulators that can power a board or chip. The supplies are enabled with the W and w commands. The Bus Pirate supplies the two most common voltages through two dedicated pins because it was the simplest approach and it “just works”.

3.3volt and 5.0volt on-board power supplies.

The Bus Pirate has always had a 5volt regulator because so much hobby electronics stuff like the Arduino runs at 5volts. 3.3volts is very popular in more modern systems, such as the Bus Pirate itself. However, there’s no reason you couldn’t swap those regulators with a compatible part with output in the 0-5volt range.

Common SOT-23-5 LDO regulator with shutdown pin. Source: MCP1801 datasheet page 1.

There are tons of manufacturers of SOT-23-5 low drop out voltage regulators with a shutdown pin that use the same footprint and have somewhat similar specs. We specify the Microchip MCP1801 in new designs.

Programmable output power supply

5volts and 3.3volts are useful voltage nodes for everyday hacking. A more useful power supply would be programmable from the terminal, and cover as wide a range as possible ( 0.8, 1.2, 1.8, 2.5, 3.0, 3.3, 5.0volts).

There are a few ways to concoct a programmable supply. A simple buck converter driven by a PWM pin with feedback through an ADC is a very cheap solution, but it has no safety features whatsoever. A dedicated buck converter chip is a better option, but still has the potential to be a big source of noise on the board.

MCP1824 adjustable output LDO. Output set by R1 and R2. Source: MCP1824 datasheet page 3

Ideally, we’d like to abuse an adjustable low drop out regulator because they have very clean output with built-in current protection, short circuit protection and thermal protection. MCP1824 is adjustable from 5volts all the way down to 0.8volts, the output voltage is set by feedback resistors R1 and R2. One way to make the output programmable is an array of different resistor values selected (grounded) by an IO expander or MCU pin. This would give steps, but not the full range.

Another option is a digital potentiometer or rheostat. In our experience it’s difficult to satisfy the feedback/adjust requirements of most LDOs while also getting a usable range of output voltages using a digital pot. Additionally, digital pots have very low bandwidth and inexpensive chips like the MCP444x are unsuitable for this purpose.

Output from U14 margins the adjustment voltage of IC12 through R30, R31, R32.

Texas Instruments has a video and tutorial explaining how to offset (or margin) the feedback voltage of an LDO using an op-amp driven by a Digital to Analog Converter or Pulse Width Modulator. It just so happens our STM32F103 has two DACs. The DACs have an optional internal buffer, but the internet suggests it’s not really rail to rail.

The output of the DAC is applied to the non-inverting input of an op-amp. The op-amp output margins the feedback voltage on the MCP1824 ADJ pin through R30, R31, R32. The values for the resistors were calculated to give 0.8-5.0volt output range with 0-3.3volt DAC output.

Always use protection

PFET Q2 acts as a diode to protect the power supply.

The output of the adjustable regulator goes into a nifty little circuit (Q1, Q1B, Q2, R34, R35) that acts like a diode but has negligible voltage drop. A PFET (Q2) is used as an ideal diode to stop current backflow if an external power supply is present.

Updated pinout

  1. MOSI
  2. CLOCK
  3. MISO
  4. CS
  5. AUX
  6. AUX2 (formerly ADC)
  7. Vpullup
  8. AUX4 (formerly 3.0Volts)
  9. 0.8-5.0Vout (formerly 5.0Volts)
  10. GND

Both on-board regulators (3.3, 5volts) could be swapped with programmable output power supplies, but that seems like overkill. Pin 9 becomes a 0.8-5.0volt power supply named Vout, while pin 8 is now available for general purpose IO and is renamed AUX4.

We have very nearly reached our goal of 8 IO pins! Next we’ll rethink the Vpullup pin and the on-board pull-up resistors. If you want to skip the wait, our latest work is in the forum.

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.