A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Mike88
J6r06n wrote:Thank you for this awesome tutorial. I had to ad these three lines in your program because my esp8266 has a 10 bit pwm output:
Code: Select allr = map(r, 0, 255, 0, 1023);
g = map(g, 0, 255, 0, 1023);
b = map(b, 0, 255, 0, 1023);

I think I've got a 10bit board too, where did you add you code exactly?
User avatar
By eqsOne
#65240 I think the NodeMCU is always 10bit pwm. This would mean on '255' it would do just 25% instead of 100% brightness without the remapping shown by J6r06n.

My rgb strip seems to reach its max brighness on '255' the way it is (without remapping), I don't think it shows just 25% of what it could do.

Think I'm going to build another test device these days to find out.
User avatar
By eqsOne
#65371 J6r06n, you was perfectly right. The max brightness is indeed limited without your additional code. Thanks man, very nice find!

@Mike88: Just add the lines to the setHex() section like this:

Code: Select allvoid setHex() {
  state = 1;
  long number = (long) strtol( &hexString[0], NULL, 16);
  r = number >> 16;
  g = number >> 8 & 0xFF;
  b = number & 0xFF;
  r = map(r, 0, 255, 0, 1023);
  g = map(g, 0, 255, 0, 1023);
  b = map(b, 0, 255, 0, 1023);
  analogWrite(redPin, (r));
  analogWrite(grnPin, (g));
  analogWrite(bluPin, (b));

By the way, I noticed an LM7805 gets quite warm while connected to the 12V source, no matter if the LED strip is switched on or off. Guess something around 45-50°C, this won't damage the regulator but nevertheless I added a small heatsink to it. If anyone has a better solution to bring the source down to about 5V/1A, please leave a comment.
User avatar
By eqsOne
#65372 Ok, I changed the LM7805 to a Recom R785.0-1.0 DC-DC converter now, pricier but it doesn't get warm at all. Optionally you can put caps to the in- and output according to the datasheet.


You do not have the required permissions to view the files attached to this post.