Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Schmitt Trigger Level Shifter?

Status
Not open for further replies.

MikeMl

Well-Known Member
Most Helpful Member
I am interfacing a radio receiver to an Arduino. There is a node in the receiver squelch circuit that switches when the receiver detects a RF carrier. No-signal voltage is 7.77V, and it switches (rather slowly, with some jitter) to 4.22V when a RF signal is received. It is a high-Z node, so I cant load it without buffering, likely not more than a few uA.

I want to convert this to a logic level for an Arduino input port pin, using a Schmitt Trigger level-shifter to eliminate multiple transitions with about 100mV of hysteresis. The trip points should be ~ 7.0V and 6.9V. The voltage levels at the Arduino pin should be near 0V and near 5V, not over 5.3V, logic polarity not important because it is trivial to invert the logic later...

Arduino is powered with 5.0V. The radio is powered with 9.0V, so either or both of these well-regulated supplies are available to power the Schmitt Trigger.

I have some ideas, but I'd like some suggestions from the forum for a stable circuit with a low parts count...
 
Considering that the Arduino would already have an A/D input onto which "smart" hysteresis could be easily programmed in a software loop, I'd be inclined to use an emitter-follower with voltage dropping scheme (resistive divider, or that described below) along with a 0.01-0.1uF cap on the A/D input to satisfy the MUX impedance requirements of the Atmel chip.

To extend the useful A/D range I'd probably just shift the DC output downwards on the output of the emitter follower with several 1.8 volt red LEDs ("non-super bright, indicator type) in series with a resistor to ground. The (proper) LEDs have an extremely sharp "knee" and thus an remarkably stable voltage drops over many decades of current (10's of uA to 10's of mA) and the forward voltage is not appreciably affected by ambient light.

There is a temperature dependency with the diodes/emitter follower - but not likely any more so than the receiver itself (and who knows if the sign of the coefficient is the same!) but since this *IS* a computer it is presumed that this voltage drift could be tracked by keeping track of the normal, open squelch (idle) state of the voltage from the receiver! Using variables, one could keep track, over time, of the "open/close" voltage thresholds that it sees and after using the "initial" values hard-coded into it from empirical observation, it could adapt to the inevitable drift up/down of thresholds that will occur with this voltage that these old receivers tend to wildly do over wide temperature ranges without worrying about that drift wandering through a "fixed" threshold.

If an A/D input is not available on the Arduino, I'd have to ask: How did you manage that?
 
I like the idea of the emitter follower, but I am not enthusiastic about the LEDs.
I would be inclined to use two resistors in series in the emitter circuit to make a simple voltage divider in order to get the squelch voltage into the Arduino ADC range.

JimB
 
Here's a possible hardware solution. Not sure how stable it would be, though.
7V_Schmitt.gif
I modelled this over a -20C to +40C temperature range, with no noticeable shift in the trigger thresholds. Don't know how good the CMOS models are for temp dependence.
 
CCT and JimB. Unfortunately, the ADC is heavily committed to another use, so I would prefer not to have switch the processor's analog multiplexor back and forth to two different analog channels...

Alec. I like the CMOS inverters. With the CMOS chip powered from 5V, that makes a clean Arduino input swing with controllable hysteresis.
 
I like the CMOS inverters
I've just realised I showed two non-inverting buffers (out of habit I'm usually twiddling with inverters). No matter ..... either will do :). The 40Meg feedback might be a problem. All resistor values could be scaled down if your radio can handle more than a few uA load.
 
Here is my version of Alec's suggestion. It uses more reasonable resistor values, and has a high input impedance.

LS3.gif

Off to breadboard it...
 
Much improved feedback arrangement, but I'm seeing 800mV hysteresis with those values. I thought you were aiming for 100mV? If R2=550k and R4=1meg you'd be on target.
 
Much improved feedback arrangement, but I'm seeing 800mV hysteresis with those values. I thought you were aiming for 100mV? If R2=550k and R4=1meg you'd be on target.

Actually, after working with the receiver and an RF signal generator where I can make the signal level very close to the squelch threshold, I saw that I needed more hysteresis.
 
