555 Oscillator Duty Cycle Control

Thread Starter

InPhase277

Joined Feb 15, 2018
23
I have built a square wave generator using a 555 operating at 100 kHz. I was thinking about the possibility of using a microcontroller to pulse width modulate that signal, basically just controlling a transistor through which the signal is fed.

I'm not sure if that makes any sense electrically or is even useful toward controlling the duty cycle of the signal. I was also thinking that there may be an issue with timing of the signal vs. the PWM, but my understanding of all this is quite vague. Any insights?
 

Papabravo

Joined Feb 24, 2006
22,083
If you are going to the trouble of getting a microcontroller then you don't need the 555 for anything. Everything you need is in the microcontroller.
 

AlbertHall

Joined Jun 4, 2014
12,625
You might consider chucking the '555 and using sawtooth generator and a comparator. The duty cycle is then controlled by the reference voltage on the comparator.
 

Thread Starter

InPhase277

Joined Feb 15, 2018
23
That seems like a dubious claim. Can you back up that assertion?
It's not that it can't do it, but the modifications to the timers needed to get that frequency also affect other functions of the uC that I need. Not an intractable problem, but I thought it might be simpler to unload the oscillator function onto a separate circuit.
 

Thread Starter

InPhase277

Joined Feb 15, 2018
23
If it can't generate 100 kHz, why do you think it can perform pulse width calculations and I/O at a 100 kHz rate?

ak
The signal won't pass through the uC. I just thought the microcontroller could turn the signal on and off through a transistor. At any rate, even if what I want to do isn't possible this way, what is the theoretical outcome of such a setup? I picture it like a 100 kHz square wave with gaps due to switching it on and off.
 

AnalogKid

Joined Aug 1, 2013
12,142
The signal won't pass through the uC. I just thought the microcontroller could turn the signal on and off through a transistor. At any rate, even if what I want to do isn't possible this way, what is the theoretical outcome of such a setup? I picture it like a 100 kHz square wave with gaps due to switching it on and off.
That is entirely doable, but is not even close to what the term "pulse-width modulation" means.

https://en.wikipedia.org/wiki/Pulse-width_modulation

ak
 

JohnInTX

Joined Jun 26, 2012
4,787
100kHz PWM is a piece o' cake for an MCU. You just have to choose the right MCU.
+1
Or even a close one. A few jabs at the 'Lil Professor shows that a PIC12F1840 (for example), using its internal 32MHz oscillator will do a 100KHz PWM (within 1.5% or so) with better than 8 bit resolution.
Prescaler = 1
PR2 = 79
50% Duty Cycle with CCPR1L = 40, CCP1CON<5,4> bits = 00

Since the PWM is implemented in hardware, you have lots of time to do other things like read a switch and control the PWM. Clear CCPR1L to set duty cycle to 00 to turn it off. The 16F1xxx are pretty nice to code with XC8 as well.

http://www.microchip.com/wwwproducts/en/PIC12F1840

You could actually do the whole shooting match with a cheap Curiosity board that includes the programmer/debugger plus lots of other stuff. It comes with a 16F1659 that also has hardware PWM. List price $20. 20% discount until 2/28/2018
http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=DM164137
 
Last edited:
Top