For a sensor I’ve been fooling around with, I needed a supply which can switch between 5V and 1.4V, supplying up to about 200 mA.

There are several ways to do this, but I decided to use the MCP1825 adjustable voltage regulator:

The trick is to create an adjustable voltage divider, using a MOSFET to short out one of the resistors:

When off, the MOSFET does nothing, with R2 and R3 in series. When on, R3 is essentially shorted out.

The regulator varies its output voltage (top of R1) such that the level between R1 and R2 always stays at 0.41V:

So the task is to come up with suitable values for R1, R2, and R3. Let’s start with the 5V output and R1 = 10 kΩ:

- 5V = 0.41V x (10 kΩ + R2) / R2
- then 5 x R2 = 0.41 x (10,000 + R2) = 4,100 + 0.41 x R2
- and 5 x R2 – 0.41 x R2 = 4,100, i.o.w. 4.59 x R2 = 4,100
- that would make R2 = 4,100 / 4.59 = 893 Ω

Now for the 1.4V output level (where R2′ is R2 in series with R3):

- 1.4V = 0.41V x (10 kΩ + R2′) / R2′
- then 1.4 x R2′ = 0.41 x (10,000 + R2′) = 4,100 + 0.41 x R2′
- and 1.4 x R2′ – 0.41 x R2′ = 4,100, i.o.w. 0.99 x R2′ = 4,100
- that would make R2′ = 4,100 / 0.99 = 4141 Ω

But that’s not quite right, because R2 and R2′ have to be in the range 10 .. 200 kΩ. This is easy to fix by making R1 = 220 kΩ. Then the above values all increase by a factor 22 as well – bringing both R2 and R2′ nicely in range:

- for 5V: R2 = 19.6 kΩ
- for 1.4V: R2′ = 91.1 kΩ

IOW, two resistors of 19.6 kΩ and 71.5 kΩ in series would work, whereby the 71.5 kΩ resistor can be shorted out with the MOSFET to take it out of the loop.

These are not very convenient values, for resistors in the E12 series – let’s try and improve on that. After all, we can choose these values any way we like, as long as their *relative* values stays the same. With 15 kΩ and 54.7 kΩ, R1 would have to be 168 kΩ. That’s not so bad, we could use 15 kΩ, 56 kΩ, and 68 kΩ in series with 100 kΩ, resp.

Or, better still, perhaps: 19.6 kΩ ≈ 10 + 10 kΩ, and 71.5 kΩ ≈ 33 kΩ + 39 kΩ. With R1 kept at 220 kΩ. This needs 5 resistors in total to get the desired results. Now let’s try it out *for real*, eh?

*Yippie – it works! Voltages with 200 mA load are 1.38 V and 4.89 V, respectively – close enough.*

With 5 V input, the output is still 4.86 V @ 200 mA, proving that the MCP1825 is indeed a *low-dropout* regulator. The switching edges look clean on the oscilloscope, with rise and fall times of ≈ 30 µs (1 µF cap charge/discharge).

*Onwards!*

My guess its a gas sensor (like methane, C02 or similiar), they have to be run at two voltages ;-)

18 April 2012at1amBingo – CO2. It sure is hard to keep a secret on this weblog! :)

18 April 2012at1amYay! Thanks for that Tim, I’ve been scratching my head for the past hour!

18 April 2012at2amI am using two of these sensors: http://www.sstsensing.com/Products/Gas-Sensors/CO2-Sensors/CO2S-PPM-Ambient-Range-CO2-Sensor/172 Advantage is very low power consumption. Costs around 75€ per sensor. I have a 5000ppm type. They seem to work well.

18 April 2012at10amIt seems the Cozir one http://www.cozir.com They also showed a demo of a self-powerred version with Enocean energy harvester that could do 3 measurements every 10 minutes and send it via radio (Enocean). http://www.enocean-alliance.org/en/gss_co2_ish2011/

It could be great to develop a Jeenode with Enocean radio and energy harvesting hardware :-)

Ciao, Marco.

21 April 2012at1pm