Battery powered lamp -> add a dimmer // design consideration

Go To Last Post
33 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey everybody,

 

my daughter owns a mood light which consists of a wooden enclosure in the form of a cloud, seven LEDs and an on/off-switch. The light is designed to be powered from 3 AA cells (1,5V each) and I'm using 3 AA rechargeable cells (1,2V each). It draws 114 mA at 4,5V supply voltage. I'd like to use this light when I put her to bed or while she's asleep. Unfortunately, the light is too bright for that. That's why I'd like to add a dimmer function.

 

I've written some code for an ATtiny25/45/85 (currently using an ATtiny45) which works very well on my STK500. The ATtiny switches an LED on and off when the push button is pressed. By holding the button down, the user is able to change the brightness of the light. It stores the current brightness and returns to that when the light gets switched off/on via the push button (if nobody turns it off completely using the on/off-switch).

 

Regarding the power supply, I thought about powering the ATtiny directly from the batteries. To make sure that "PWM value X = Y brightness level of LEDs" is stable, I thought about using a Stepup converter to supply the LEDs with around 5V, no matter what the charging level of the batteries is. My first idea was to use one of those DC-DC converter modules from China to save me the time and work to do a PCB myself (a relatively simple stripboard would be enough). Unfortunately, I don't have a suitable Stepup converter module at hand. I've looked through Aliexpress and found two possible candidates:

  1. 600mA DC-DC Mini Step Up Power Module 1-5V To 5V Step-up Boost Converter
  2. 5PCS DC DC 1.8V 2.5V 3V 3.3V 3.7V To 5V Step Up Power Supply Voltage Boost Converter Board Module Regulator 18650 Li-on Batery

 

Both are lacking an enable-Pin. To switch them off, I'd have to cut the supply voltage to the Stepup module. I'm not sure if my current idea using a transistor would work because of the missing voltage differences between emitter-collector / base-emitter. I'm although not sure if I should really use one of those Chinese modules if I'd like to reduce the power loss as much as possible.

 

Regarding the enable-PIN, I've found some interesting information here: https://www.ti.com/lit/an/slyt73... Because I'm only operating some LEDs, I don't think that the handling of the enable-Pin is very critical in my case.

 

While I'm writing this, I remember, that I've some Stepup-(down)-converters laying around which could be used for my project. I've to design a PCB but I can rely on a datasheet (and I already have them here, waiting to get used for something):

 

  1. MAX619EPA (DIP)
  2. MAX756EPA (DIP)
  3. LT1301CN8 (DIP)
  4. LT1302CN8 (DIP)
  5. LT1302CN8-5 (DIP)
  6. MAX1674EUA+ (µMAX)
  7. MAX756CSA+ (SO8-1)
  8. MAX756ESA+ (SO8-1)

 

Questions

  1. Would my idea to cut the supply voltage to the Stepup module work?
  2. Should I use a premade Stepup module when power saving is important?
  3. Do you've recommendations for a suitable module which works great in combination with a small amount of AA / AAA batteries?
  4. Is it a good idea to use the Stepup converter only for the LEDs or am I about to get in trouble because the ATtiny is powered from unregulated batteries, while the LEDs are not?
  5. Any other thoughts?

 

I've attached a schematic of what the circuit would look like.

 

Thank you very much for your help!

Max

 

 

 

Attachment(s): 

Regards Max

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You'd be better off using a PNP for Q1. The voltage drop across it will be a bit lower.

 

Pololu makes a bunch of DC-DC converters that have an enable pin. For example: https://www.pololu.com/product/2562

 

You might be able to get away without the DC-DC converter by replacing Q2 with a constant current sink circuit to ensure consistent brightness. With some cleverness, this could also act as the on-off switch, as well as do the PWM dimming.

 

- S

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First of all, if you want to really regulate the LED brightness, you need to control the led current, PERIOD.  Forget any notion of supplying such & such voltage (others often attempt to control current by wasting it through a resistor, which approximates a rather poor current source).

 

Yes, adjust the boost amount up/down to give the correct amount of monitored current.   If the LED current monitoring feedback loop is part of the boost circuitry, then the avr output is essentially "brightness".  If the avr is monitoring the current & controlling the booster, the its output is a boost voltage request level.

 

