Simplest circuit possible that should trigger above 4.5V - Page 1
Forum section: electronics / beginners

author: mitrynicolae
author_rank: Contributor
timestamp: June 02, 2019, 05:11:01 pm
content: Hi everyone,Does any of you have any suggestion about a circuit that should trigger on a voltage above 4.5V but bellow or equal to 5V? The specs are as follows:- the if the input voltage is bellow 4.5V the output should be disconnected- if the input voltage is >4.5 but <= 5V then the output should be connected to ground- the circuit should be as simple and as cheap as possible.For example using a simple transistor is does not do the job because if the voltage will be above 0.7V the transistor will conduct which broke the requirements. If we will use a comparator for this job then we will also need a 4.5V refference and also an output transistor since the comparator cannot source sufficient current which complicates the circuit.P.s. Please note that 4.5V is just a wish not a solid requirement. If the suggested design work at 4.4V or 4.6V that is good enough. In fact any voltage that is above 4V is good enough.As a little background, I have a pin of the MCU that is connected to an optocoupler. If the optocoupler is on then the output will be around 3.5V If it is off then the output will be 0V. In the same time the pin of the MCU can be set to output instead of input. In this case it will output 5V. The idea is that ONLY the MCU should trigger the above schematic and not the optocoupler. The optocoupler should only inform the MCU that something is changed.Thank you

author: mariush
author_rank: Super Contributor
timestamp: June 02, 2019, 05:22:46 pm
content: honestly, a couple resistors and a 6-8pin micro would do the job.ex a pic10f320 .. set internal vref to 2.048v or 4.096v and use 2 resistors to divide input by 2-5x to be below max vref.

author: AndersJ
author_rank: Frequent Contributor
timestamp: June 02, 2019, 05:30:03 pm
content: Use a voltage supervisor normally used to reset microprocessors.

author: strawberry
author_rank: Super Contributor
timestamp: June 02, 2019, 06:07:03 pm
content: window comparator

author: soldar
author_rank: Super Contributor
timestamp: June 02, 2019, 07:24:41 pm
content: mitrynicolae, I want to thank you for a question well presented and detailed. You can try this simple circuit and it should be easy to adjust the voltage. Let us know if you have any questions.Edit: Should be 1K5 instead of 1K2 Ohm. You can adjust it.This will have a gradual switch as the voltage increases. If you need a sudden switch then you need a Schmit trigger.

author: langwadt
author_rank: Super Contributor
timestamp: June 02, 2019, 07:34:34 pm
content: sound like anhttps://en.wikipedia.org/wiki/XY_problemwhat are you trying to do?

author: mitrynicolae
author_rank: Contributor
timestamp: June 03, 2019, 03:24:02 pm
content: @langwadt this time I am asking for solution x :p.The fact:Consider a microcontroller A that has an input pin B. This input pin is used to read if the external circuitry has an error by pulling the output voltage of an optocoupler. How an when this optocoupler set its output high is out of this subject. The optocoupler normally outputs 5V but if we add two diodes in series or a voltage divider we will get the 3.5V(ish) specified in the initial description. The pin B will also be used to trigger the calibration circuit. This circuit has a 12V relay which switch between the input terminals (normally on) to a 10V refference (normally off). The relay can also be a 5V, but again this is out of the scope since the MCU cannot control the relay directly due to insufficient current. At the MCU startup a self calibration cycle will be initialized and then the normal flow will continue. As you can imagine, in the normal flow an error on the external circuitry should not trigger the calibration circuit.I know that this should not be done because a pin should be used for only one thing, but I ran off pins on the MCU.P.S. for everyone, if you can suggest a simple I2C switch that can handle 100mA that is good enough for me. In other conditions I should stick with the traditional way, using transistors.@soldar thank you for your appreciation. Unfortunately the provided solution will not work (the first one). Even if I reduce the optocoupler voltage from 3.5 to 2.5V and then use a voltage divider to divide by 5 this voltage, I will obtain 1V by the MCU trigger and 0.5V by optocoupler (external error). At 0.5V a BJT may still be in the saturation region and conduct a little bit. Maybe will conduct only 10mA, maybe only 30mA, but having this uncertainty it is enough to skip the solution. I will analize the trigger Schmit solution to see if this can be achieved by using only one dedicated transistor (maybe it is a transistro that can do this, although from what I know only specialized ICs can do this).

author: D Straney
author_rank: Frequent Contributor
timestamp: June 03, 2019, 07:24:53 pm
content: Since this is a problem caused by running out of I/O pins, maybe you can use a shift register, or an I2C I/O expander to gain more I/O pins, plus a discrete transistor to handle the high current? I don't know your size or cost constraints, but if one extra 8-pin IC + transistor isn't a deal-breaker then that would be my choice for much less headache overall. This one looks pretty simple:https://www.digikey.com/product-detail/en/texas-instruments/PCA9536DGKR/296-20952-1-ND/1216922Otherwise, see if this works for you:When the input is < ~4.3-4.5V, Q1 is on and Q2 is on, which keeps Q3 off (output is floating).When the input is > ~4.3-4.5V, Q1 is off and Q2 is off, so Q3 is on (output is connected to gnd).R1 is there only to make sure that there is a path to gnd for the PNP's base current, in case the circuitry driving the input can only source current (and not sink current).

author: Zero999
author_rank: Super Contributor
timestamp: June 03, 2019, 08:43:51 pm
content: If a single transistor is not precise enough, then how about the TL431?Refer to page 29 of the data sheet, figure 36.http://www.ti.com/lit/ds/symlink/tl431.pdf

author: DDunfield
author_rank: Regular Contributor
timestamp: June 03, 2019, 09:10:56 pm
content: Quote from: mitrynicolae on June 02, 2019, 05:11:01 pmI'm curious about the <= 5v condition above. From reading the rest of the thread, it seems you only need <4.5 and >4.5, why is 5V specifically mentioned? You do not specify behavior when >5v...Assuming it's just mentioned because it's the upper rail and has no other significance:Perhaps not the absolute simplest in component count, but very simple and reliable: Why not use a comparator? (or an op-amp will do).You can precisely set the trip voltage via a resistive divider (or a pot). You can even add a little feedback to get some hysteresis if you need it (I don't think you do in this case).Dave

author: Ian.M
author_rank: Super Contributor
timestamp: June 03, 2019, 09:17:55 pm
content: As D Straney has already pointed out, its probably easier to free up a pin elsewhere. What else do you have connected to the MCU, and for each external device (or related set of devices) how many I/O pins do they use?