Author Topic: Falling edge detector circuit with transistor  (Read 4433 times)

0 Members and 1 Guest are viewing this topic.

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: np
  • BE in Electronics and Communication
Falling edge detector circuit with transistor
« on: June 24, 2020, 07:58:12 pm »
Hello, everyone! I am trying to make a sanitizer dispenser for my home just for fun. I have a small motor pump that I am trying to drive with 12 volts. I have ir module whose output goes low when it detects something in front of it. Now I don't want the motor to keep running while the sensor is detecting something. I just want it to run for 2 seconds and then stop. For this I will need a circuit that will detect the falling edge and generate a 2 second pulse. I do not want to use any ics or arduino. I want it all to be analog. I have made a small circuit which kind of works but I have few problems that needs to be solved.     
As you can see I am testing this circuit with an led on 5v supply. It works the I way want it to. The led turns on when the circuit detects a falling edge produced by the IR sensor and turns off after about 2 seconds if I keep my hand over the sensor. What's good is that it also turns off immediately if I remove my hand from the sensor and 2 seconds have not passed which is exactly what I want. But the problem is even though I am using 220 ohm resistor on 5V, the led isn't that bright. Led is brighter when I put my hand on the sensor after few moments from the last sensor detect but gets dimmer if I put my hand on it immediately after the last sensor detect. Now led is just a test. I want to drive a motor with this circuit. I chose ZXT689B  because it can drive 3A of current. Is there any way possible that I can drive loads that draw more current with this circuit without using another transistor? If yes what changes do I need to make. And how do I solve the dim led problem when sensor detects occur in immediate succession?

Thank You
« Last Edit: June 24, 2020, 08:00:56 pm by MrOmnos »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: Falling edge detector circuit with transistor
« Reply #1 on: June 24, 2020, 08:43:02 pm »
In the words of the Irishman responding to the tourist's request for directions: "Well sir, if I were you, I wouldn’t start from here"

To get snap-action switching and a transistor that turns hard on and hard off, you need DC positive feedback. Unfortunately a single transistor is inherently inverting in any configuration that offers gain suitable for feedback*, so without adding another transistor, only negative feedback is possible.

If you want to pursue this with discrete components, google: BJT Schmitt trigger
Note that the classic BJT Schmitt trigger is emitter coupled, so if you don't want undesirable interactions with the load current, you'd need a third transistor to actually switch the load.

Also note the high quiescent current makes discrete BJT solutions unsuitable for battery powered devices.  If you still want to stay with discretes, you'd be looking at having to use five MOSFETs, four to build a CMOS non-inverting buffer to build the Schmidtt trigger around and one to switch the load. 

Although such circuits are interesting to breadboard, arbitrary artificial constraints like "No ICs", almost invariably lead to an inferior solution.  Tip: allow yourself one simple (gates only) CMOS logic IC!

* As a transistor inverts in a common emitter configuration, and has less than unity voltage gain as an emitter follower (common collector) and less than unity current gain in a common base configuration, you cant apply DC coupled positive feedback to a single transistor.
« Last Edit: June 25, 2020, 02:50:50 am by Ian.M »
 

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: np
  • BE in Electronics and Communication
Re: Falling edge detector circuit with transistor
« Reply #2 on: June 24, 2020, 10:06:48 pm »
Ok, so we can't do it with one transistor but still I am in no mood of soldering a 8 pin or 16 pin ic and certainly not in the mood to solder 5 mosfets just to turn on a tiny motor. I mean there is certainly a circuit that can achieve what I am trying to achieve using a transistor and mosfet. Let's talk about above circuit, We can clearly see it is producing a pulse of 2s and is triggered by the falling edge. Now, How do I use this pulse to drive my motor? May be drive a mosfet with that? I don't remember how I passed my basic electronics class so, please bear with me. Maybe I will learn something. I am not really good at analog stuff.


 
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: Falling edge detector circuit with transistor
« Reply #3 on: June 25, 2020, 01:33:46 am »
Personally I find it a lot easier to solder an IC than a whole bunch of discrete transistors totalling the same or higher number of pins.

Neither of your circuits will work as intended:

The first is the closest, but it triggers on the rising edge not the falling edge, the on time is highly dependent on the specific transistor's Vbe vs Ib curve and its hFE,and it takes a long time to reset ready for the next trigger, and also if the input is a 12V level like the supply, when the input goes low, it Zeners the ZTX689B's reverse biassed B-E junction which slowly damages it, reducing its gain. 

The second has all the undesirable features of the first except that 5V isn't enough to Zener a B-E junction. Also its on time (if it turns on at all and doesn't stay on) and how hard it turns on is determined by the capacitor leakage current, the ZTX689B reverse B-E leakage current and the time the input pulse was low, so with a high quality capacitor it basically doesn't work.