At these low power levels, you can easily make a boost with an inductor and diode and transistor & let the avr control the boosting ratio (PWM) by monitoring the led's current via the ADC & adjusting PWM based upon the measurement.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why step-up at all? Just feed the supply voltage into an ADC channel and use the measured value to apply a correction to your PWM value.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much for your reply! I'll go through your suggestions / questions and I've grouped the "use a constant current sink circuit and control that one"-suggestions.

 

mnehpets wrote:

You'd be better off using a PNP for Q1. The voltage drop across it will be a bit lower.

Thanks! I'll make a change if I'm staying with my DC-DC converter idea (doesn't look like that, see below).

 

mnehpets wrote:

Pololu makes a bunch of DC-DC converters that have an enable pin. For example: https://www.pololu.com/product/2562

That one looks nice!

 

mnehpets wrote:

You might be able to get away without the DC-DC converter by replacing Q2 with a constant current sink circuit to ensure consistent brightness. With some cleverness, this could also act as the on-off switch, as well as do the PWM dimming.

avrcandies wrote:

First of all, if you want to really regulate the LED brightness, you need to control the led current, PERIOD.  Forget any notion of supplying such & such voltage [...]

avrcandies wrote:

At these low power levels, you can easily make a boost with an inductor and diode and transistor & let the avr control the boosting ratio (PWM) by monitoring the led's current via the ADC & adjusting PWM based upon the measurement.

I've never done that but it sounds like a good idea. No loss from the DC-DC converter and no trouble regarding finding / building one. The ATtiny can be very happy with the batteries as it's supply voltage. I've to look into it further! If you know of any recommended tutorials etc., I'd be happy to check them out. Otherwise, I'm going to rely on my internet research (and come back with questions either way ;-) ).

 

Brian Fairchild wrote:
Why step-up at all? Just feed the supply voltage into an ADC channel and use the measured value to apply a correction to your PWM value.

I think this wouldn't work. From the ATtiny 25/45/85 datasheet:

The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The mini-
mum value represents GND and the maximum value represents the voltage on V CC , the voltage on the AREF pin
or an internal 1.1V / 2.56V voltage reference.

Because the supply voltage from the batteries is changing, I'd use the internal voltage reference. Assuming one cell can go from 0,8V (empty) to around 1,2V (fully charged), the supply voltage is going to from 2,4 - 4,5V. To get the biggest measuring range possible, I'd go for the 2,56V voltage reference. Unfortunately, that's only 0,16V away from "batteries empty". I don't think that this could result in a useful PWM-correction.

Regards Max

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Assuming that all 7 LEDs are supplied in parallel (worst case directly by the 4.5V even without any resistors) you could simply use a linear LED driver like MIC4802 (or any similar device), where you set the maximum LED current by a single resistor.

 

The ATtiny then would control the wanted brightness via the EN pin of MIC4802 by PWM (can be very fast).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Two resistors to halve the supply feed into the ADC would sort it out.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you could simply use a linear LED driver like MIC4802

A linear drive is pretty wasteful in that it wastes voltage (across the driver) & even more, wastes the battery, since the light rapidly falls, even when the battery gets only slightly weak/depleted.  So you have to toss a battery that might still have 50% of its energy untapped & tossed in the trash.  A switcher of some sort (buck, or  boost, or other) is generally beneficial.  However, at lower LED power levels, the consumption and waste of the switcher itself might outweigh any savings. Use a fet transistor, don't be wastful1

 

https://atmelcorporation.wordpress.com/2014/12/08/building-an-led-boost-converter-with-attiny85/

 

Every 2 ms read the adc current...if it is too low, increase the pwm 1 step (count), if it is too high, decrease the pwm 1 step  (also, don't go above or below some PWM bounds)...it will work great.

Read the adc when the driver is steady (not at the noisy switching moment), such as a delayed IRQ.  It is easier to just add a large RC cap & take the avg over several cycles & just avg in the switching transients.

 

For the least waste, use a low ohm resistor & possibly an opamp (such as the one in the AVR ADC section).

 

You can code all this up in about 25 lines of asm or even use C code. 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Mar 13, 2020 - 10:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

s'AVR wrote:

Assuming that all 7 LEDs are supplied in parallel (worst case directly by the 4.5V even without any resistors) you could simply use a linear LED driver like MIC4802 (or any similar device), where you set the maximum LED current by a single resistor.

 

The ATtiny then would control the wanted brightness via the EN pin of MIC4802 by PWM (can be very fast).

I could change the internal wiring to connect the LEDs however I need them. avrcandies gave a comment regarding the energy waste. I've checked Analog Devices and Maxxim Integrated but it's not that easy to find something which you'd like to solder by hand.

 

Brian Fairchild wrote:
Two resistors to halve the supply feed into the ADC would sort it out.

Point taken. But than I'd have to analyze how much the changing supply voltage is influencing the brightness and take care of that by changing the PWM frequency.

 

I thought that it would be possible to do it in a simpler way and without a "big" waste of precious battery power. I think I found some questions which are very similar to mine:

  1. No problems regarding the supply voltage: https://forum.arduino.cc/index.p...
  2. Supplied from a battery and with current control (PWM) and sensing (ADC) [@Brian Fairchild: Did I get you wrong and is this what you've wanted to suggest?]: https://electronics.stackexchang...
  3. Project documentation of using a ATtiny85 to control a constant current sink via PWM (not without wasting energy): https://eositis.wordpress.com/20...

 

I still have to dig deeper. If a powerloss-friendly, battery voltage compatible LED-driver is the way to go, I'm okay with that too (if it's possible to solder it by hand). And if I've to design a PCB for it, I'll do it.

 

s'AVR wrote:

Assuming that all 7 LEDs are supplied in parallel (worst case directly by the 4.5V even without any resistors) you could simply use a linear LED driver like MIC4802 (or any similar device), where you set the maximum LED current by a single resistor.

 

The ATtiny then would control the wanted brightness via the EN pin of MIC4802 by PWM (can be very fast).

I could change the internal wiring to connect the LEDs however I need them. avrcandies gave a comment regarding the energy waste. I've checked Analog Devices and Maxxim Integrated but it's not that easy to find something which you'd like to solder by hand.

 

Brian Fairchild wrote:
Two resistors to halve the supply feed into the ADC would sort it out.

Point taken. But than I'd have to analyze how much the changing supply voltage is influencing the brightness and take care of that by changing the PWM frequency.

 

I thought that it would be possible to do it in a simpler way and without a "big" waste of precious battery power. I think I found some questions which are very similar to mine:

  1. No problems regarding the supply voltage: https://forum.arduino.cc/index.p...
  2. Supplied from a battery and with current control (PWM) and sensing (ADC) [@Brian Fairchild: Did I get you wrong and is this what you've wanted to suggest?]: https://electronics.stackexchang...
  3. Project documentation of using a ATtiny85 to control a constant current sink via PWM (not without wasting energy): https://eositis.wordpress.com/20...

 

I still have to dig deeper. If a powerloss-friendly, battery voltage compatible LED-driver is the way to go, I'm okay with that too (if it's possible to solder it by hand). And if I've to design a PCB for it, I'll do it.

 

edit:

@avrcandies: I've just seen that you've updated your last post. I'll check it out tomorrow (I'm late for bedtime already).

 

 

Regards Max

Last Edited: Sat. Mar 14, 2020 - 12:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

[...]

 

https://atmelcorporation.wordpress.com/2014/12/08/building-an-led-boost-converter-with-attiny85/

 

Every 2 ms read the adc current...if it is too low, increase the pwm 1 step (count), if it is too high, decrease the pwm 1 step  (also, don't go above or below some PWM bounds)...it will work great.

Read the adc when the driver is steady (not at the noisy switching moment), such as a delayed IRQ.  It is easier to just add a large RC cap & take the avg over several cycles & just avg in the switching transients.

 

For the least waste, use a low ohm resistor & possibly an opamp (such as the one in the AVR ADC section).

 

You can code all this up in about 25 lines of asm or even use C code. 

 

 

 

@avrcandies: Regarding your edit (added link and explanation), I think this looks very good.  Thank you very much!

 

I've found two more interesting project documentations from the Speleogroup (a caving club, formed in 1969):

  1. ATtiny-A - A constant current circuit using the Atmel ATtiny15L microcontroller: http://www.speleogroup.org/attin...
    Here's the schematic: http://www.speleogroup.org/files...
    It looks like the software hasn't been published until now. I've written an e-mail to the developer (Mike Cowlishaw). Maybe it's possible to publish the code now.
  2. LT1512-A - A constant current circuit using the Linear Technology LT1512 chip, a current mode switching regulator: http://www.speleogroup.org/lt151...

 

I've to say that, at the moment, avrcandies link (here's the original source [Hackerspace FFM e.V.] by the way: http://www.hackerspace-ffm.de/wi...) and the ATtiny-A solution from the Speleogroup are looking like the most promising to me.

 

edit: I've use C by the way, ASM is nothing I can deal with unfortunately ;-)

Regards Max

Last Edited: Sat. Mar 14, 2020 - 11:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At the moment we got this information about the original design:

 

"The light is designed to be powered from 3 AA cells (1,5V each) and I'm using 3 AA rechargeable cells (1,2V each). It draws 114 mA at 4,5V supply voltage."

 

It would be helpful to know how the LEDs are arranged electrically and if there is anything else besides the LEDs.

If all LEDs are connected in series, there must be a kind of switched mode LED driver to generate more than 20V for the LEDs (schematics?).

 

Then there also will be a way to control the LED brightness using the ATtiny.

However, step-up/boost LED drivers got not the best efficiency, but big peak currents.

 

Typically such 4.5V battery supplied LED lamps (like cheap torches, head lights*, etc.) are directly powered by the batteries relying on the source resistance of the batteries (typically 1 Ohm per 3 AAA batteries in series, certainly less for 3 AA cells) or for lower LED currents simply by using series resistors (or smaller batteries).

 

We all know, that such kind of cheap LED lamps are showing very bright (and annoying) light at full batteries, which gets quickly darker while the batteries are discharged.

 

The behavior of such lamps with LEDs in parallel can be improved a lot by my simple low-dropout proposal**, especially for white (or blue) LEDs where the LED voltage drop matches quite well with three 1.5V battery cells in series.

 

Then the initially lower LED current (being set at the LED driver) will be constant (and the brightness staying the same) from full batteries until the voltage drop of the LEDs (at the LED current being set) is reached, which is much longer than for the originally very high "starting current" at full batteries without a proper LED driver.

 

Compared to a (more complex) switched mode LED driver, the average efficiency over the full discharging cycle could be even better for the recommended low-dropout linear LED driver, because the efficiency for the linear LED driver increases*** while the battery voltage drops, but normally decreases (for various reasons) for the switched mode LED driver.

 

So if the LEDs are white (or blue) ones and could be connected in parallel (or are already), I am very confident that most likely my proposal is better (also simpler, smaller and lower cost) compared to a switched mode LED driver, at least much better than the original design.

 

For a solid proposal it would be helpful to know how the LEDs are interconnected in the original design (schematics) and what color (or LED voltage drop per LED) they have.

 

* see http://www.led-treiber.de/html/leds_fetz.html#Stirnleuchte

** more details see also here: http://www.led-treiber.de/html/ldo-treiber.html#MIC4802

*** in general the efficiency for a linear LED driver is approx. V_led/V_battery

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much for you further explanations. I've a hard time to estimate the power losses compared to each other. And I've to say that it's hard to beat a price of 0,81 EUR (mouser). Okay, I'd need a PCB too. The MIC4802 has a minimum supply voltage of 3V (= I'd loose 3V - (0,8V*3) = 0,6V). The uC would've to monitor the battery voltage and shut down below 3V. I couldn't find any information regarding power loss while V_IN is supplied but the EN-Pin is low. Or should I only turn the driver on if I want the LEDs to be "on" and use something like I've had in mind regarding the DC-DC Stepup converter (see my first post at the top)?

 

s'AVR wrote:
It would be helpful to know how the LEDs are arranged electrically and if there is anything else besides the LEDs.

I've opened the light and attached some pictures. For the record: Manufacturer = Vertbaudet SAS / Model = CAR-WS0330. The LEDs are white and connected in parallel. I've made a schematic of the light in it's current and unchanged design (I've attached it as an PDF too):

schematic of the light in original condition

 

 

 

 

Attachment(s): 

Regards Max

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's somewhat ridiculous...you can't get too far hooking leds in parallel (unless they are tightly matched), otherwise some may be very bright & others very dim.  Internal or other resistors can help to accommodate them to better sharing, but that wastes power.

With different I-V curve leds in parallel, it seems non-uniform dimming would also be problematic.   If the mfg supplies them his way, hopefully they've done a good matching job & keep the temperature the same on each.

 

For any led, light output is proportional to current (in the linear range). So, if you are running a bunch of mismatched leds in series, in the middle of their  usable range, cutting the current by 50% will cause all of them to reduce output by 50%.  That would not be true for parallel connected mismatched leds.

 

A switcher is likely your best bet: 

   It can drain the batteries  very close to completely empty. 

        --This may require some input cap so that batteries are immune from high surges.  However, due to the inductor vs switch placement, the boost topology creates current surges on the output (buck places them on the input, whenre batteries are)

   It can be more efficient overall

   It allows the leds to be series connected for more even illumination & better dimming

 

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi avrcandies,

 

Knowing how LEDs work, I fought against paralleling LEDs (and other mistakes when driving LEDs) for a long time, especially on my private website.

2004 Osram published an interesting app note "Comparison of LED Circuits" on paralleling binned LEDs. You still find it in the WWW.

 

But if you have a certain given condition (like the lamp application of this thread) you still can try to make the best out of it without changing the whole setup.

 

And supplying LEDs connected in parallel by a constant current source is not such bad.

Agreed, when dimming such a setup to very low brightness you will detect different brightness for a few of the LEDs, which BTW is the same when dimming COBs.

 

Hi TheEYE13,

 

It looks like my guessing was correct and my proposal will work as described. And you will not find any simpler, but still good approach.

 

You can directly supply both MIC4802 and ATtiny by the battery voltage and control its EN pin directly by the µC generated PWM.

 

R4 of the LED arrangement can be omitted (or shorted) and the LED cathodes should be connected to the D1 pins of MIC4802, which is a constant current sink* to GND.

MIC4802 can easily handle the extra heat, which is (V_bat – V_led) * I_led, which is not much more than 0,2W at 105 mA and 4,5V.

 

For example using R_set = 47 kOhm, you will get 105 mA LED current, which you can dim from 100% LED current (LEDs always ON) down to 0% (LEDs always OFF).

 

The efficiency at full batteries is estimated to 3V/4,5V = 67%, but will rapidly increase while discharging the batteries and finally approach to 3V/3.05V = 98% before the LED current starts to drop.

 

I wonder which switched mode solution will beat the average efficiency (from fully charge batteries until the constant current starts to drop) of this proposal at the given conditions.

 

In a luxury version you could add a light sensor to the µC to sense the ambient light and dim the LEDs accordingly.

Then you also might implement a luminance correction by software (which is simply a table and a few extra instructions).

 

Sure, you could sense the battery voltage (for example by setting the brownout fuses to a certain level) and switch off the LEDs by software, if wanted.

Using the internal ADC would be another option, but might be more complicated.

 

However, if you don‘t, the LED current will automatically drop steadily (even below 3V battery voltage, the guaranteed MIC4802 supply voltage) when the battery voltage drops below the LED forward voltage being valid for the 100% current being set (105 mA, e. g.).

 

Finally below 2V battery voltage the LEDs will be all be off, I guess – urgently time to recharge.

Anyway, using the standard Attiny25/45/85, the minimum voltage would be 2,7V.

 

Good luck and enjoy the result!

 

* The only voltage you are loosing is the voltage drop of < 50 mV @105 mA between D1 and GND when the battery voltage is approaching the trip point.

The shutdown current of MIC4802 (when EN = LOW) is less than 1 µA.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a question about the LEDs in this device.  Do they cycle through various colors by themselves?

Letting the smoke out since 1978

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I recommend controlling the voltage to the set of LEDs to dim them.   Here is a little switching power supply board that takes DC in at 4.5V and outputs a voltage upwards from 1.25v: https://www.ebay.com/itm/DC-DC-B...

 

  Change the potentiometer on the board to the external dimmer pot and set its output range to max out at about +5V. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I recommend controlling the voltage to the set of LEDs to dim them.

Please keep recommendations correct...you control the CURRENT, not the voltage to dim the leds.  The current is the control variable, the voltage is a dependent quantity.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Once again, thanks for the ongoing support, the detailed and very interesting information!

 

Regarding using those LEDs in parallel or series: As you can see in the pictures I've attached to post #12, there's enough space within the lamp to change the wiring of the LEDs. Nevertheless, I'm happy if it's "possible" to give it a try without changing it.

 

s'AVR wrote:

[...] Osram published an interesting app note "Comparison of LED Circuits" on paralleling binned LEDs. [...]

For the lazy folks: https://dammedia.osram.info/medi...

 

s'AVR wrote:

The shutdown current of MIC4802 (when EN = LOW) is less than 1 µA

Thanks, I wasn't sure if this is really the consumed current while in shutdown. As you've said, the shutdown current is less tan 1 µA. The datasheet even states, that the typical value is 0.01 µA.

 

s'AVR wrote:

 

In a luxury version you could add a light sensor to the µC to sense the ambient light and dim the LEDs accordingly. [...]

I still have adding a light sensor on my todo-list for my "motion activated underbed LED light" (were I'm not monitoring the current I've to confess). The result of the first and (so far) last test was "it's to dark in my bedroom to differ day from night". But that's another topic. I may open a separate thread when I'm working on it again. And the first thing regarding that project is to clean up and publish the software and hardware files anyway.

 

s'AVR wrote:

Sure, you could sense the battery voltage (for example by setting the brownout fuses to a certain level) and switch off the LEDs by software, if wanted.

Using the internal ADC would be another option, but might be more complicated.

I guess you're right.

 

s'AVR wrote:

[...] the LED current will automatically drop steadily (even below 3V battery voltage, the guaranteed MIC4802 supply voltage) [...]

 

Finally below 2V battery voltage the LEDs will be all be off, I guess – urgently time to recharge. [...]

Thanks for the clarification.

 

s'AVR wrote:

[...] using the standard Attiny25/45/85, the minimum voltage would be 2,7V.

I'd like to use one of the controllers which I've already here waiting to be used. Thought about the PDIP-versions but I've an ATtiny45V (SOIC) which I could use too.

 

digitalDan wrote:

I have a question about the LEDs in this device.  Do they cycle through various colors by themselves?

No, they're just plain white LEDs.

 

Simonetta wrote:

I recommend controlling the voltage to the set of LEDs to dim them. [...]

avrcandies already said something regarding controlling the current. You can find his proposal in post #3 and #8. Is this what you were thinking about too? By the way, I think the DC-DC Stepup converter proposed in post #2 by mnehpets would be a better choice, because the minimum supply voltage is less than the minimum battery voltage.

 

Next steps

@avrcandies & s'AVR: Special thanks go out to you. Your explanations are helping me a lot! I think I'll try the MIC4802 approach for now. Maybe I'll be able to compare both approaches sometime. I'll be back with a new schematic (at the latest). Would be great if you could've a look (others are very welcomed too of course).

Regards Max

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The MIC4802 essentially offers little for battery operation, it is just a drive transistor and an amplifier to monitor & set the driver loss to give the desired current.  So it does nothing to increase efficiency when delivering power.

Since it has lower Vrop minimum than a bipolar design, it allows a slightly lower battery voltage to be reached, but not really very far; any mosfet could reach such a level.  You will leave a lot of unused voltage on the table, though need to convert the cutoff voltage into % remaining batt capacity.  This will work fine if you don't need an extended battery life, and it is in one package.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe I'll wait for those Digispark clones (ATtiny85) to arrive, use a stripboard to make a prototype and just see how it goes. This way, it'd be easier to prototype another solution too. Unfortunately, I don't know what the voltage looks like now when I decide to recharge the batteries.

 

edit: Picture of those clones I was talking about

Regards Max

Last Edited: Mon. Mar 16, 2020 - 11:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What’s wrong with just using an AVR and a mosfet?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Isn't that what avrcandies proposed in post #8, including an example (further explanation in post #13 and initial proposal in post #3)? Only an mosfet seems to be a little understated from what I know now.

 

Regarding post #8, I had e-mail contact with the developer and he told me, among other things, that it's still running and that he was able to use the simplest components, because he only needed 20 mA.

 

Basically they're four things for me:

  1. I'ld like to be able to control the current (via PWM)
  2. I'd like to drain the batteries until they're empty (and keep the current steady over all battery voltage levels)
  3. I'd like not to waste energy (I don't know which solution is most efficient over all [see point 4])
  4. I've never build such a circuit and I find it kind of hard to get information of how to do it (which components) for my given case (that's why a single-chip is very tempting. And s'AVR seems to spend a lot of time with LEDs)

 

If I could get a little support regarding point 4, I'd love to design circuits / PCBs for both solutions and test it!

 

 

Regards Max

Last Edited: Tue. Mar 17, 2020 - 07:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  1. I'd like to drain the batteries until they're empty (and keep the current steady over all battery voltage levels)
  2. I'd like not to waste energy (I don't know which solution is most efficient over all [see point 4])

