PWM circuit to dim an LED

jayanthd

Joined Jul 4, 2015
945
So I did some searching for books that might help you get started with MCU programming, and I've got bad news and good news.

The bad news is that I couldn't find any book that I would deem as satisfactory for a newbie to start programming projects with.
But I found this book which can help Mellissa learn PIC programming.

https://www.mikroe.com/ebooks

https://www.mikroe.com/ebooks/pic-microcontrollers-programming-in-c/introduction

https://www.mikroe.com/ebooks/pic-microcontrollers-programming-in-c/analog-modules

https://www.mikroe.com/ebooks/pic-microcontrollers-programming-in-c/ccp-modules
 

jayanthd

Joined Jul 4, 2015
945
Please be aware that my comment eschewing a pot was only in the context of a voltage divider in a simple battery / LED circuit not in the context of controlling a PWM output
If PWM is not required to control the brightness of the LEDs then You just need the Mosfet circuit part in my schematic and an SPST switch at the Gate of Mosfet.

Oops... only an SPST switch.
 
Last edited:

cmartinez

Joined Jan 17, 2007
8,796
Nice... but then again, those books teach programming in C. I guess all that's left is for Mellisa to decide which road she wants to take.
 

TeeKay6

Joined Apr 20, 2019
573
If PWM is not required to control the brightness of the LEDs then You just need the Mosfet circuit part in my schematic and an SPST switch at the Gate of Mosfet.

Oops... only an SPST switch.
@jayanthd
My understanding of Melissa's post seems to differ from yours. I understand her to say that she does not wish to achieve dimming by simply inserting a pot between the LED and battery, but that using a pot to control PWM would be okay. Perhaps @Mellisa_K can confirm?
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
@jayanthd
My understanding of Melissa's post seems to differ from yours. I understand her to say that she does not wish to achieve dimming by simply inserting a pot between the LED and battery, but that using a pot to control PWM would be okay. Perhaps @Mellisa_K can confirm?
Correct.

My post started with a desire to use components not microcontrollers to control the voltage to the led using PWM.

After successfully buildings some component based suggestions I then got interested in learning about microcontrollers.

All the while, I am NOT wanting to just have a battery and led with a resistor in between. I want a PWM solution. AAC member's have delivered big time for which I am very thankful as it's a learning excercise with a practical, business, purpose at the end: to find the most efficient way to dim an LED with a battery
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
@jayanthd
My understanding of Melissa's post seems to differ from yours. I understand her to say that she does not wish to achieve dimming by simply inserting a pot between the LED and battery, but that using a pot to control PWM would be okay. Perhaps @Mellisa_K can confirm?
PS:

Also, it's my ignorance about the meaning of "PWM control" that may be causing confusion. If so I apologise for not using (knowing) the right language.

I somehow got it in my head that PWM was the ONLY alternative to DC voltage dividing, "MOSFET" approaches notwithstanding. Seems it's not so binary. Sorry.

I thank you for your forbearance
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
@jayanthd
My understanding of Melissa's post seems to differ from yours. I understand her to say that she does not wish to achieve dimming by simply inserting a pot between the LED and battery, but that using a pot to control PWM would be okay. Perhaps @Mellisa_K can confirm?
PPS:
My only criterion is to refine the project using the least power option (and to keep learning different approaches). Hope all that makes sense
 

jpanhalt

