Any idea for a simpler threshold detection and pulse widening? - Page 1
Forum section: electronics / projects

author: ricko_uk
author_rank: Super Contributor
timestamp: June 26, 2021, 08:22:45 pm
content: Hi,I have a tiny PCB where every fraction of mm counts and even a simple 0402 resistor can make a difference. So wondering if you can think of any simpler circuit than the already very simple one I currently have (see attached).The opto detects various objects which depending on their shape and weight bounce at different rates and in different ways and sometimes also have tiny holes through them giving false detections or no detection. The only guarantee is that at some point the opto beam is definitely interrupted but sometimes because of surface reflection and/or speed of the motion the opto output only drops to half of Vdd or just over half of Vdd. i.e. never reaches GND nor does it stay at whatever value it reached for any significant amount of time.So the circuit inside the red rectangle sets a threshold (which I can fine-tune later on) and if the opto output goes below such threshold even for few tens of us then the output of the first comparator (open collector) goes low charging the cap which is then slowly discharged by the resistor and the pulse squared by the second comparator.Couple of questions:1) Any more clever less-component ones which still allow me to set thresholds and the pulse-width of the output?2) because on the receiver PCB there is a pull-down, I could save the output pullup by using an open-emitter comparator (and connecting C2 and R3 to GND instead of to Vdd) but couldn't find any. Are you aware of any such part which is ready available?Thank you

author: ataradov
author_rank: Super Contributor
timestamp: June 26, 2021, 09:54:24 pm
content: You can use a dedicated reset controller/voltage supervisor. TPS3808G01 has a configurable threshold and reset pulse width. It is not exactly cheap though. But there are many other that may fit the bill depending on the actual requirements.

author: ricko_uk
author_rank: Super Contributor
timestamp: June 26, 2021, 10:01:02 pm
content: Thank you ataradov,I didn't think of that. Nice onethank you!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 26, 2021, 11:34:20 pm
content: Instead of comparators, can use plain old dual schmitt trigger gates, open drain type. Or by extension, a dual NPN or N-ch. Assuming your threshold isn't too picky, which I expect is the case, optos aren't terribly consistent themselves.Tim

author: ricko_uk
author_rank: Super Contributor
timestamp: June 27, 2021, 01:31:25 am
content: Thank you Tim,yes that one is also less components and more compact than mine!

