Help me please. Esp32 pwm Led light controller.

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
Hi guys, how are u?

This is my first post on this forum. I've being around reading hunderds of threads during the last months and today I decided ask to u a little help.
Iam building a led lighting system and i will use 5 Meanwell Ldd 1000H to drive it. I would like to make an Esp-32 PWM controller. I am very newbie in programing but I promissor, i will do my best. I found some more elaborated controllers around the web but ALL of them looking much more complex than I would like (most including other functions beside lighting and usually with their own interfaces). I Just need to be able to set my lights intensity, ramp up, ramp down and If It is possible, use some app like Blynk. Please, anyone could help me with the code and some hardware tips?

Thank you very much guys!
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,964
Reaction score
3,358
Location
Sacramento, CA area
Rating - 0%
0   0   0
> Please, anyone could help me with the code and some hardware tips?

Absolutely! It helps to have some framework in place. Have you followed any of the tutorials for LED dimming on an ESP32? The mechanism will be the same, except instead of connecting an LED you'll connect it to the dimming port on the LDD driver.
 

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,610
Reaction score
3,451
Rating - 0%
0   0   0
> Please, anyone could help me with the code and some hardware tips?

Absolutely! It helps to have some framework in place. Have you followed any of the tutorials for LED dimming on an ESP32? The mechanism will be the same, except instead of connecting an LED you'll connect it to the dimming port on the LDD driver.
Looks pretty comprehensive..
 

John08007

Well-Known Member
View Badges
Joined
Apr 4, 2019
Messages
945
Reaction score
653
Rating - 0%
0   0   0
Don't know much about your whole system, why not pick up an apex and use different drivers with 0-10v dimming? There is also an interface to control pwm with the apex if you need to use pwm. Sure you can pick up an older used one pretty reasonable
 
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
Hello guys. Thank you very much for your reply

Theatrus and Oreo, I already read this post from instructable and i will give a try this weekend to make this very first step on PWM test. I already followed some instructables tutorials and everything worked. I can even try to use Blynk to run this with slide bars. However I have no idea on how to program "ramp up" and "ramp down" in a schedulle. I guess I would need a RTC module, but I really don't know how to code it. How could I interface this schedulle inside the Blynk or whatever other app is also a mystery to me.
Did you know someone with a code like this? Did u already use Blynk for sth like this?

Hey John, well i would love to have an Apex, sadly, here in Brazil the Apex price is insane. Today, Brazilian real is less than 0.25 dolar cents. So everything imported is price prohibitive. I cant escape to spent money on pumps, skimmers, salt etc, and It is very expensive for us but things like an Apex (despite the fact that I would love to have one lol) are not absolutely necessary or irreplaceable. Lighting is also something that I know I can produce a high quality one (despite the fact the I would love to have a xouple of radions lol). I produced my own lighting 8 years ago, with the old Cree xre leds and I consider was very successfull on that. So Iam trying the diy way again :)

Thank you guys and sorry for my bad english.
 

Galvano

Community Member
View Badges
Joined
Apr 5, 2020
Messages
63
Reaction score
48
Location
Bavaria
Rating - 0%
0   0   0
Iam building a led lighting system and i will use 5 Meanwell Ldd 1000H to drive it. I would like to make an Esp-32 PWM controller. I am very newbie in programing

In case your main goal isn't learning to program an ESP32, I'd like to point you to my AquariOS controller. The latest version bases on an ESP32 WROVER module, offering
  • 8 PMW light channels with programmable ramping
  • 4 analog + 4 PWM pump channels allowing custom power shapes
  • 4 PWM (On/Off) heater/cooler channels
Up to version 0.9.3 you can use it even with a WROOM module. A few further components (breadboard, PCA9685 PWM module, LDD drivers, OLED/TFT display) and you have an ultra-cheap yet capable network solution with a web interface.

Here's a screen dump of the controller I'm currently running at home:

AquariOS-SD-201007-191140.png


Good luck!
 
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
Thank you Galvano!

I will check your AquariOS, seems great! To be honest, I would like to make my own system and learn a little bit about esp32 but I will keep your system as a possibility if I fail in my desire.

Thank u
 

TDEcoral

Active Member
View Badges
Joined
Apr 14, 2017
Messages
359
Reaction score
387
Rating - 0%
0   0   0
Last edited:

TDEcoral

Active Member
View Badges
Joined
Apr 14, 2017
Messages
359
Reaction score
387
Rating - 0%
0   0   0
Thank you very much TDEcoral.

No problem! I can't remember if I had to modify the code or if it worked as is. I tried using his version 2, but couldn't get it to work even after the author of the code and I did some trouble shooting. If you use version 1 and run into problems, let me know and I can send you my files. I've tested them and they work just fine.
 
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
No problem! I can't remember if I had to modify the code or if it worked as is. I tried using his version 2, but couldn't get it to work even after the author of the code and I did some trouble shooting. If you use version 1 and run into problems, let me know and I can send you my files. I've tested them and they work just fine.

Thank u very much. Iam still waiting for my power supplies and heatsinks but this weekend I will start to some coding tests. I saw that there are some diferences in pwm coding for esp8266 and esp32, so maybe not so It Will bê not straightfoward lol but i'll do my best :).
I'll keep you all updated about the progress.
Once again, thank u!
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,964
Reaction score
3,358
Location
Sacramento, CA area
Rating - 0%
0   0   0
Thank u very much. Iam still waiting for my power supplies and heatsinks but this weekend I will start to some coding tests. I saw that there are some diferences in pwm coding for esp8266 and esp32, so maybe not so It Will bê not straightfoward lol but i'll do my best :).
I'll keep you all updated about the progress.
Once again, thank u!


