Detecting falling edge of signal and stretch the pulse width

Thread Starter

Mehri01

Joined Nov 10, 2023
8
Hi,
I have a signal with 3.3 V amplitude , when error happens voltage drops to 0 V pulse width is around 1.7 ms. I am working with RPI . This frequency is too high for RPI so it cant count the error, It should be around 20 ms . How can I stretch pulse width of this 0 V pulse ?

Thank you in advance.
 

AnalogKid

Joined Aug 1, 2013
10,944
Should be easy to do with a circuit called a monostable (short for monostable multivibrator). The circuit requires two inverting gates, such as 2-input NAND or NOR gates. I prefer the CD4093 quad NAND gate for this. Here is a sample schematic grab from the innergoogle:

1699626363069.png

An RPI could have a problem detecting when a digital input goes low for 1.7 microseconds, but 1.7 microseconds should not be difficult. But separate from that, how long is the minimum time period between error pulses? The question is about this: what should the circuit do if another error pulse happens during the timing period? If an error pulse is stretched to 20 ms, what happens if another error pulse shows up at the input in the middle of the output pulse? The classic monostable will ignore it; once it is triggered, it will ignore any other activity at the trigger input until it has finished its timing period. This is a defining characteristic of a true monostable. If you want the output pulse to restart if another error pulse shows up early, that requires a retriggerable monostable, a slightly different circuit.

Also, what device or circuit does the 20 ms output pulse drive? Current requirement / input impedance?

ak
 
Last edited:

Thread Starter

Mehri01

Joined Nov 10, 2023
8
thank you for your response.
By detecting first error , RPI will disconnect high voltage of the other board to prevent damaging tube, catching first error is important . Programmer asked for stretching PW to do not miss errors. Now with 1.7 ms RPI misses many errors. Base on the written code , suggested PW is around 20 ms to make sure RPI could read it .
Error happens random , sometimes 1 , sometimes consecutive (Completely depends on tube and high voltage value).
I just need to stretch pulse width of the first falling pulse.
 

eetech00

Joined Jun 8, 2013
3,820
Hi,
I have a signal with 3.3 V amplitude , when error happens voltage drops to 0 V pulse width is around 1.7 ms. I am working with RPI . This frequency is too high for RPI so it cant count the error, It should be around 20 ms . How can I stretch pulse width of this 0 V pulse ?

Thank you in advance.
Is the signal normally high and falls to 0 in 1.7ms?
Or, is it normally low, and a pulse is generated with a width of 1.7ms?
Does the input really rest at 0v or does it float?
 

eetech00

Joined Jun 8, 2013
3,820
Is the signal normally high and falls to 0 in 1.7ms?
Or, is it normally low, and a pulse is generated with a width of 1.7ms?
Does the input really rest at 0v or does it float?
You could use something like this:

1699631333862.png

"RC" should connect to GPIO pin.
Pull down is only needed if input signal floats.
Set input pin to analog and trigger at 1.8v or try digital.
 

Thread Starter

Mehri01

Joined Nov 10, 2023
8
Is the signal normally high and falls to 0 in 1.7ms?
Or, is it normally low, and a pulse is generated with a width of 1.7ms?
Does the input really rest at 0v or does it float?
Yes. It is normally 3.3 V and just when error happens drop to 0 for 1.7 ms. RPI should read the 0 V to shut down the high voltage but it is to fast so RPI misses the trigger.
 

Thread Starter

Mehri01

Joined Nov 10, 2023
8
You could use something like this:

View attachment 307170

"RC" should connect to GPIO pin.
Pull down is only needed if input signal floats.
Set input pin to analog and trigger at 1.8v or try digital.
I think I was not clear. Input voltage just becomes 0 for 1.7 ms, then return 3.3 V, Capacitor doesnt have enough time to discharge through the resistor.
 

Thread Starter

Mehri01

Joined Nov 10, 2023
8
Than you so much, in simulation I got the wanted result. I hope it works well in reality.
It is my first question in the forums and You are really awesome. Thanks again for sharing your knowledge.
 

Attachments

eetech00

Joined Jun 8, 2013
3,820
Honestly, I think same as you. But I am the new guy in the company and programmer is old one.
Yes..just show programmer you can fulfill their request. But remind them it could have been handled in software. The programmer may respond with a good reason for not handling it in software.
 
Top