Detect Falling Edge Signal Without Microcontroller
This circuit is useful to detect a voltage drop in a constant signal getting noisy, by detecting and react fast to edge falling signals. The circuit components allow to define the voltage drop threshold with its slew rate for detecting edge falling usually quicker than a microcontroller would do.
The circuit aimed at detecting a drop in a constant signal getting noisy.
It is composed of two parts. Transistor Q1 gets polarized as soon as an edge falling Vin is detected, then a classical bistable circuit with complementary transistors keeps track of edge falling detected in Vin signal. The capacitor C1 is charged to Vin voltage through R3 but not R2 as Q1 emitter-base junction is reverse biased. When Vin starts to drop, the capacitor gives back energy stored ; R3 is better chosen with a high value so most current goes through the emitter-base junction of PNP transistor Q1. When this transistor gets polarized, a major amount of the capacitor energy then is dissipated into R4. That resistance value minimizes capacitor discharge delay but power dissipation does not exceed 1/4 W. For a given current into transistor Q1 base, collector-emitter voltage evolves in a manner the collector current hardly exceeds a value found in datasheet. BC557 used for Q1 allows a collector current not exceeding 25mA when current base is 200 μA. Such a minimum value as current base occurs when Vin cannot act as a sink current, that is to say when Vin drop is just enough to polarize Q1 or else when an open-circuit happens at Vin. R1 value is defined in order to get that minimum current base supposing very few current is discharged through high value resistance R3. Components values in the schematic of this project are designed for Vsupply at 5 volts, and also Vin is about 5 volts.
C1 value is chosen so the time constant R3 C1 gives the slew rate threshold detection for edge falling voltage at Vin. An edge falling is detected when Vin drops quite fast with regards to that time constant from a Vbase-emitter saturation voltage (0.75V when collector delivers 20mA). The circuit may be used as a brown-out voltage detector when C1 is a chemical high capacity : in that case it may be convenient to add a diod in parallel to R3 to have a faster charge of C1. Vin voltage drop threshold can be increased with a greater resistance R2 value. R2 minimal value is calculated so the current flowing from Q1 transistor base does not exceed Peak Base Current while a short-circuit from Vin to Ground.
It may be possible to change PNP transistor for a Pchannel mosfet for Q1 in order to increase pull-down resistance R1 value and also increase drain current allowing a reduced resistance R4 value reducing also the capacitor discharge delay, but then Vin drop voltage threshold detection may be higher (e.g. typical Gate threshold voltage for BS250 is 1.9 V).
The voltage at Q1 collector is then used as an input of the bistable circuit with NPN transistor Q2 polarized as soon as an edge fall activated Q1. When Q2 is polarized, it creates a drop voltage at PNP transistor Q3 base while Vsupply at Q3 emitter is a constant voltage source, so that transistor gets polarized. The current flows from Q3 collector to the LED indicating an edge falling has been detected. Q3 collector is also connected to Q2 base through R6 resistance, so Q2 remains polarized. A way to reset that current loop flowing between Q2 and Q3 is to open the connection at Q2 collector.
If the signal «Edge Falling Detected» should be output to another device, this device should be connected at Q3 collector. When the complementary signal «No Edge Falling Detected» is needed, then the device should be connected to Q2 collector.
I find that circuit more useful than using a microcontroller interruption on edge falling, as slew rate and voltage drop threshold can be tuned with the components. About performance, some PNP transistor datasheets such as 2N3906 mention Turn-on time between 10 and 20 nanoseconds. That can be compared to ATmega328P used by Arduino Uno, at §6.7.1 Interrupt Response Time : «The interrupt execution response for all the enabled AVR ® interrupts is four clock cycles minimum (@16MHz : 4×62.5ns). After four clock cycles the program vector address for the actual interrupt handling routine is executed». When fast and tight voltage detection threshold are needed, maybe specialized operational amplifiers used as fast comparators, claiming a propagation delay of a few hundreds of picoseconds should substitute transistor Q1. Nevertheless, supply current over 10 mA used to be expected instead of the 200 microamperes calculated above.
I suppose this circuit can be adapted to detect edge rising by pulling-up to constant Vsupply the capacitor and R1, and substitute Q1 by a NPN/Nchannel transistor.
It is composed of two parts. Transistor Q1 gets polarized as soon as an edge falling Vin is detected, then a classical bistable circuit with complementary transistors keeps track of edge falling detected in Vin signal. The capacitor C1 is charged to Vin voltage through R3 but not R2 as Q1 emitter-base junction is reverse biased. When Vin starts to drop, the capacitor gives back energy stored ; R3 is better chosen with a high value so most current goes through the emitter-base junction of PNP transistor Q1. When this transistor gets polarized, a major amount of the capacitor energy then is dissipated into R4. That resistance value minimizes capacitor discharge delay but power dissipation does not exceed 1/4 W. For a given current into transistor Q1 base, collector-emitter voltage evolves in a manner the collector current hardly exceeds a value found in datasheet. BC557 used for Q1 allows a collector current not exceeding 25mA when current base is 200 μA. Such a minimum value as current base occurs when Vin cannot act as a sink current, that is to say when Vin drop is just enough to polarize Q1 or else when an open-circuit happens at Vin. R1 value is defined in order to get that minimum current base supposing very few current is discharged through high value resistance R3. Components values in the schematic of this project are designed for Vsupply at 5 volts, and also Vin is about 5 volts.
C1 value is chosen so the time constant R3 C1 gives the slew rate threshold detection for edge falling voltage at Vin. An edge falling is detected when Vin drops quite fast with regards to that time constant from a Vbase-emitter saturation voltage (0.75V when collector delivers 20mA). The circuit may be used as a brown-out voltage detector when C1 is a chemical high capacity : in that case it may be convenient to add a diod in parallel to R3 to have a faster charge of C1. Vin voltage drop threshold can be increased with a greater resistance R2 value. R2 minimal value is calculated so the current flowing from Q1 transistor base does not exceed Peak Base Current while a short-circuit from Vin to Ground.
It may be possible to change PNP transistor for a Pchannel mosfet for Q1 in order to increase pull-down resistance R1 value and also increase drain current allowing a reduced resistance R4 value reducing also the capacitor discharge delay, but then Vin drop voltage threshold detection may be higher (e.g. typical Gate threshold voltage for BS250 is 1.9 V).
The voltage at Q1 collector is then used as an input of the bistable circuit with NPN transistor Q2 polarized as soon as an edge fall activated Q1. When Q2 is polarized, it creates a drop voltage at PNP transistor Q3 base while Vsupply at Q3 emitter is a constant voltage source, so that transistor gets polarized. The current flows from Q3 collector to the LED indicating an edge falling has been detected. Q3 collector is also connected to Q2 base through R6 resistance, so Q2 remains polarized. A way to reset that current loop flowing between Q2 and Q3 is to open the connection at Q2 collector.
If the signal «Edge Falling Detected» should be output to another device, this device should be connected at Q3 collector. When the complementary signal «No Edge Falling Detected» is needed, then the device should be connected to Q2 collector.
I find that circuit more useful than using a microcontroller interruption on edge falling, as slew rate and voltage drop threshold can be tuned with the components. About performance, some PNP transistor datasheets such as 2N3906 mention Turn-on time between 10 and 20 nanoseconds. That can be compared to ATmega328P used by Arduino Uno, at §6.7.1 Interrupt Response Time : «The interrupt execution response for all the enabled AVR ® interrupts is four clock cycles minimum (@16MHz : 4×62.5ns). After four clock cycles the program vector address for the actual interrupt handling routine is executed». When fast and tight voltage detection threshold are needed, maybe specialized operational amplifiers used as fast comparators, claiming a propagation delay of a few hundreds of picoseconds should substitute transistor Q1. Nevertheless, supply current over 10 mA used to be expected instead of the 200 microamperes calculated above.
I suppose this circuit can be adapted to detect edge rising by pulling-up to constant Vsupply the capacitor and R1, and substitute Q1 by a NPN/Nchannel transistor.
Diskussion (2 Kommentare)