12 bit for dimming 12 V LED strip

Hey there,

i have created a dawn silmulator (or mabe it is called wake up light). At a certain time it dimms the light of two 12V LED strips (2* 1 Ampere) from off to bright. I use therefore two IRLZ44N MOSFETs with the arduino.

The problem here is, that the dimming is not smooth enough at low brightness because I can only use 256 steps (8 bit PWM). How can I use more steps?

  1. There is one way to make Timer1 have 16 bit resolution instead of the 8 bit. But I don't think I can use it. I have to use the TimerOne.h library so my rotary encoder works properly. I don't know if I can still use this library then. Besides I tried to connect the mosfet to Pin 9 (which belongs to Timer1) and it didn't work at all. Now I use Pin 5 which works fine.

  2. I have read that one could use the TLC5940, which has 12 bit PWM resolution. But I can't switch the IRLZ44 with it? I need some Pullup Resistor to invert the signal? But then the LEDs won't turn totally black, which is a no go in this project. I have read this here: http://forum.arduino.cc/index.php?topic=157021.0. Why is this the case? I am a noob with electronics but I think there must be a way to solve this problem? Cant I turn the mosfet fully off with an addiotonal transistor or so?

  3. What if I use TLC5940 and invert the signal with a 74HC04 like suggested here: http://fritzing.org/projects/pwm-with-tlc5940-via-logic-inverting-gates Would it turn the LEDs fully off?

Maybe you can help me with this.

Electrotantalus

'only 256 steps'? How is that in any way insufficient for your little project?

The first few steps are very distinct. At higher brightness there is no problem. It is because of the logarithmic vision of the human eyes I guess. The first step is also too bright.

It is supposed to simulate the rising of the sun, so it has to be smooth.

I found this, but it uses timer1. It seems that you must use timer1 on an Uno to get better PWM resolution than 8 bits. I have to ask, why do you need a timer to read a rotary encoder?

V(LED) is 12V and R(PU) is 1,000 ohms and using P-MOSFET for TLC5940.

2.png

2.png

I read somewhere that a timer is the best way to do it. I also have to read from the Real Time Clock and print the time on a display. So there is a lot of stuff the arduino has to do. Do you think I could try it with millis()?

It is hard to answer the encoder question when I don't know which encoder or its use.

@billhowl
Sorry, I don't understand what you are saying. Could you please elaborate your thought? I'm still a beginner.

@groundFungus
I use this one: http://www.ebay.de/itm/like/191771379148?chn=ps&dispItem=1
Model: KY-040 ED

Lots of info on using encoders, including several libraries.

That's my thought as well: how can it not be enough?

What PWM duty cycle gives you full brightness? I wouldn't be surprised if you have constant current drivers in your LED strips that mess up your dimming attempts (and in the process you're messing up those drivers).

Sorry for late reply. I will try it with different librarys for the encoder when I have time. Thank you so far.

@wvmarle
As far as I know there are only resistors and LEDs in the strips. I have full brightness at 256 duty cycle.
In amazon comments I have seen that the commercial lights had the same problem at the beginning. The problem only occurs in the first 20 steps.

You mean at 20/256 duty cycle you have (near) full brightness already?

OP is right.
8-bit dimming is terrible at low brightness.
I use the 12-bit PCA9685 with a 256 step IEC lookup table.
This dims to very low brightness before steps become visible.
Leo..

ut I don't think I can use it. I have to use the TimerOne.h library so my rotary encoder works properly.

This is the part that concerns me more. How would the TimerOne library be in any way useful at all for reading an encoder? If you'd find a better, more appropriate way to read the encoder then you'd have the timer you need freed up.