LED string with PWM

For users of Matrix Multimedia Electronics software to discuss projects, circuits and any other electronics concepts.

Moderators: Benj, Mods

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi I am busy improving the circuit now.
Where the PWM signal enters the LED board I put a 100K resistor so the zener diode gets less load if there is a problem with the board with the switches.
Also I wonder If I should use bigger capacitors to have less ripple current from the PWM. Does ripple current have a bad effect on the 78L05 regulators?
I was thinking of adding a bigger one between Vin and ground. And maybe do the same on the LED board.
Also I hope it will protect the cirquit against voltage spikes when you get any sparks while plugging the device into the cigarette lighter.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: LED string with PWM

Post by Enamul »

Where the PWM signal enters the LED board I put a 100K resistor so the zener diode gets less load if there is a problem with the board with the switches.
Are you talking about the R3 resistor in the schematic which ultimately connected to pin6 of IC.
Also I wonder If I should use bigger capacitors to have less ripple current from the PWM. Does ripple current have a bad effect on the 78L05 regulators?
Where you are planning to put that capacitor?
I was thinking of adding a bigger one between Vin and ground. And maybe do the same on the LED board.
This is always better..no adverse effect on the circuit.
Enamul
University of Nottingham
enamul4mm@gmail.com

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi Enamul.
Are you talking about the R3 resistor in the schematic which ultimately connected to pin6 of IC.
Yes I am talking about R3 I think wit two Cat4104 it would actually be better to use a 50K resistor since the internal pull down resistor of the current regulator is 200K
Where you are planning to put that capacitor?
Between 12 V and GND of the LED board.

I changed the program and now use the PWM 5KHZ

What capacitor values do you recommend.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: LED string with PWM

Post by Enamul »

Yes I am talking about R3 I think wit two Cat4104 it would actually be better to use a 50K resistor since the internal pull down resistor of the current regulator is 200K
It should be OK as long as you can drive the IC properly.
Between 12 V and GND of the LED board. I changed the program and now use the PWM 5KHZ
What capacitor values do you recommend.
I think you can use 47 to 100uF easily between 12v and GND.
Enamul
University of Nottingham
enamul4mm@gmail.com

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi.
I just wonder how ram works on a pic.
Is it the same as with a computer, where you always should have a certain percentage unused?

When compiling a program it gives the following report:
RAM available:128 bytes, used:117 bytes (91.5%), free:11 bytes (8.5%),
Am I using too much ram?
What parts of a program are using lots of ram?
Heap size:11 bytes, Heap max single alloc:10 bytes
What does this mean?
Is heap size too large?
ROM available:2048 words, used:1519 words (74.2%), free:529 words (25.8%)
I guess this one should be fine.

Any info or links will be appreciated.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: LED string with PWM

Post by Enamul »

If your code occupies 100% of program memory and most of the RAM still works fine as long as it compiles OK. But it good to have some program memory left for your safety for any modification in the code. I believe when the code compiles in the process of producing assembly it defines the number of RAM registers used in the code. For PC memory allocation is much more complicated than 8-bit PIC you are using.

You will get some heap info in the following post...
http://www.matrixmultimedia.com/mmforum ... ize#p38676
Your RAM, ROM usage are fine but heap shows problem as heap is allocated from RAM if you could free some RAM space.Heap should be OK.
Enamul
University of Nottingham
enamul4mm@gmail.com

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi Enamul.
I read the topic about heap but still do not understand fully.
Is heap leftover space on a memory location, so if there are more free locations heap size is not a problem?

I just wander if this could cause my program to become unstable.

I actually want to move to a surface mount IC so I am considering if the Pic16F1825 would not be better, then I will have more pins free and do not have to use ADC for reading the three buttons. (This is what is not working properly on my circuit) It also has plenty of program memory and ram. So I have a lot of room to to add more functions to the camping light.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: LED string with PWM

Post by Enamul »

Is heap leftover space on a memory location, so if there are more free locations heap size is not a problem?
Somewhat like that but not the same for every chip..it differs with the RAM amount. I have never faced heap problem as I normally use chip with huge RAM.
If program compiles I think it shouldn't be unstable..ADC could make circuit unstable. Yes, higher memory PIC is always give you more flexibility.
Enamul
University of Nottingham
enamul4mm@gmail.com

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi.
What I want to do is this.
Have a Hardware pwm for dimming LED's
Have an software pwm
Read one adc and read three buttons. Later I might want to add other features like energy budgeting etc.
Do you think a Pic16F1825 could do that?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: LED string with PWM

Post by Enamul »

Yes I think PIC16f1825 can easily do that.
Enamul
University of Nottingham
enamul4mm@gmail.com

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

I was trying to do that with a Pic12F1822.
But for reading the buttons I used an additional ADC I guess that was a bit much?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: LED string with PWM

Post by Enamul »

But for reading the buttons I used an additional ADC I guess that was a bit much?
What are you trying to mean here?
Enamul
University of Nottingham
enamul4mm@gmail.com

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

My question is if it was a bit too much to do all these things with a pic12f1822
Have a Hardware pwm for dimming LED's
Have an software pwm
Read 2 adc channels one of them was used to read three buttons.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi
Someone wants to buy my Camping light.
Just wonder about code protection I do not want the Chinese to make money with my Idea.
But I also want to be able to reprogram the chip if I discover a software glitch.
Can the chip 12F1822 be reprogrammed after code protection has been used?
Best Regards:
Uli

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: LED string with PWM

