Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Duty cycle detection

Status
Not open for further replies.
I tried to import your drawing in LTspice but it cannot find the LM339
You can right click on the LM339 and pick another part. Something like it.
Many comparitors do not work well then their inputs are near VCC. Check the data sheet for input range. Most work from -0.4V to VCC-1.5V. So we might have to change things a little. At 80% duty cycle the input will probably be too high. Do you a supply other than +5V?
 
Thats the problem with the 555. You can not get to the points.
Suppose the TTL levels at the input are 0.5V and 4V and you want an upper trip point at 80% duty cycle. That corresponds to a required 3.3V trip voltage.
If the 555 runs from a 5V supply its nominal trip voltages are at 5V/3 =1.66V and 2*5V/3 =3.33V, so you might get away with that. But you can connect a resistor from pin 5 to ground or the 5V supply, thus adjusting both trip points simultaneously, so the upper trip point can be adjusted as required. However, the lower trip point will be half the upper one. This means the hysteresis is not independently adjustable.
cannot find the LM339: how do I import that and from where?
I got it from the Yahoo LTspice User Group. They have a big free library of various models.
 
Suppose the TTL levels at the input are 0.5V and 4V and you want an upper trip point at 80% duty cycle. That corresponds to a required 3.3V trip voltage.
If the 555 runs from a 5V supply its nominal trip voltages are at 5V/3 =1.66V and 2*5V/3 =3.33V, so you might get away with that. But you can connect a resistor from pin 5 to ground or the 5V supply, thus adjusting both trip points simultaneously, so the upper trip point can be adjusted as required. However, the lower trip point will be half the upper one. This means the hysteresis is not independently adjustable.
The duty cycle voltage is 4.5V to 55V, the same as the 555 supply voltage (same rail); so that will be a problem. I think I may forget the 555 unless Ronsimpson shows I may have done something wrong in the simulation.

I got it from the Yahoo LTspice User Group. They have a big free library of various models.
Thàt is being a steep learning curve today :nailbiting:

Should I get the 339 from theit library?

I tried using Eagle to connect to Spice (there is a shortcut), does not work, I checked all boards, forums etc, .. after 2 or 3 years Autocad still has managed to get that working, what a bunch of amateurs in that section.
 
Forget about the Eagle link. I have been an Eagle user for many years and still am. The LTSpice link was poorly implemented and didn't work for me either for anything other than a simple design. I just use LT Spice as a standalone.
 
Forget about the Eagle link. I have been an Eagle user for many years and still am. The LTSpice link was poorly implemented and didn't work for me either for anything other than a simple design. I just use LT Spice as a standalone.
You hit the final nail in that coffin. What a bunch of amateurs working in that section, I hope Autocad will go through that ratsnest with a rough brush; this is supposedly a big selling point and after all these years not a single user I found on internet about this topic has been helped by their own paid employees. Moronic situation.
 
