Schmitt trigger understanding

I had a few questions here about how to read some voltages but never made it work. Detecting 110V DC
Those voltages go from some 70V to 200V. As I haven't access to the system, my work was based on the data I get from the guy I am supposed to make this project. But it is not DC at all. It is AC, and it is as close to a 110V AC as possible, but still not exactly. I made a few measurements and get some 70V - 140V AC, but most readings were around 110V AC.
The problem is how to read variable voltages on a system which I should monitor, but not mess up in it at all. I should only take a two wires and see if there is voltage in it. Finally, I get some spare board of the system to see how they made it. It has been made with my initial approach, but with some additional components.

This is my 50 cents based on their design:

As you can see, they used a Schmitt trigger. I have never used this IC and have little or no experience with it. The other components are familiar. They used here 814 optocouplers, that is why I had bad readings, I used 817 optocouplers.

Question is, how to read it with Nano I attached? My guess is when there is a voltage, I will get some kind of LOW value. But, checking some solutions on the internet, I see some used it as an interrupt. That is why I tied it with the pin 2 on the Nano.

As I said in the topic I mentioned above, I don't have access to the system as much as I would have to. It is some kind of complicated.

I haven't made this project yet, came here first to check am I on the right track.

A PC817 does not have an internal fly-back diode, which in this circuit seems rather relevant.

The 7414 schmit trigger not-gate differs from a normal not-gate (7404) that with a schmitt trigger the transition from logic LOW to logic HIGH is at the exact same voltage as the transition from HIGH to LOW. This means that a squarish-wave will be more accurately timed square than when using a normal not-gate. In this circuit one can assume it to function the same as a 7404. Since you don't measure a wave but just continuous voltage.

Pin A1 on the 7414 will get a LOW value, that means that the nano will get a HIGH from pin Y1.

Thank you for your fast response.

Does this mean that sketch DigitalReadSerial will print HIGH when there is a voltage at the end? If so, I am finally made a step forward. Just to assemble it and check it out with the system.

what sketch ?

Arduino IDE example

Not the way I read the data sheet. Or remember. :expressionless:

Each circuit in SNx414 and SNx4LS14 functions as an inverter. However, because of the Schmitt-Trigger action, they have different input threshold levels for positive-going (VT+) and negative-going (VT–) signals.
These circuits are temperature compensated and can be triggered from the slowest of input ramps and still give clean, jitter-free output signal


1 Like

Not in my version of the IDE, please post the sketch within </> code-tags

That's correct and here required, because the big capacitor will yield a slowly rising signal that can make ordinary inputs ring.

The ATmega controllers have Schmitt-Trigger inputs by default, no external circuits required. See the data sheets for other controllers.

Nope, its the other way. A Schmitt-trigger input has a large amount of hysteresis built in so that its noise tolerance during slowly varying input is large. Normal logic inputs do not work with slowly rising or falling voltages, they both can oscillate and draw excessive power (which matters for battery operated devices).

A lot of devices have a small amount of hysteresis to prevent oscillation when unconnected, but the 74HC14 has lots of hysteresis making it very resistant to noisy analog waveforms triggering a hailstorm of logic transitions.

The great Dave Jones has a video on this:
(checkout the waveform at 7:55)

which is sufficient with slowly raising signals like filtered by external RC low pass.

A Schmitt Trigger is not very precise in handling analog signals. Debouncing better is done in software, noise filtering or elimination should be done in hardware.

What do you mean to say here? How is it imprecise, and what would "precision" mean in this context?

BTW Dave Jones sez LED like "lead", the metal. I say 'L' 'E' 'D'. So who is greater? :expressionless:


A Schmitt Trigger is designed for handling disturbed digital signals.

As OP has no idea how Schmitt Trigger works, it would be nice to tell him will this Schematic above with DigitalReadSerial says is there a voltage or not. That is the whole point of the topic and the question.

The Schematic is the same as the one on the board I had to monitor. Except, the Y1 line on that board goes to the onboard MCU. In my case, to Nano.

I am not ungrateful, but you guys spill too much water in this.
Again, I appreciate all the time you spent here. I am not an engineer, and some of the lines here are not so easy to understand. Maybe to some of you...

Not sure what you are getting at - digital logic behaviour is undefined if you break the dynamic discipline and feed slowly varying signals to logic inputs. In practice you can get oscillations and excess current draw which are sometimes acceptable, but sometimes not.

Every logic family / CMOS process has static and dynamic disciplines you are supposed to follow - static determines the valid voltages for HIGH and LOW (both for inputs and outputs), and dynamic determines how slow transitions are allowed to be before you are outside the guaranteed region of operation, and also for how much noise is tolerated during transitions without breaking the discipline.

So you are usually best off using a comparator or Schmitt-trigger if wanting to feed a slowly varying signal to a digital input. If you don't you may get oscillations and not be able to run at micro-power levels. However if micropower isn't an issue and you are polling an input infrequently you can ignore this.

If your input is triggering an interrupt its really a good idea to use a schmitt-trigger or comparator in these situations as firing dozens of interrupts spuriously isn't great.

There's a particular issue with microcontroller inputs that are dual-function analog and digital. These have to tolerate slow voltage changes and behave, so they will have enough hysteresis to prevent oscillation (assuming only mild noise is present perhaps), and will have their mid-rail power consumption engineered to a minimum.

The underlying mechanism behind all this is that a CMOS inverter consumes no current(*) for a LOW or a HIGH input, but perhaps a few mA when in the middle as both inverter FETs have to be on somewhat. In this condition power is taken from the supply and the inverter acts as a high gain amplifier, boosting noise to significant voltages (and thus oscillating).

(*) By no current I mean millionths of a microamp, which is why CMOS chips can run at a few microamps overall at low clock-speeds as most of the circuitry consumes absolutely negligible power in the static state, other than for this phenomenon and switching losses.

That's no issue. Both signal types are handled by separate circuits inside the chip.

Yes pf course it is, i am so sorry for the confusion. Anyway in this circuit it doesn't really matter at all, Particularly with the 10uF capacitor, basically creating either a slow response ON or OFF, and a 7414 (or a 7404 for that matter) is a Hex NOT-gate.
@who_took_my_nick Oh that example, ah yes i have it. uh, yes, the Opto-coupler ground out the signal to A1 when there is power, the NOT-gate inverts the signal, so a logic HIGH is present at the Nano input pin D2.
In that sketch that should result in '1' being printed to the UART, which is the equivalent of 'HIGH', when there is power and '0' when there isn't.

That doesn't stop the micro-power issue - a chip suddenly consuming milliamps rather than microamps is a big deal if you are trying to have it consume <10 microamps when in sleep mode. For instance if you use a standard ATmega328 chip like this you have to set unused pins as OUTPUT or INPUT_PULLUP to get ultra-low power consumption.