Post by dazz »

Hi Uli
yes you can reprogram, however you will never be able to fully protect your code, as everything can be broken, all you can hope for is to protect it from the majority of people but if someone wants the code they will get to it see this link , please note i do not condone the blog i linked to rather just showing the lengths people will go to to get at code if they want it http://www.bunniestudios.com/blog/?page_id=40

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi This is Quite interesting.
Hope Micro Chip will soon Increase the size of the shield so that this trick will not work anymore.
I guess the best way to protect yourself is focus on Quality Materials.
This is something the Chinese usually don't copy.
Anyway for me to make a Camping light is just a hobby but I am surprised how much my friends are interested in this kind of camping light.

Best Regards:
Uli

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: LED string with PWM

Post by dazz »

Hi uli
Thing is if microchip make the shields bigger that will increase the price to them and the end user, interestingly I found a site on the net(cant remember what one) but it said the chips with an A on the end have better protection, microchop could cover the whole die with a shield. but then people would just remove the shield.
The copies are getting better all the time, take motorcycles and lathes as an example, 10 years ago Chinese motorcycles and lathes were very shoddy, with lots of returns and problem, today they are much better give em another 10 years or so and they will be on a par with Japanese goods. the one thing they are good at is copying stuff, I bought 2 cuckoo clocks years ago and noticed some writing on the woodwork ,when I removed it they both said Schwartz 1968, I mentioned it to someone I knew at the time who repaired clocks and he said he signed and dated every clock he had repaired so if the same person bought a clock back for repairs he could identify if it was worked on by him, and when I mentioned why I asked the question. he replied ah the Chinese copy every last little detail.

Sometimes however it can work in the hobbyists favour, a very good 8ch rc transmiter was released a few years back by the chinese, a few features in software were lacking , so someone wrote a new firmware and it became very popular, but to upload the firmware it required soldering to the iscp pins then reflashing, the manufactures have just lately released a new version of the transmitter ,with most of the mods people were doing as a standard feature they have also included a programming port and use a slightly tweaked version of the open source firmware and openly encourage it as a fully software upgradeable device. but sadly this is a rare occurance

Did you get a chance to try out the led driver I sent

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Not yet,
I used the cat4104 that I received before.
It is also a good chip.

Shahlam
Posts: 1
Joined: Sun May 19, 2013 7:07 pm
Contact:

Re: LED string with PWM

Post by Shahlam »

Creative25 wrote:Hi Enamul
Thank for all the info.
I just found out that the LED's have a forward voltage of 3.7 volt not 3.3 So I guess it would be better to use only strings of two.
Or should I just drop the current per LED a bit? Will this affect the colour of the LED?
I am using the XlampMX3

Hi Dazz,
I think the CAT4101 looks like a cool device.
Maybe it could even build it into a LED flashlight to get better performance.
I might use it in the future.
How difficult is it to solder these surface mount devices?
I guess you have to make a proper pc board for them.
Best Regards:

Uli
Can you plz give me a clear concept about powerful batteries used in flashlights according to volts ?
Last edited by Shahlam on Mon May 20, 2013 2:31 am, edited 1 time in total.

Creative25
Posts: 323
Joined: Tue Sep 06, 2011 2:54 am
Has thanked: 166 times
Been thanked: 26 times
Contact:

Re: LED string with PWM

Post by Creative25 »

Hi
I am actually not an expert on Batteries
I am planning to use it on a a cheap LED Latern that I already bought.
It uses four AAA batteries. On the electronic side it is just has a switch and a resistor.
I put in rechargable metal hydride batteries, and of course it gives only a weak light because the voltage of the MH batteries is smaller than the voltage of alkaline batteries. So what I plan is to put in a Cat 4101 and a 350ma LED.
That will already be a big Improvement. (Most battery operated camping lights only have a series resistor.)
But a buck converter would be even better.

Best Regards:
Uli

Annabelle LL
Posts: 1
Joined: Tue Aug 20, 2013 8:22 am
Been thanked: 1 time
Contact:

Re: LED string with PWM

Post by Annabelle LL »

Hi this is very interesting, most of dimmable led lamps have flaws, even those by cree have strobe issue while you dim it down.
Instead of adding a dimmer to it, a better solution to save bills is to add a motion sensor to there, see http://www.lightinstar.com/led-tubes-saa-australia/
http://www.lightinstar.com/led-downligh ... australia/
http://www.lightinstar.com/led-high-bay ... 150w-200w/
Last edited by Annabelle LL on Wed Apr 23, 2014 7:42 am, edited 1 time in total.

JonathonJefferson
Posts: 1
Joined: Sat Aug 24, 2013 7:35 am
Been thanked: 1 time
Contact:

Re: LED string with PWM

Post by JonathonJefferson »

Creative25 wrote:Hi
I am actually not an expert on Batteries
I am planning to use it on a a cheap LED Latern that I already bought.
It uses four AAA batteries. On the electronic side it is just has a switch and a resistor.
I put in rechargable metal hydride batteries, and of course it gives only a weak light because the voltage of the MH batteries is smaller than the voltage of alkaline batteries. So what I plan is to put in a Cat 4101 and a 350ma led lights.
That will already be a big Improvement. (Most battery operated camping lights only have a series resistor.)
But a buck converter would be even better.

Best Regards:
Ul
i
I am using these batteries and I am very much satisfied with the results..Very efficient and affordable

Post Reply