# Buck converter for ATTiny power supply?

I’ve found myself needing to use a buck converter to step down voltage from two Li-ion batteries in series to power an ATtiny261 (max input voltage 5.5V, down from the nominal 7.4V of the batteries), as well as possibly a second buck converter to power some nitinol shape-memory springs. However, even looking at the datasheet, I’m unfamiliar with how to get the voltage I want.

They provide a circuit which outputs 3.3V at a maximum of 0.5A, but the nitinol springs I intend to use require a different voltage (about 6.55 V). What parts of this circuit do I need to change to change the output voltage? Also, how accurate would this buck converter be?

This is the one almost everyone uses.
I don't know why you did not choose a complete plug & play solution like this.

Unfortunately, I have space limitations - something like 25mm to a side maximum for the board would be the best I can do, and that one appears to have a length of 45mm. With the one above, I can probably get it all to fit on a custom board in Eagle.

How about one of the Pololu regulators like this one?

0.5" x 0.4" should fit your requirements.

What parts of this circuit do I need to change to change the output voltage?

The output voltage is set by the ratio of R2 and R3. Increase R2 for a higher output voltage. From the data sheet the voltage on pin 6 should be 800mV, calculate the new value of R2 to give 800mV with the output of 6.55V.

You might not be able to get 6.55V from 7.4V input as the input to output difference might not be enough. No harm trying. Also, that assumed the batteries are fully charged.

elementcollector1:
I've found myself needing to use a buck converter to step down voltage from two Li-ion batteries in series to power an ATtiny261

That processor will do just fine on a single LiPo (3.2-4.2V depending on charge level). You may have to limit the speed to 8 MHz or so.

the nitinol springs I intend to use require a different voltage (about 6.55 V).

This requires more explanation. A Google search told me that nitinol is a shape memory alloy, and there's nothing about it that normally needs to be powered. It's a metal spring. So what are you actually trying to do here?

Nitinol actuators work by passing enough current through the device to make it hot enough to pass through the transition temperature. And then letting them cool (which is rather depressingly slow.)
A device like a spring tends to take quite a bit of current; I don't know whether one of the tiny buck modules will work. (well, you can certainly get very high-current buck modules, but they tend to be expensive...)

wvmarle:
That processor will do just fine on a single LiPo (3.2-4.2V depending on charge level). You may have to limit the speed to 8 MHz or so.

This requires more explanation. A Google search told me that nitinol is a shape memory alloy, and there’s nothing about it that normally needs to be powered. It’s a metal spring. So what are you actually trying to do here?

Trouble is, I need more voltage to get the proper current for the nitinol actuators (about 320 mA), which essentially act like resistors.

To explain further, the circuit has several (at least 6) nitinol springs surrounded by regular springs that work as reversible actuators. When powered, the nitinol (hopefully, since I have trouble calculating the spring constant) overpowers the steel spring, expanding outward as current flows through it and heats it up due to resistive/joule heating. When not powered, the nitinol cools down, exerting less force and allowing itself to be pulled back to the original position by the steel springs. The amount of current needed by the nitinol is determined by the actuation time wanted (in this case, 1 second assuming no heat lost to the environment) and the radius of the wire (smaller requiring less current).