Since you have a processor there it would seem strange not to use it to the full extent - particularly on something as "wormy" as an old radio like this whose threshold voltages are likely to walk all over the place with temperature. (I'd bet that there's a thermistor in that radio's squelch circuit for that reason!)

Sorry if I'm preaching to the choir, but it's pretty easy and painless to use the many A/D channels and forget that there's a MUX involved. One possible way to do this is to have a state machine called by the endless loop that does something like:

(Using the "static" variable "State" initialized to 0):

- State 0: Read A/D, store in variable "ADC0", then change MUX to A/D 1 (MUX will be at 0 after the first time through this)
- State 1: By this time, MUX has settled, Start A/D conversion
- State 2: Read A/D, store in variable "ADC1", then change MUX to A/D 0
- State 3: By this time, Mux has settled, Start A/D conversion - Set back to state 0 for next time through

Global variables "ADC0" and "ADC1" will always be up-to-date (albeit a bit delayed) and containing most recent A/D values: If you wanted to know when a value was updated you'd put something like "9999" in it (e.g. a value too large for a 10 bit A/D, small enough for a 16 bit word) and when it changed to something else, you'd know that it was just updated

If this is made to be a separate function, you can have it check the hardware bit to see if an A/D conversion is complete - but RETURN if not, so that your main program never has to wait: The MUX usually settles so quickly that by the time you come back again, it will have already met the settling time, anyway! The other ways would be to have it called by a timed interrupt at a rate of a few hundred Hz . You could also have a "soft" interrupt in which you look at a hardware timer and advance to the next state whenever a counter rolls over or a particular bit changes, etc. - in either case, if your timing was long enough (e.g. slower than a few kHz!) you'd never even have to wait for a MUX to settle or wait an A/D conversion to finish (or even look to see if it did) as you'd be guaranteed to never get back to it before it had!

You may have to dig around a bit in the library to find the way to do an "A/D Start-Only", an "A/D Read-Only" and an "A/D Still-busy-converting", but I'm sure that these are already out there somewhere - and once you use the above functions, you'll keep them around and never think twice about using as many A/D inputs as you want.



As for using LEDs as voltage droppers. About 20 years ago I was working on a commercial project for the automotive environment and I needed a regulator that would operate a PIC microcontroller that operated from 12 volts, but it had to consume no more than 30uA while the unit in which it was placed was "sleeping" (with the PIC operating at 32 kHz) but when it was awake, it had to source 10-20mA. At the time there were really no off-the-shelf options for a regulator that would supply the 3.6-4.2 volts needed for this processor and draw practically zero current over the disparate voltage/current range required.

Anyone who has used a Zener knows that they are useless over this sort of current range - at least over a wide temperature range and with variance from manufacturers and production runs. 3.2-4.5 volt Zeners were tried but at a few uA it was dropping only a few hundred millivolts. Several series diodes were tried (1N4148, 1N4001, etc.) but these had a rather soft "knee" as well.

The strange, yet useful, solution was two ordinary red LEDs in series: These particular Liteon devices changed only about 0.4 volts drop from about 10uA to 20mA for the pair, so a simple emitter-follower was used as the regulator for this processor. When in the "standby" state, the LEDs were biased with a resistor from the +12 volt line somewhere in the 1Meg range, but when "on", this bias was diode-anded to a few mA . The end result was that the unit drew 10-15uA in "standby" mode with the Vcc on the PIC changing only about 0.5 volts between the two states - a change that it could easily "ride out".

The biggest worry when I mention this is that of the well-known sensitivity of LEDs to light, but we thought of this: The forward drop voltage changed only a few 10's of millivolts between darkness and the brightest light that we could muster (Sunlight or my 10 mW HeNe Laser tube) and environmental and in-situ (e.g. production!) testing validated this.

To be sure, the "wrong" sorts of LEDs (super high-bright, green, blue, white - anything that was devised since the mid 1980's) will not work for this, but these were the plain old red, T1-3/4, non high-brightness indicator types that exhibited the 1.7-1.9 volt drop, still cheap and readily available.

Since that time I've used this trick a number of times to get a quick and dirty "3 diode drop" with a nice, sharp knee and it has always worked with no surprises.


(Just something to stick into your mental toolbox.)
 
Hi. This just out from EDN Design Ideas may be of use. It may be possible to choose the resistors to give the hysteresis and output levels you want.

Reading the latest issue today, I saw it and thought of your post.

**broken link removed**
 
Last edited:
...
Reading the latest issue today, I saw it and thought of your post.

Thanks for that... Here is what I did with it. I played around with it to make the Arduino pin swing 0 to 5V, added an LED as a level-shifter and visual indicator, and tweaked the trip points.

LS4.gif
 
Nice improvising there. Trip points will change a bit over temperature and resistors values will have to be tweaked for the beta of the transistors actually used, but hey, it's simple.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top