Square wave Duty Cycle shifter - help

Thread Starter

ilgadget

Joined Mar 2, 2025
12
I kindly ask for your help. I need to change the duty cycle of a frequency variable square wave (30Hz to 200Hz) from its ~30% to 50%. That duty cycle must remain fixed while the input frequency varies in that range. A simple monostable like 555 can only be good for a fixed frequency. I really hope you can help me with a circuit as simple as possible. Many many thanks in advance.
 

sghioto

Joined Dec 31, 2017
8,633
You need independent control over frequency and duty cycle within those parameters?
From "Electronics Stack Exchange" on the web.
Will need to calculate C1 and R2 for the frequency range.
Not breadboarded and possible other values for R3 and R5 to stay within the duty cycle range.
1740957809339.png
 
Last edited:

LowQCab

Joined Nov 6, 2012
5,101
What method do want to use to vary the Base-Frequency ?

What method do want to use to vary the Duty-Cycle-Percentage ? ( variable Voltage-Signal is usual )

Why are You attempting to change the Base-Frequency ?
.
.
.
 

AnalogKid

Joined Aug 1, 2013
12,055
Must the output frequency be identical to the input frequency, or is it possible to double the input frequency. For example, source a 400 Hz signal with a 30% duty cycle, and you get a 200 Hz signal with exactly 50% duty cycle.

ak
 

Jerry-Hat-Trick

Joined Aug 31, 2022
779
I'm a huge fan of the 555 - it just won't roll over and die!

But for a low component count and a predictable result I recommend looking at the ATtiny85 processor which can be programmed withe the Arduino IDE. You can use two ADC pins with 10 bit resolution and two potentiometers to set frequency and duty cycle. With the low frequencies you are looking for, the ADC reads are so fast you won't even notice the time thay take if you just use simple code with delayMicroseconds(); for mark and space.
 

Ian0

Joined Aug 7, 2020
13,097
Must the output frequency be identical to the input frequency, or is it possible to double the input frequency. For example, source a 400 Hz signal with a 30% duty cycle, and you get a 200 Hz signal with exactly 50% duty cycle.

ak
The usual way of doubling the frequency is to trigger a monostable on both rising and falling edges of the input waveform, but unfortunately, that gives a 200Hz signal with a 30% duty cycle at the output, just the same as the input signal.
A phase locked loop such as a 4046 could be a possibility.
 

AnalogKid

Joined Aug 1, 2013
12,055
That's not the problem. My read of #1 is that the variable frequency square wave already exists. The problem is that the duty cycle is wrong. I can think of a way to do this in the analog realm, but it is complex.

A better solution might in fact be a small micro, such as a 6-pin or 8-pin PIC or whatever, with one input pin and one output pin. The micro measures the period of the input signal, and synthesizes it at the output pin with a calculated 50/50 duty cycle. This can track changes in the input frequency and duty cycle cycle-by-cycle, with a 1-cycle throughput delay.

ak
 

Ian0

Joined Aug 7, 2020
13,097
That's not the problem. My read of #1 is that the variable frequency square wave already exists. The problem is that the duty cycle is wrong.
He said "I need to change the duty cycle of a frequency variable square wave (30Hz to 200Hz) from its ~30% to 50%", so I presume he has a rectangular waveform of fairly random duty cycle somewhere around 30% and needs a square-wave.
Pity he doesn't need a squarewave of half the input frequency, as that would be easy.
So, phase locked loop to generate a frequency of double the input frequency, then divide by two to get a 50% duty cycle square-wave, but the microprocessor solution might be better, but it can only generate certain frequencies, being (Fclock/2n)
 

sghioto

Joined Dec 31, 2017
8,633
He said "I need to change the duty cycle of a frequency variable square wave (30Hz to 200Hz) from its ~30% to 50%", so I presume he has a rectangular waveform of fairly random duty cycle somewhere around 30% and needs a square-wave.
I read that as the initial waveform is already at 50% duty cycle since the TS says it's a square wave and needs to be able to vary it between 30 and 50% without changing the frequency when set between 30 to 200hz.
 

LowQCab

Joined Nov 6, 2012
5,101
We wont really know anything until the Thread-Starter explains
what he is trying to accomplish with all the details.
.
.
.
 

Thread Starter

ilgadget

Joined Mar 2, 2025
12
Hi all, thank you so much for your kind help. Excuse me for delay, I am free now from work.
I'll try to explain me better.
Yes, the frequency of input signal is varying from 30 to 200 Hz max, but it has ever a fixed duty cycle of abut 30%. The output must exactly be at the same frequency of input but with a duty cycle of 50%.
The idea of a micro could be very interesting to me being much simpler in terms of circuit complexity, but if I am able to program with an arduino, I am absolutely not able do make a program for it ;-) If not too complex and someone has patience to help me I would be grateful and so happy!
 

Thread Starter

ilgadget

Joined Mar 2, 2025
12
At the output there is a coil to be charged, the device which charges it begins to charge when input signal goes to 0 so it cherges in the remaining 70% wasting energy into warm. Exuse me for my poor english!
 

Ian0

Joined Aug 7, 2020
13,097
Perhaps you could switch on the charger on the falling edge of the signal and switch it off when it is sufficiently charged?
 

sghioto

Joined Dec 31, 2017
8,633
Yes, the frequency of input signal is varying from 30 to 200 Hz max, but it has ever a fixed duty cycle of abut 30%. The output must exactly be at the same frequency of input but with a duty cycle of 50%.
What is this oscillator circuit (30 to 200hz) and why can't the duty cycle be set as needed?
 

Thread Starter

ilgadget

Joined Mar 2, 2025
12
the oscillator circuit is from thirdy part and can not be adjusted, it could be 30 or 35% and should be adjusted as the needed 50% duty cycle
 

Thread Starter

ilgadget

Joined Mar 2, 2025
12
Perhaps you could switch on the charger on the falling edge of the signal and switch it off when it is sufficiently charged?
You centered the problem, it begins to charge on the falling edge and when sufficently charged the device that manages it goes to saturation flatting energy but do not stopping it, so too much wasting warm!!
So delaying the start of charge is the best way, 50% is the optimal starting point
 

panic mode

Joined Oct 10, 2011
4,871
the oscillator circuit is from thirdy part and can not be adjusted, it could be 30 or 35% and should be adjusted as the needed 50% duty cycle
so you need to sync to that oscillator but produce square wave of different duty cycle (independent adjustment)?
 
Top