LTspice sims attached, as even if you've got a decent multichannel scope and maybe even a current probe, its a lot easier and quicker to discard really hopeless ideas in a sim than on a breadboard.

I also attach a sim of a non emitter-coupled two BJT Schmidtt trigger, showing snap action switching with a triangle wave input which may give you a starting point for a two BJT circuit (or even a BJT + MOSFET circuit) capable of driving your pump motor.  You'd still need to add a diode +RC network in front of it to implement the negative edge trigger and on time requirements.

Edit: I've designed a BJT + MOSFET timer circuit to meet your requirements based on the Schmidt trigger attached this post. Unfortunately, in addition to the single BJT and MOSFET, it used three diodes and eight passives. It could be muntzed a bit but only at the expense of its performance and long-term reliability.  I'll post it after you've had a chance to come up with your own version.
« Last Edit: June 25, 2020, 03:44:20 am by Ian.M »
 

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: np
  • BE in Electronics and Communication
Re: Falling edge detector circuit with transistor
« Reply #4 on: June 27, 2020, 04:23:33 pm »
I ended up using a 555 timer lol. I found a schmitt trigger circuit with two transistor but didn't know how to make it work with the ir sensor. Learned about monostable virbrator and figured out that putting a capacitor on the input will trigger the timer on falling edge and ignore if the sensor out remains low. Everything is working well. I can use a different value caps and resistors to change the on time.
Here's the schematic


But I have one problem with this schematic. When I power the circuit somehow the timer is triggered and the motor runs. Is this issue something to do with the 555 timer or is this something to do with my circuit. How can I solve this issue. Thanks
 

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: np
  • BE in Electronics and Communication
Re: Falling edge detector circuit with transistor
« Reply #5 on: June 27, 2020, 05:21:26 pm »
Hey, I have a look at the circuit you designed?
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: Falling edge detector circuit with transistor
« Reply #6 on: June 27, 2020, 05:25:35 pm »
You probably need a RC network on the 555 reset pin to guarantee it powers up with its output low.  Try 100nF between RST and GND, with a 10K pullup to Vcc.  Also note that it doesn't terminate the output pulse if the input pulse is shorter than two seconds low - if you want that, it needs an extra capacitor to couple the input pulse to Threshold, and an extra resistor so the rising edge to Threshold from the input pulse doesn't get lost in the timing capacitor.

I've attached LTspice sims for the discrete BJT + MOSFET Schmidt trigger timer I suggested earlier + my take on a 555 version.
 

Offline MrOmnosTopic starter

  • Frequent Contributor
  • **
  • Posts: 268
  • Country: np
  • BE in Electronics and Communication
Re: Falling edge detector circuit with transistor
« Reply #7 on: June 27, 2020, 07:21:45 pm »
I have 2 questions about the circuit of 555 you have designed.


So, the timing cap charges through the 180k + 2.2K resistors.

But for discharge it will discharge through 2.2K. Is there any reason for this? And would it be any different if it was connected something like this.


Another question is, why not connect input directly to the threshold so that 555 output goes low when sensor output goes high. The threshold pin needs to be 2/3 of vcc and above for the 555 input to be low right? So if I connect my sensor input directly to threshold pin, when ever sensor input goes high or sensor is not detecting anything the 555 output is low. But when the 555 trigger pin is triggered by a low signal from sensor, the capacitor starts charging and timer starts but the user removes his hand before the timer ends and the threshold goes high and 555 output goes low. Sound like it should work this way the way but I can be totally wrong.  :D  Why is the 10nF cap and 10k pullup necessary on threshold.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: Falling edge detector circuit with transistor
« Reply #8 on: June 27, 2020, 08:01:42 pm »
Its not at all clear in most 555 and compatible datasheets, but the discharge pin has a limited current sinking capability.  Therefore R2 (between discharge and the timing capacitor) is needed to prevent excessive current into the discharge pin when it goes low (i.e. when the output goes low).  I wouldn't recommend using less than 100 ohms there. R2 also influences how fast the timing cap discharges to become ready to trigger again.  If its triggered before the timing capacitor has fully discharged (approx 0.1 seconds with these component values), the resulting timing cycle will be shorter than it should be.

Your proposed mod of input pulse direct to Threshold wont work as it removes the two second timing functionality.  To get it to time, Threshold must 'see' the voltage on the timing capacitor, which in my circuit it does via R4, which is *NOT* a pullup.
« Last Edit: June 27, 2020, 08:05:37 pm by Ian.M »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf