PWM Duty Cycle "Pulse stretcher"

Thread Starter

Emanuel Silva

Joined Sep 21, 2022
9
Hello.
I've been scouring the web for some time to find a circuit that can assist me in altering a duty cycle inline.

Input - PWM at a 1~5kHz frequency, variable duty cycle

Output - PWM at 1~5kHz, with modified by a percentage or amount duty cycle

Basically I'm looking for a way to have something to control the duty cycle. So that if it's 60% coming in, I'll increase it by an amount so the output is 72%, and have this be effective increse apply to the entire PWM input range. (20% in this case)


Any ideas to pull this off simply, with or without a microcontroller?


I almost copied this text for a long time ago from another thread, but I didn't find the answer
Sorry about my english
Thanks a lot in advance
 

dl324

Joined Mar 30, 2015
16,922
You'll need to use a microcontroller.

The output PWM train will be delayed from the input because the microcontroller will need to determine period/frequency before it can calculate duty cycle.
 

Thread Starter

Emanuel Silva

Joined Sep 21, 2022
9
Nice; what delay should I expect from it assuming 1kHz? It is for a throttle body, so delay shouldn't be very long...
Assuming that I know very little about and I am just a "curious" could you help sketch it up?
Thank you very much again
 

KeithWalker

Joined Jul 10, 2017
3,093
Why don't you want to use a micrcontroller? A circuit using discrete components to do this will be quite complex. An ATTINY85 8 pin DIP can do the job with no other components and just a few lines of code..
 

LowQCab

Joined Nov 6, 2012
4,072
It is possible to do this without a Micro-Controller,
but the conversion must be "adjusted" manually with a Trimpot, rather than a Math Conversion.

You comment on the fact that this is being used to alter a TPS-Sensor came in as I was writing this.
Most TPS-Sensors operate with a "0-to 5-Volt" Signal.
What is your specific application ?, and why do You want to change it ?
.
.
.
 

Thread Starter

Emanuel Silva

Joined Sep 21, 2022
9
Just said that because I don't know the best approach for the problem, but if with s microcontroller is the easiest, best and correct way to do it, I only can thank you for the help if you can explain how to do it...
thank you again
 

Thread Starter

Emanuel Silva

Joined Sep 21, 2022
9
It is not for a TPS sensor; the goal to be honest is to "cheat" that pwm to make a Motor (Valeo IBSG alternator/motor from an electric car) go faster.

To explain
- the car is limited to 45kmh
- the limit comes from ECU (VCU is the actually name of it)
- the motor is capable of +90kmh (which I don't want, 20/30% is enough
- the motor is controlled only by PWM
- the ECU is a VCU from a chinese brand and can't find anyone able to read/write it

Hope this I info helps you help me, I really appreciate it
 

dl324

Joined Mar 30, 2015
16,922
what delay should I expect from it assuming 1kHz?
A little more than 1ms.
Assuming that I know very little about and I am just a "curious" could you help sketch it up?
There's nothing to sketch. You use the microcontroller to detect rising and falling edges. Two rising edges are used to determine period. The falling edge gives you the duty cycle, and the microcontroller would generate the appropriate waveform.
the car is limited to 45kmh
Is this a legal modification?
 
Last edited:

Thread Starter

Emanuel Silva

Joined Sep 21, 2022
9
A little more than 1ms
Perfect

Is this a legal modification?
Of course not but I'll use it on a boat not in the car; I bought a totaled car just because ofthe combo (battery charger motor and vcu)


There's nothing to sketch. You use the microcontroller to detect rising and falling edges. Two rising edges are used to determine period. The falling edge gives you the duty cycle, and the microcontroller would generate the appropriate waveform.
Well, I mean the code; and it will be inline I assume so maybe I'll need some diodes am I wrong?

Thanks a lot again
 

Alec_t

Joined Sep 17, 2013
14,314
Any ideas to pull this off simply, with or without a microcontroller?
Here's the basis for one possibility, not using an MCU :-
ProportionalPulser.jpg

With the component values shown, this sim has a 1kHz pulse rate and a 10% duty cycle and gives consistent results over a -20C to +50C temperature range.
The pulse stretch factor is set by the 250k pot and here is ~25%. The cap voltage ramps up and down above the mid-rail voltage by only a small amount, so that the ramps are fairly linear and the stretch facor is accordingly reasonably constant over a duty cycle range of <10% to >90%.
 

DickCappels

Joined Aug 21, 2008
10,180
I don't know, what is more efficient? A US$ 0.50 integrated circuit programmed with solder or a $2 (or $3 these days) microcontroller with an integrated development environment and a steep learning curve?
 

MisterBill2

Joined Jan 23, 2018
18,508
If the intention is to increase the fuel delivery to have a higher top end RPM and more power towards the higher speeds, which is what you will need for a boat, another choice will be to increase the fuel pressure as the speed increases. That may be a lot simpler. Consider that fuel delivered by an injector, either direct or throttle body, is proportional to both pulse width and pressure. And consider that increasing the pressure with RPM does not require any electronic modifications at all.
JUst change to a constant displacement fuel pump and experiment with different pressure relief valving and you can have whatever fuel boost you require.
 

Thread Starter

Emanuel Silva

Joined Sep 21, 2022
9
Here's the basis for one possibility, not using an MCU :-
Thank you very much!
Would this work with variable frequency (1000-5000) too?
What simulator is that btw? I tried with "falstad" with no luck...

I don't know, what is more efficient? A US$ 0.50 integrated circuit programmed with solder or a $2 (or $3 these days) microcontroller with an integrated development environment and a steep learning curve?
Well, probably a microcontroller could be better and more accurate, but for a person like me, it can be a very steep learning curve... Is seems very easy to you all, but understand that I am not in this area, I am just fascinated with some electronics and i try to understand the basics but without an intensive study I think its not possible to "get it all"...

If the intention is to increase the fuel delivery
It's not a fuel engine; it is an eletric engine (48v alternator / engine) from Valeo.

Thank you all again
 

Alec_t

Joined Sep 17, 2013
14,314
Would this work with variable frequency (1000-5000) too?
Yes. I've just run a sim with 5kHz pulse frequency, with no component value changes, and it's fine. Ideally, the cap and/or pot values would be chosen to suit the frequency.
What simulator is that btw? I tried with "falstad" with no luck...
The excellent LTspice, used a lot by members here. A free download from Analog Devices. If you try it, read the Help and tutorials provided with it to get started.
I understand Falstad has limitations.
 
Top