Joined Jan 18, 2008
11,087
After your reading, do you want to stay with PIC or go to some other microcontroller? Atmel (also Microchip: https://www.microchip.com/wwwproducts/en/ATmega32), ST (https://www.st.com/en/microcontrollers-microprocessors.html), TI (http://www.ti.com/microcontrollers/overview.html ) are also common.

Have you thought about which language? (Assembly, C and its variants, Basic)

There has been some discussion about PIC's, the 10F322 vs. 12F1840 mainly.* The main difference is core size. The 10F322 has a 13-bit core and a lot of nice peripherals(e.g., NCO, CLC). It has 35 instructions and 64 bytes of user RAM. Notably, it has only TMR0 and TMR2, which are both 8-bit. On the plus side, everything is in one memory Bank. There is also the 12F683 (and similar) that is a 13-bit core device. It has a 16-bit Timer 1, but memory is banked into 2 Banks.

The 12F1xxx (12F1840) has a 14-bit core and 49 instructions. It has the same two 8-bit timers and a 16-bit timer (TMR1) . Timer 1 adds a lot of capability IMHO. It doesn't have some of the peripherals the 10F322 has, but it can have 256 bytes user RAM, and that memory can be mapped so that it is accessed as one linear section. It has a deeper stack and that stack can be accessed. Memory is banked into 32 Banks. Until you move into "bigger" PIC's, that is part of PIC-life. The 14-bit core devices continue with 16F1xxx and later devices that add peripherals and memory.

John

*The most basic PIC's are 12-bit core (e.g., 12F509). They have 33 instructions, no interrupts, and only a 2-level stack. I would not recommend them, except for the most basic, single-function device.
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
After your reading, do you want to stay with PIC or go to some other microcontroller? Atmel (also Microchip: https://www.microchip.com/wwwproducts/en/ATmega32), ST (https://www.st.com/en/microcontrollers-microprocessors.html), TI (http://www.ti.com/microcontrollers/overview.html ) are also common.

Have you thought about which language? (Assembly, C and its variants, Basic)

There has been some discussion about PIC's, the 10F322 vs. 12F1840 mainly.* The main difference is core size. The 10F322 has a 13-bit core and a lot of nice peripherals(e.g., NCO, CLC). It has 35 instructions and 64 bytes of user RAM. Notably, it has only TMR0 and TMR2, which are both 8-bit. On the plus side, everything is in one memory Bank. There is also the 12F683 (and similar) that is a 13-bit core device. It has a 16-bit Timer 1, but memory is banked into 2 Banks.

The 12F1xxx (12F1840) has a 14-bit core and 49 instructions. It has the same two 8-bit timers and a 16-bit timer (TMR1) . Timer 1 adds a lot of capability IMHO. It doesn't have some of the peripherals the 10F322 has, but it can have 256 bytes user RAM, and that memory can be mapped so that it is accessed as one linear section. It has a deeper stack and that stack can be accessed. Memory is banked into 32 Banks. Until you move into "bigger" PIC's, that is part of PIC-life. The 14-bit core devices continue with 16F1xxx and later devices that add peripherals and memory.

John

*The most basic PIC's are 12-bit core (e.g., 12F509). They have 33 instructions, no interrupts, and only a 2-level stack. I would not recommend them, except for the most basic, single-function device.
Very well set out factors to consider and decisions to make John. So useful for current and future reference.

I am humbled by your and others attention and willingness to help.

Mellisa
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
If PWM is not required to control the brightness of the LEDs then You just need the Mosfet circuit part in my schematic and an SPST switch at the Gate of Mosfet.

Oops... only an SPST switch.
I want to (continuously) control the brightness jayanth
 

OBW0549

Joined Mar 2, 2015
3,565
My post started with a desire to use components not microcontrollers to control the voltage to the led using PWM. After successfully buildings some component based suggestions I then got interested in learning about microcontrollers.
I ran across this series of tutorials by Mike Silva which may help a bit; it seems well-written, covers a lot of ground, and it starts at the very beginning.
 

crutschow

Joined Mar 14, 2008
38,582
If you want the absolute best efficiency to control an LED's brightness, then you would use a constant-current switching buck regulator.
But, of course, that's a more complicated approach.
It also uses PWM to control the current but has an inductor instead of a resistor to limit the current, so is more efficient.
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
If you want the absolute best efficiency to control an LED's brightness, then you would use a constant-current switching buck regulator.
But, of course, that's a more complicated approach.
It also uses PWM to control the current but has an inductor instead of a resistor to limit the current, so is more efficient.
Maybe another day
 

Danko

Joined Nov 22, 2017
2,192
I looked on the internet and found references to PWM as a means of more efficiently controlling the voltage to the LED.
LTC3490 use PWM for current controlling through the LED.
I don't want to use a microcontroller. I want to use a hard wired circuit using active electronics components like ICs and transistors
LTC3490 is not microcontroller but IC using in hard wired circuits.
The voltage source for both the LED and the dimmer circuit must be portable and no larger than 3 X AAs or perhaps AAAs or perhaps a 9v.These constraints reflect physical space available in my project.
LTC3490 allows you to decrease number cells in battery down to 2 X AAAs or, as option, even to one AAA.
If you want the absolute best efficiency to control an LED's brightness, then you would use a constant-current switching buck regulator.
But, of course, that's a more complicated approach.
It also uses PWM to control the current but has an inductor instead of a resistor to limit the current, so is more efficient.
LTC3490 uses a constant-current switching regulator and inductor instead of a resistor, exactly as @crutschow mentioned.
And my project is a business idea about which I am secretive until I can prove my concept because I don't want to be beaten to the (market) punch.
So, LTC3490 is simplest and cheapest by its functionality solution for your business idea.
 

Thread Starter

Mellisa_K

Joined Apr 2, 2017
391
LTC3490 use PWM for current controlling through the LED.

LTC3490 is not microcontroller but IC using in hard wired circuits.

LTC3490 allows you to decrease number cells in battery down to 2 X AAAs or, as option, even to one AAA.

LTC3490 uses a constant-current switching regulator and inductor instead of a resistor, exactly as @crutschow mentioned.

So, LTC3490 is simplest and cheapest by its functionality solution for your business idea.
Yes it certainly looks like it, Danko. I will order some and play with it. I've downloaded the data sheet and it brings music to my ears at page 6 "The drive current can be reduced by changing the voltage on CTRL pin ... (and).... This allows a simple potentiometer from Vin to control the current without sensitivity to the battery voltage". YES!

I am going to also look at PIC programming with suggestions from @jayanthd and others . This is too good an opportunity to pass up applied learning in the PIC area.

And i want to achieve the same thing using more componentry circuits (other than based on 555) such as the ones indicated in #7 by @dl324 and in #13 from @jpanhalt

I very much appreciate the trouble youve gone to wading through all the posts to extract my rambling design criteria and checking them off so clearly on your suggested method. That must have taken a while. So thankyou once again. I will darken your doorway again when i get the LTC3490 critters in the post!
viva AAC
 
Top