A lot has been said so far, so I’ll probably miss addressing some things.
- Cereal_killer’s method works. This is the exact method used in the DQG 26650 flashlight. It will work for anything which uses sense resistors, so it could be easily adapted to the QX7136 based linear driver for example. In buck or boost drivers you can probably get away with small, high resistance FETs for switching the sense resistors (and just deal with the losses). In a linear driver like the QX7136 you would need to use low-resistance FETs.
- Mike C, you are right to think that the ATtiny13A has 4 available IO pins. Your idea will work. One of those IO pins is the Reset pin. You can use normal ISP (USBasp) to fuse the pin as “IO” rather than “Reset”. Once that has been done you cannot use ISP anymore, you must use high-voltage programming or at least a “high voltage rescue” setup. See a discussion of this and suggestions/solutions starting with post #52 in my thread here: 17mm DD+7135 — linear regulated driver w/ FET turbo
- Also take a look at the same thread for some code examples Werner posts for dealing with the extra IO.
- I’ve personally verified that there is no PWM on any level of the LDCH LD29 driver’s output. I’ve been unable to figure out how the driver works though. I think my problems are largely due to being unable to identify IC’s. I have a thread where I posted measurements and information about the driver.
Some disadvantages of the swapping sense resistors method:
- It requires a lot of space.
- Requires extra sense resistors: if sense voltage is low then these are costly.
- No way to change the mode levels with programming: you can only change the UI in the program.
- No possibility of ramping modes.