There are some, but the ESP32 hardware does a lot more.
 

TDEcoral

Active Member
View Badges
Joined
Apr 14, 2017
Messages
359
Reaction score
387
Rating - 0%
0   0   0
There are some, but the ESP32 hardware does a lot more.

I don't know much about ESP32. Can you give a quick rundown of what it can do that ESP8266 can't? Off the top of my head I want to say it's Bluetooth capable, is that right?
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,964
Reaction score
3,358
Location
Sacramento, CA area
Rating - 0%
0   0   0
A table: https://maker.pro/esp8266/tutorial/a-comparison-of-the-new-esp32-s2-to-the-esp32

Note that PWMs are all software based still, but the processor does a good enough job. Its a fantastic glue processor, but some of the features on the new hardware are a bit suspect (the ADC is not great, only useful for some limited measurements and is really there for the touch sensor support). Still, at the price, its fantastic.
 
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
Hey guys, I want to thank you all to trying to help me. After all these days trying to understand how to write this code. I understood that this thing is much beyond my poor coding skills. I can't even understand the codes and i have no idea on how to put It in practice. It is frustrating because I had a good experience with Esp32 for controlling charges, reading temperature etc so I thought this will be a similar thing but, at least for me, it seems much harder ‍♂️. I was able to controll PWM of the leds without issues but I Just can't understand the logic employed to put this on the schedulle and using a ramp up/down commands. Looks like greek language to me lol. Esp32 seems to have some different commands in pwm compared to arduino and Esp 8266 so I wouldnt be able to test those codes in my project. I guess I will need many coding lessons before doing something like this. It is frustrating but I would like to thank u ALL for helping me
 

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,610
Reaction score
3,451
Rating - 0%
0   0   0
Hey guys, I want to thank you all to trying to help me. After all these days trying to understand how to write this code. I understood that this thing is much beyond my poor coding skills. I can't even understand the codes and i have no idea on how to put It in practice. It is frustrating because I had a good experience with Esp32 for controlling charges, reading temperature etc so I thought this will be a similar thing but, at least for me, it seems much harder ‍♂️. I was able to controll PWM of the leds without issues but I Just can't understand the logic employed to put this on the schedulle and using a ramp up/down commands. Looks like greek language to me lol. Esp32 seems to have some different commands in pwm compared to arduino and Esp 8266 so I wouldnt be able to test those codes in my project. I guess I will need many coding lessons before doing something like this. It is frustrating but I would like to thank u ALL for helping me

Shows the differences.. Maybe it will help.

The analogWrite() function accepts two parameters:

The number of the pin to which the LED is connected
The PWM value from 0 to 254

Inside the loop function, each time it is called, the brightness value is increased or decreased by 5, depending on whether we are increasing or decreasing the LED brightness.

Simple.

The ESP32 does not support the analogWrite() function. But it does support a much better one, the ledcWrite() function.

The ledcWrite() is very similar to analogWrite(). It also requires two parameters:

The PWM channel that we want to “write” a value to.
The PWM value we want to write to the selected channel.
 
Last edited:
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
I don't know why i have a maior symbol instead a sad face emoji in my reply lol.
 

oreo54

5000 Club Member
View Badges
Joined
Sep 18, 2017
Messages
5,610
Reaction score
3,451
Rating - 0%
0   0   0
I don't know why i have a maior symbol instead a sad face emoji in my reply lol.
I don't know why I've got a big blank white box for my link..

medium.com/jungletronics/esp32-idf-ledc-get-started-f973c4b7e41e

just add the https stuff..

I love it when they say..
And that is all!
when my eyes already glazed over paragraphs ago.. ;)
 
Last edited:
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
Thanks Oreo, I already read this one but i will read It again. My main difficult is to set the events in time. Like, Chanel 1 on at 10:00 am, ramping up to 100% in a hour and ramp down after 10:00pm... I read some codes with similar targets but i still can't understand. I guess iam little lost in such big codes (big for a vet with no coding skills). For sure I need to improve my coding skills before trying to code something like this. I will keep trying but i guess this will take a much longer time than I was expecting. When I have sth, i will post here. Once more, thks.
 
OP
OP
S

Stuginski

Community Member
View Badges
Joined
Jul 5, 2020
Messages
52
Reaction score
10
Location
Brazil
Rating - 0%
0   0   0
I don't know why I've got a big blank white box for my link..

medium.com/jungletronics/esp32-idf-ledc-get-started-f973c4b7e41e

just add the https stuff..

I love it when they say.. when my eyes already glazed over paragraphs ago.. ;)

Good! This is new for me. Let's start again. Thks
 

Looking for the spotlight: Do your fish notice the lighting in your reef tank?

  • My fish seem to regularly respond to the lighting in my reef tank.

    Votes: 86 76.1%
  • My fish seem to occasionally respond to the lighting in my tank.

    Votes: 13 11.5%
  • My fish seem to rarely respond to the lighting in my tank.

    Votes: 8 7.1%
  • My fish seem to never respond to the lighting in my tank.

    Votes: 0 0.0%
  • I don’t pay enough attention to my fish to notice if they respond to the lighting.

    Votes: 2 1.8%
  • I don’t have any fish in my tank.

    Votes: 2 1.8%
  • Other.

    Votes: 2 1.8%
Back
Top