author: RJSV
author_rank: Super Contributor
timestamp: June 28, 2021, 01:09:32 am
content: Nice question!I've got a couple interim questions, but I also wish to study the Texas Instruments data spec. They discuss some input voltage guidelines in general, but I think your circuit is ok there.Did you mean to illustrate the sensor waveform with that 1/5 Vdd ? I assume you meant 1/2 Vdd typo.So, firstly, are you happy with this circuit ? In other words does it now work, and you're asking for mechanically smaller unit ?Straight off, that IC is by theory going to conduct infinite current, except limited by device resistance.Practically, maybe not, a well-versed analog person may say that's only an academic issue. My concern there is that the IC device output 'resistance' does nothave a spec. guaranteed minimum.What sort of current pulse peak happens, when that circuit fires ? Practically speaking someone might say"...worked for me, no IC failures in 25 years in business!". So maybe a manufacturing process improvement causes that 'parasitic' value to go lowersay from 9 ohms down to 0.12 ohms, (assuming spec. never guaranteed an output minimum, that's not a concern of theirs).So, maybe, maybe my concern about over-driving the IC device output is unfounded. But I'm thinking in QUALITY CONTROL MODE, where close forensic exam under microscope for example, sometimes reveals little pits and scars on the IC die itself. NASA techs even coined the term 'punch through', although that's more for over-voltage situations on the microscopic IC regions.R X C implies about 1 millisec time constant, for your stretched pulse output.I think you maybe meant that the target of the sensing board, has its own pull-up ? (Not pull-down)?And by putting C2 and R3 on the ground side, you've only reversed the situation, now the IC has in theory tosink a large peak current. Many, many engineering departments might object: Am I just looking to be jerk?If you want to trigger, on those first little downward wiggles, (see waveform pict), isn't that ok, maybe just use a slightly higher thereshold, aside from that increasing risk of noise causing trigger.But I like the problem, and wonder what about those 'little holes' causing some sensor response.As to mechanical sizes, some tricks still available.I would have started with an LM311, just because of familiarity, but the two included LM311 comparators are open collector (switches to gnd).Give me some time, I'll read more on the LM2903 meanwhile. Thanks,.Rick

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 28, 2021, 05:54:25 am
content: Mmmmokay...LM2903 is just a (looser spec I think?) LM393, or half a 339, etc. An LM324 without compensation, and open collector output, if you will.Its output current is well defined. Output resistance isn't a useful measure for bipolar devices like that; there's a graph in the datasheet (although it's not fully described, like bounding min/max curves). I wouldn't be concerned about the pulsed currents, as far as longevity is concerned; they are not however rated for continuous short circuits, so design accordingly.LM311 has a somewhat faster and much stronger (higher current) output. It uses a similar core (the "uncommitted transistor" output uses some extra hardware).Punch-through is not a phenomenon involved here. It need not be destructive; it's a normal operating mechanism of some IGBTs, and BJTs in pulse avalanche mode for example. It just means that a semiconductor layer has effectively been bypassed in operation, typically due to applied voltage depleting the layer, or by high density of charge carriers (e.g. under high level injection, or at high temperatures).Tim

author: fcb
author_rank: Super Contributor
timestamp: June 28, 2021, 08:04:44 am
content: Using a (7)555 could reduce the component count, if you can cope with a 1/3Vcc trigger point and the output being inverted (high on detect).Else a watchdog timer IC like the STWD100? Probably won't have the precision input threshold but you might get lucky.If you need lots of flexibility (variable threshold & delay) then ATTINY10 / PIC10Fxxx, you'd need at most one PSU decoupling capacitor and the pull-up resistor on the opto-coupler.

author: gamalot
author_rank: Super Contributor
timestamp: June 28, 2021, 08:31:40 am
content: If smaller footprint is very important for your PCB design, there is STM1061 in SOT323 (SC70) package.

author: TurboTom
author_rank: Super Contributor
timestamp: June 28, 2021, 12:44:27 pm
content: You may consider using a microcontroller with integrated comparator and internal DAC and EEPROM. A tiny assembler program will be all that's required to arrange the function that you need. A suitable choice may be aPIC16F18313. Except for a decoupling cap (which could possibly be shared), you won't need any additional hardware so the required PCB space would basically be 3*3mm. You may even utilize additional inputs to step up/down the trigger threshold and the hold time of the output signal so you can configure the behaviour of the unit to your needs without having to change components.The only disadvantage of this approach may be that the hold time is quantized with the MCUs clock cycle, and maybe also the trigger may be synced on the clock. You've got to decide if this may ba a problem for your application or not.Edit: Just noticed -- @fcb elaborated soemting somolar just two posts before - sorry

author: ricko_uk
author_rank: Super Contributor
timestamp: June 28, 2021, 05:02:18 pm
content: Thank you all!Quote from: RJHayward on June 28, 2021, 01:09:32 amI initially had the current limiting resistor to protect the op-amp output but because of the limited space, because the capacitor is only 100nF and also because the capacitor-charging pulses happen only few times a second I don't think that is an issue. So as Tim mentions I don't think it is an issue.Re. the voltage I want to be able to adjust the threshold.The target board does have a pull down (not a pull up). And it cannot be modified. That's why I would need to add a pullup to create a sensible difference between high and low.Quote from: T3sl4co1l on June 28, 2021, 05:54:25 amTim, I cannot find the graph you are referring to in its datasheet.https://www.ti.com/lit/ds/symlink/lm2903b.pdf?ts=1624897384530&ref_url=https%253A%252F%252Fwww.google.com%252FWhich one are you referring to?Thank you

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 28, 2021, 05:55:19 pm
content: It's drawn sideways -- Fig. 6-3. Note the abs. max. 20/25mA rating, and I_OL min 6mA; they do not specify a maximum, and shorting to +V isn't thermally or foldback limited, like a lot of op-amps are. Also Fig 6-24 to 27, essentially the same thing over again but good to know it's independent of supply voltage. I would guess the worst case maximum is around 50mA, with 20-30mA being more typical.It should just be thermal in nature, so the fact that it's low duty cycle means it's fine. I wouldn't discount the possibility of electromigration based failure or something like that. If you're concerned about current limiting, easy solution is a series 100 ohm resistor at the output.Can also significantly reduce required charge, by increasing R and decreasing C. This also increases the detect to hold ratio, i.e. a shorter transient will be detected, or a longer transient will be less dependent on input pulse width.For a more reliable method, consider a comparator into clocked logic with a monostable timer; even fairly short pulses will trigger the timer, which will run for the set time. 74HC123 and the like, there's a whole range of logic timers out there, the features of which I forget (I recall a rich discussion of them in AoE2?). (This might even be less components, but the 14-pin part probably takes more space.)Quote from: fcb on June 28, 2021, 08:04:44 amNeat thing about the 555, the CTRL pin can be biased to change the internal thresholds, over a limited range.You can also, I think, use either threshold, of course only the one way will give a low pulse of defined width. Inversion shouldn't be a problem as the opto can be swapped around easily.Agree with the power detector/reset generator ideas; it's a clever application, though they may be a bit slow to respond (microseconds? -- hah, how fast are we really talking anyway, some milliseconds for a mechanical obstruction?), and may not give a pulse duration starting immediately (there's some delay I think?), or of well-defined or as-desired pulse width (they're available in crude steps, for most families; if one happens to be the width required, there you go!).Another idea that hasn't been mentioned I think, improving the opto: you can use a CCS load, instead of the resistor, to give a much sharper transition at the phototransistor. This should be set by guard-banding the  CTR. Which should leave a modest adjustable range, which you can use as a fine position adjustment for the sensor if you like.Tim

author: ricko_uk
author_rank: Super Contributor
timestamp: June 28, 2021, 06:58:54 pm
content: Thank you Tim!