Then you require a switcher, it's that simple.  Well, 99.9% f the time.  The switcher itself does take some small amount of power.

 

you need transistor , inductor  & capacitor & diode.  If clever diode can be skipped since the led is a diode....how much simpler do you want/expect?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm really happy about your support and this thread!

 

Let me work on the schematics and then we'll talk about it :-)

Regards Max

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So the challenge is #2. What batteries do you want to target? Primary cells you can keep discharging, secondary cells will probably get upset if you discharge them too much. So battery choice is the guiding criteria. This will set the minimum operating voltage. The minimum operating voltage will determine if you need a boost converter for the micro or the choice of micro. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The existing lamp is designed to be used with 3 AA primary dry batteries (nominal voltage of 1,5V per battery). I'm currently using secondary (rechargeable) Ni-MH cells (eneloop, nominal voltage of 1,2V per cell). I'd like to stay with the kind of cells I'm currently using. According to my research (for example: https://electronics.stackexchang...), those NiMH cells are pretty much empty at 0,9V and shouldn't be discharged further than 0,8V. In series, this would result in a voltage of 2,4 - 2,7V. Taking into account, that the voltage between all cells could differ a little bit, I probably should either:

  • measure all cells individually to make sure I'm not discharging a cell further than 0,8V (I really don't want to do that) OR
  • stop the discharging at a total voltage of 2,7V (3 * 0,9V), assuming that each cell is going to be at or above 0,8V

 