You can right click on the LM339 and pick another part. Something like it.
Many comparitors do not work well then their inputs are near VCC. Check the data sheet for input range. Most work from -0.4V to VCC-1.5V. So we might have to change things a little. At 80% duty cycle the input will probably be too high. Do you a supply other than +5V?
Hi ronsimpson, the whole circuit (duty cycle generation, detection, buffer, comparator,.. function on the same 5V supply.
 
Do not use: 74LS??, 74L??, 74??,
Can use 74C01 is a 2 input NAND gate. Any CMOS logic.
74HC??, 74HCT, CD40?? (any 74CMOS or CD4thsound MC14thsound.
Hi ronsimpson, just a thought: can't I use a 555 in a buffer function?
They sell less than half the cost of a CD4049 or CD4093.
 
The duty cycle voltage is 4.5V to 55V
I don't understand (even assuming '55V' is meant to be 5V). If you low-pass filter (R1C1) a TTL rectangular-wave signal the result should be a voltage varying from about 0V to 5V (I used the range 0.5V to 4V, allowing for circuit losses) as the duty cycle varies from 0% to 100%.
 
Red at 2V and green at 3V are the voltage levels to compare. (could be set by a POT)
Green Vrc is the filtered digital signal. 0% at time 0, then high %, middle %, low %, middle %, high %, 0%.
Vout in blue is the output. Set high if high % and set low if % is low. Will hold id % is in the middle.
upload_2017-10-12_20-52-52.png

V2 through V6 makes the signal. A2 ORs then together. A2 pulls down to 0V and up to 3.6V like a TTL gate.
Nodes highIN and lowIN can be made by POTs.
upload_2017-10-12_20-59-11.png

RonS
 

Attachments

  • PulseWidthDecode.asc
    3.8 KB · Views: 105
I don't understand (even assuming '55V' is meant to be 5V). If you low-pass filter (R1C1) a TTL rectangular-wave signal the result should be a voltage varying from about 0V to 5V (I used the range 0.5V to 4V, allowing for circuit losses) as the duty cycle varies from 0% to 100%.
Hi, I am sorry, I had misunderstood your question.
The actual duty cycle does not go lower than about 45% (the actual circuit producing this duty cycle is still in test phase too, I might get it too go lower in the future). I use an inverting buffer (currently 1x NAND gate from CD4093), but if needed that can be made non-inverting. When the duty cycle is 100%, then the inverter output is 0V, LP filter too. At the lowest duty cycle (currently about 45%) I measure 2.96V after the LP filter at pin 2 of the LM339.
 
Red at 2V and green at 3V are the voltage levels to compare. (could be set by a POT)
Green Vrc is the filtered digital signal. 0% at time 0, then high %, middle %, low %, middle %, high %, 0%.
Vout in blue is the output. Set high if high % and set low if % is low. Will hold id % is in the middle.
View attachment 108592
V2 through V6 makes the signal. A2 ORs then together. A2 pulls down to 0V and up to 3.6V like a TTL gate.
Nodes highIN and lowIN can be made by POTs.
View attachment 108593
RonS
You are absolutely amazing!
I will need some time to study this, thank you for taking the time for this.

Why would A2 pull up to 3.6V only?

Is there provision for hysteresis?
 
This is the circuit producing the duty cycle output to be monitored. I am experiencing a bit of instability when trying to increase the duty cycle variation range and would like to simulate it in LTspice but I need to get started with a component library (I will subscribe to the Yahoo user group alex_t referred to).
The CD74HC132 I used a SN74HC132 as I had it lying around. C3 is changed to 10nF.

Edit: I tap the duty cycle signal from pin 11.
 

Attachments

  • Duty cycle schematic and parts list.png
    Duty cycle schematic and parts list.png
    18 KB · Views: 132
Last edited:
Post #50.
If your output is 0V/5V then at 100% the voltage at "RC" will be very close to 5 volts. The voltage comparitors input will be in the 2.5V to 4.8V range. Most voltage comparitors will not work when both inputs are too close to the VCC supply. With a 5V supply the input will only work from -0.4 to + 3.5V. (It is OK to have one input at 3.5V and the other at 5V) Some SPICE components do not work like real parts.
Two fixes:
1) Invert the signal so 100% = 0V and 0%=5V. Then the "RC" voltage be below 2.5V for 100% through 50%.
2) Add a resistor across C2 to pull down the voltage. (voltage divider) Set the max voltage to no more than 3.5V.

This is the circuit producing the duty cycle output to be monitored.
The picture is too small to read.
 
Post #50.
If your output is 0V/5V then at 100% the voltage at "RC" will be very close to 5 volts. The voltage comparitors input will be in the 2.5V to 4.8V range. Most voltage comparitors will not work when both inputs are too close to the VCC supply. With a 5V supply the input will only work from -0.4 to + 3.5V. (It is OK to have one input at 3.5V and the other at 5V) Some SPICE components do not work like real parts.
Two fixes:
1) Invert the signal so 100% = 0V and 0%=5V. Then the "RC" voltage be below 2.5V for 100% through 50%.
2) Add a resistor across C2 to pull down the voltage. (voltage divider) Set the max voltage to no more than 3.5V.


The picture is too small to read.
______
Quick reply from smartphone: the RC filter is fed with inverted signal. 100% duty cycle is 0V.
 
If you were thinking of using a CD4093 (or other Schmitt gate) as a buffer anyway, it would be a simple matter to use another gate in the same package to do the thresholding/comparison function too, like this :-
DutyCycleDetector2.PNG

How much hysteresis do you actually need?
 
There are a number of these on the market. Set the frequency by Rset and DIV. Set the duty cycle by a 0 to 1V signal on MOD.

upload_2017-10-13_10-58-2.png
 
Status
Not open for further replies.

Latest threads

Back
Top