While I could use a single LiPo to power the ATtiny itself, the max available current from the highest-density single cell I could find that meets space limitations is around 200 mA (part# RJD2450 on DigiKey), below what I need. I could, in theory, decrease the radius of the nitinol wires to lower the current required, but past a certain point they wouldn’t have enough force on expansion to override the steel springs.

The output voltage is set by the ratio of R2 and R3. Increase R2 for a higher output voltage. From the data sheet the voltage on pin 6 should be 800mV, calculate the new value of R2 to give 800mV with the output of 6.55V.

You might not be able to get 6.55V from 7.4V input as the input to output difference might not be enough. No harm trying. Also, that assumed the batteries are fully charged.

Hmm. I guess a voltage regulator would be the best option, then, if it meant it could take any input voltage (within reason) and turn it into the target voltage - but how do voltage regulators affect current? If I’m stepping voltage down, I’d like to step current up as a safety factor in case I need to adjust for heat loss to ambient air.

How about one of the Pololu regulators like this one?

0.5" x 0.4" should fit your requirements.

That does look like what I want, thanks! I’ll give this one a try and see if I can make it work.

I did also make a spreadsheet to keep track of required parameters for this project (it’s mostly calculations for the nitinol), so maybe that will help clear some confusion up. Unfortunately, I can only upload it as PDF, so it looks a bit ugly (second page should be on the right of the first one).

nitinoljouleheating.pdf (139 KB)

elementcollector1:
To explain further, the circuit has several (at least 6) nitinol springs surrounded by regular springs that work as reversible actuators.

That really begs the question: why not using regular actuators for this?

wvmarle:
That really begs the question: why not using regular actuators for this?

Mainly because they need to bend into a spherical pattern while actuating. End goal is a sphere-shaped device that can change its size controllably.

EDIT: Per the Pololu regulator above, would it be possible to swap the potentiometer out for one that can interface to an ATtiny? It would make adjusting for battery voltage far easier if I could read the incoming battery voltage and step down the output accordingly, instead of setting the pot and hoping it works over all voltages.

Hmm. I guess a voltage regulator would be the best option, then, if it meant it could take any input voltage (within reason) and turn it into the target voltage - but how do voltage regulators affect current? If I'm stepping voltage down, I'd like to step current up as a safety factor in case I need to adjust for heat loss to ambient air.

I've not read the data sheet of your proposed switching regulator to know for sure if the drop put voltage would be a problem, but a linear voltage regulator is not the solution. A linear regulator is basically a glorified self adjusting resistor, which means the current it draws at its input is the same as the output current, plus a bit more to power itself. A switching converter swaps voltage for current, so higher output voltage means lower output current, less a bit that gets wasted as no electronic circuit is perfect. Given what you are doing the input voltage might be higher than the output (battery fully charged) or it might be lower (discharged battery); the only thing that works in that scenario is a buck-boost converter. You could of course use 3 batteries in series and start with a higher voltage.

PerryBebbington:
I’ve not read the data sheet of your proposed switching regulator to know for sure if the drop put voltage would be a problem, but a linear voltage regulator is not the solution. A linear regulator is basically a glorified self adjusting resistor, which means the current it draws at its input is the same as the output current, plus a bit more to power itself. A switching converter swaps voltage for current, so higher output voltage means lower output current, less a bit that gets wasted as no electronic circuit is perfect. Given what you are doing the input voltage might be higher than the output (battery fully charged) or it might be lower (discharged battery); the only thing that works in that scenario is a buck-boost converter. You could of course use 3 batteries in series and start with a higher voltage.

True. I could also lower the output voltage requirement somewhat (messing with the spreadsheet, an uncoiled length of 150 mm and 8 total coils gives a required voltage of 5.95V at the same current, something a 2S LiPo pack would only reach near full discharge).

I looked up digital pots for interfacing directly with the buck converter, and I could only find ones that communicated via I2C, something I’ve been told the ATtiny series has problems with. Any thoughts?

As it is to simply heat a nitinol spring, all you're really interested in is getting a certain amount of power into those springs causing them to heat up to a certain temperature. I guess you calculate that 6.55V based on the resistance of those springs - which will go up as they're heating up - and some required current.

Instead of using a regulator you can simply connect the coils through a MOSFET to the batteries directly; that voltage is a little higher than the 6.55V you calculate so you'd get too much current. To reduce the effective voltage and with it the effective current, use PWM. Your batteries will be 7.4V, to effectively reduce that to 6.55V you'd need 6.55/7.4 * 100% = 88.5% duty cycle, or an analogWrite() setting of 226. Adjust as needed to get the desired effect; you may even monitor the actual batter voltage separately and adjust for that (fully charged 2x LiPo will give you close to 8.4V, discharged they're at just over 6.4V which is where the over discharge protection should kick in). One ATTiny261A has 6x PWM output available. As it's for heating, the built-in PWM is a bit overkill. Much lower frequencies will work just fine, allowing you to use more pins with software PWM.

Of course you still need a regulator of sorts for the ATtiny part of the circuit, as that needs a properly regulated voltage.

wvmarle:
As it is to simply heat a nitinol spring, all you're really interested in is getting a certain amount of power into those springs causing them to heat up to a certain temperature. I guess you calculate that 6.55V based on the resistance of those springs - which will go up as they're heating up - and some required current.

Instead of using a regulator you can simply connect the coils through a MOSFET to the batteries directly; that voltage is a little higher than the 6.55V you calculate so you'd get too much current. To reduce the effective voltage and with it the effective current, use PWM. Your batteries will be 7.4V, to effectively reduce that to 6.55V you'd need 6.55/7.4 * 100% = 88.5% duty cycle, or an analogWrite() setting of 226. Adjust as needed to get the desired effect; you may even monitor the actual batter voltage separately and adjust for that (fully charged 2x LiPo will give you close to 8.4V, discharged they're at just over 6.4V which is where the over discharge protection should kick in). One ATTiny261A has 6x PWM output available. As it's for heating, the built-in PWM is a bit overkill. Much lower frequencies will work just fine, allowing you to use more pins with software PWM.

Of course you still need a regulator of sorts for the ATtiny part of the circuit, as that needs a properly regulated voltage.

I'm not entirely sure how this plays out with PWM, but these particular LiPo packs don't come with overcurrent or overdischarge protection (that's a separate addon), and I don't know what would happen if the battery were to very briefly pulse with a higher-than-rated current during a duty cycle. Otherwise, this would be my preferred approach.

LiPo batteries can handle pretty high currents, tens of amps for a 18650. What current are you expecting?

Overdischarge protection is a must - either through that add on, or by measuring the voltage and shutting down your project when it gets too low. Otherwise you may damage your batteries.

I looked up digital pots for interfacing directly with the buck converter, and I could only find ones that communicated via I2C, something I've been told the ATtiny series has problems with. Any thoughts?

Only that I don't see the point in trying to control the output voltage of the converter. Nothing you've said or that I have (mis)read suggests to me any reason to do so. As for using I2C on a ATtiny, no idea, never tried. Others here will know though I am sure.

wvmarle:
LiPo batteries can handle pretty high currents, tens of amps for a 18650. What current are you expecting?

Overdischarge protection is a must - either through that add on, or by measuring the voltage and shutting down your project when it gets too low. Otherwise you may damage your batteries.

Looking at the 18650, it's rated for 2600 mAh and has a maximum pulse discharge rating of 1C (or 2.6 amps). As far as I can find, the length of such a pulse is up to 30 seconds to prevent shortening of battery life.

Compare this to the RJD2450, which has a capacity rating of 200 mAh and a maximum pulse discharge rating of 2C (or 400 mA). It's not rated for nearly as much current discharge over a brief pulse as the 18650, and while I could in theory go beyond that for a pulse as brief as 1 second, I don't want to overheat a LiPo or shorten its lifespan if I can avoid it.

As for overdischarge protection, the add-on would also come with overcurrent protection (shutting down the circuit if the batteries drew more than the rated 400 mA), so I'd have to do it manually by measuring the battery voltage. I intended to do that already, so no harm there.

The problem with simply moving to higher voltages and using PWM to lower them is that I'm worried this will lead to a safety issue. During the PWM cycle, the battery will (very briefly) experience a current draw beyond what it's rated for, which I don't know the consequences of. It seems like the manufacturer's rated max pulse current for a 30-second pulse gives a pretty good safety window for a 1-second pulse, but I'm not sure if I want to push that number if I don't have to.

The problem with simply moving to higher voltages and using PWM to lower them is that I’m worried this will lead to a safety issue. During the PWM cycle, the battery will (very briefly) experience a current draw beyond what it’s rated for.

It won’t. You put a capacitor across the supply, the capacitor removes the current spikes and stops the battery seeing them. If you are really bothered you put an inductor in series with the battery between the battery and the capacitor as well.

Indeed. And that way you have built yourself a crude but effective buck converter

PerryBebbington:
It won't. You put a capacitor across the supply, the capacitor removes the current spikes and stops the battery seeing them. If you are really bothered you put an inductor in series with the battery between the battery and the capacitor as well.

wvmarle:
Indeed. And that way you have built yourself a crude but effective buck converter

I see. I looked up some buck converter theory after reading this. Would I be right in saying that the output voltage/current ratio is dependent only on PWM (not on capacitor/inductor values) in a perfect example of this circuit? If so, I could skip buying a separate converter entirely and add this onto the main circuit board.