Considering this, I'd stick with 2,7V and be able to use any ATiny25/45/85 and even use the Brown-out Detection which a detection level of 2,7V.

Regards Max

Last Edited: Tue. Mar 17, 2020 - 11:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TheEYE13 wrote:
assuming that each cell is going to be at or above 0,8V

Not a safe assumption!

 

That's always the problem with series cells: there will always be a "weakest link" in the chain that will end up getting discharged before the others.

 

This is an advantage of using a single cell, and stepping up the voltage.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fair enough, but what are the possible differences we're talking about between three cells? +- 0,2V? +-0,3V? What is realistic? Yes, this wouldn't be a problem with a single cell. On the other hand, I'd have to replace / recharge it more often.

 

Further more, I'm using these rechargeable Ni-MH cells for all kinds of battery powered devices (no matter how the cells are connected to each other). I'd like to choose a reasonable voltage level for three cells in series for the modification of the existing lamp. That's because I don't want to damage my cells but I don't want to be overcautious either. My oldest eneloop cells are over 10 years old and so far I didn't have to toss a damaged cell into the garbage.

Regards Max

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use 3 cells and simply boost to a decently high voltage (higher than max of all 3 batteries combined, plus maybe another volt or two).  Connect enough series leds to be excessively bright at the current that results at that high voltage.

Then you are on your way to regulating brightness as the batteries fall down to the final cutoff.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TheEYE13 wrote:
what are the possible differences we're talking about between three cells?

Typically, the weakest cell will get fully discharged before the others and will end up effectively having current going "backwards" through it.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

That's somewhat ridiculous...you can't get too far hooking leds in parallel (unless they are tightly matched), otherwise some may be very bright & others very dim.  

 

Practical experience agrees with this.  I have a strip of (white) LEDs, run off a 12V linear supply.  When cutting the power (by whacking the AC to the supply) it's mildly amusing to watch the individual LEDs on the strip fade out as they drain down the smoothing capacitors.  Some are MUCH brighter than the others before they all go dark.  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Draw 4 of the same exponential curves slightly shifted horizontally from each other.

 

Now pick a point on the X-axis to represent parallel voltage, and draw a line up.  All the different heights show you how the brightness will vary.  Here we vary from 2 units to 4

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. Mar 18, 2020 - 09:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And throw in the human eyeball's non-linear response to brightness (especially when the rest of the world just went dark) and it'll look even weirder.  But we're getting a bit OT here.  wink  S.